address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x06c3f2473ca4d3db8845d1213c0d59f81f3f4b33 | /**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
// SPDX-License-Identifier: MIT
// # Runes.sol
// This is a ERC-20 token that is ONLY meant to be used as a extension for the Mysterious World NFT Project
// The only use case for this token is to be used to interact with The Mysterious World.
// This token has no monetary value associated to it.
// Read more at https://www.themysterious.world/utility
pragma solidity ^0.8.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);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_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 {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// The interface is used so we can get the balance of each holder
interface TheMysteriousWorld {
function balanceOf(address inhabitant) external view returns(uint256);
function ritualWallet() external view returns(address);
}
/*
* 888d888888 88888888b. .d88b. .d8888b
* 888P" 888 888888 "88bd8P Y8b88K
* 888 888 888888 88888888888"Y8888b.
* 888 Y88b 888888 888Y8b. X88
* 888 "Y88888888 888 "Y8888 88888P'
*/
contract Runes is ERC20, Ownable {
TheMysteriousWorld public mysteriousworld;
uint256 public deployedStamp = 0; // this is used to calculate the amount of $RUNES a user has from the current block.timestamp
uint256 public runesPerDay = 10 ether; // this ends up being 25 $RUNES per day. this might change in the future depending on how the collection grows overtime.
bool public allowRuneCollecting = false; // this lets you claim your $RUNES from the contract to the wallet
mapping(address => uint256) public runesObtained; // this tracks how much $RUNES each address earned
mapping(address => uint256) public lastTimeCollectedRunes; // this sets the block.timestamp to the address so it subtracts the timestamp from the pending rewards
mapping(address => bool) public contractWallets; // these are used to interact with the burning mechanisms of the contract - these will only be set to contracts related to The Mysterious World
constructor() ERC20("Runes", "Runes") {
deployedStamp = block.timestamp;
}
/*
* # onlyContractWallets
* blocks anyone from accessing it but contract wallets
*/
modifier onlyContractWallets() {
require(contractWallets[msg.sender], "You angered the gods!");
_;
}
/*
* # onlyWhenCollectingIsEnabled
* blocks anyone from accessing functions that require allowRuneCollecting
*/
modifier onlyWhenCollectingIsEnabled() {
require(allowRuneCollecting, "You angered the gods!");
_;
}
/*
* # setRuneCollecting
* enables or disables users to withdraw their runes - should only be called once unless the gods intended otherwise
*/
function setRuneCollecting(bool newState) public payable onlyOwner {
allowRuneCollecting = newState;
}
/*
* # setDeployedStamp
* sets the timestamp for when the $RUNES should start being generated
*/
function setDeployedStamp(bool forced, uint256 stamp) public payable onlyOwner {
if (forced) {
deployedStamp = stamp;
} else {
deployedStamp = block.timestamp;
}
}
/*
* # setRunesPerDay
* incase we want to change the amount gained per day, the gods can set it here
*/
function setRunesPerDay(uint256 newRunesPerDay) public payable onlyOwner {
runesPerDay = newRunesPerDay;
}
/*
* # setMysteriousWorldContract
* sets the address to the deployed Mysterious World contract
*/
function setMysteriousWorldContract(address contractAddress) public payable onlyOwner {
mysteriousworld = TheMysteriousWorld(contractAddress);
}
/*
* # setContractWallets
* enables or disables a contract wallet from interacting with the burn mechanics of the contract
*/
function setContractWallets(address contractAddress, bool newState) public payable onlyOwner {
contractWallets[contractAddress] = newState;
}
/*
* # getPendingRunes
* calculates the runes a inhabitant has from the last time they claimed and the deployedStamp time
*/
function getPendingRunes(address inhabitant) internal view returns(uint256) {
uint256 sumOfRunes = mysteriousworld.balanceOf(inhabitant) * runesPerDay;
if (lastTimeCollectedRunes[inhabitant] >= deployedStamp) {
return sumOfRunes * ((block.timestamp - lastTimeCollectedRunes[inhabitant])) / 86400;
} else {
return sumOfRunes * ((block.timestamp - deployedStamp)) / 86400;
}
}
/*
* # getUnclaimedRunes
* returns the total amount of unclaimed runes a wallet has
*/
function getUnclaimedRunes(address inhabitant) external view returns(uint256) {
return getPendingRunes(inhabitant);
}
/*
* # getTotalRunes
* returns the runesObtained and getPendingRunes for the inhabitant passed
*/
function getTotalRunes(address inhabitant) external view returns(uint256) {
return runesObtained[inhabitant] + getPendingRunes(inhabitant);
}
/*
* # burn
* removes the withdrawn $RUNES from the wallet provided for the amount provided
*/
function burn(address inhabitant, uint256 cost) external payable onlyContractWallets {
_burn(inhabitant, cost);
}
/*
* # claimRunes
* takes the pending $RUNES and puts it into your wallet... you earned these, the gods aren't angry
*/
function claimRunes() external payable onlyWhenCollectingIsEnabled {
_mint(msg.sender, runesObtained[msg.sender] + getPendingRunes(msg.sender));
runesObtained[msg.sender] = 0;
lastTimeCollectedRunes[msg.sender] = block.timestamp;
}
/*
* # updateRunes
* updates the pending balance for both of the wallets associated to the transfer so they don't lose the $RUNES generated
*/
function updateRunes(address from, address to) external onlyContractWallets {
if (from != address(0) && from != mysteriousworld.ritualWallet()) {
runesObtained[from] += getPendingRunes(from);
lastTimeCollectedRunes[from] = block.timestamp;
}
if (to != address(0) && to != mysteriousworld.ritualWallet()) {
runesObtained[to] += getPendingRunes(to);
lastTimeCollectedRunes[to] = block.timestamp;
}
}
} | 0x6080604052600436106101d85760003560e01c80638d5eec9b11610102578063baebddeb11610095578063d5e22fd911610064578063d5e22fd914610522578063dae35b3414610535578063dd62ed3e14610555578063f2fde38b1461059b57600080fd5b8063baebddeb146104c6578063bfd763ca146104d9578063c8942344146104f9578063ceadbe4b1461050c57600080fd5b80639fc8d67d116100d15780639fc8d67d1461045d578063a326a54314610470578063a457c2d714610486578063a9059cbb146104a657600080fd5b80638d5eec9b146103f75780638da5cb5b1461041757806395d89b41146104355780639dc29fac1461044a57600080fd5b8063374901f61161017a57806370a082311161014957806370a0823114610362578063715018a6146103985780638452436c146103ad5780638462a452146103c757600080fd5b8063374901f6146102d557806339509351146102dd5780633bdef865146102fd57806360f162791461032a57600080fd5b806318160ddd116101b657806318160ddd1461024d57806323b872dd1461026c5780632b4b4d9b1461028c578063313ce567146102b957600080fd5b806306fdde03146101dd578063095ea7b3146102085780630a6ddbdb14610238575b600080fd5b3480156101e957600080fd5b506101f26105bb565b6040516101ff9190611554565b60405180910390f35b34801561021457600080fd5b506102286102233660046114bf565b61064d565b60405190151581526020016101ff565b61024b610246366004611506565b610663565b005b34801561025957600080fd5b506002545b6040519081526020016101ff565b34801561027857600080fd5b50610228610287366004611449565b6106ab565b34801561029857600080fd5b5061025e6102a73660046113d6565b600b6020526000908152604090205481565b3480156102c557600080fd5b50604051601281526020016101ff565b61024b610755565b3480156102e957600080fd5b506102286102f83660046114bf565b6107c4565b34801561030957600080fd5b5061025e6103183660046113d6565b600a6020526000908152604090205481565b34801561033657600080fd5b5060065461034a906001600160a01b031681565b6040516001600160a01b0390911681526020016101ff565b34801561036e57600080fd5b5061025e61037d3660046113d6565b6001600160a01b031660009081526020819052604090205490565b3480156103a457600080fd5b5061024b610800565b3480156103b957600080fd5b506009546102289060ff1681565b3480156103d357600080fd5b506102286103e23660046113d6565b600c6020526000908152604090205460ff1681565b34801561040357600080fd5b5061025e6104123660046113d6565b610836565b34801561042357600080fd5b506005546001600160a01b031661034a565b34801561044157600080fd5b506101f261086a565b61024b6104583660046114bf565b610879565b61024b61046b36600461148a565b6108b2565b34801561047c57600080fd5b5061025e60085481565b34801561049257600080fd5b506102286104a13660046114bf565b610907565b3480156104b257600080fd5b506102286104c13660046114bf565b6109a0565b61024b6104d4366004611522565b6109ad565b3480156104e557600080fd5b5061024b6104f4366004611410565b6109dc565b61024b6105073660046113d6565b610c18565b34801561051857600080fd5b5061025e60075481565b61024b6105303660046114eb565b610c64565b34801561054157600080fd5b5061025e6105503660046113d6565b610ca1565b34801561056157600080fd5b5061025e610570366004611410565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156105a757600080fd5b5061024b6105b63660046113d6565b610cac565b6060600380546105ca9061167d565b80601f01602080910402602001604051908101604052809291908181526020018280546105f69061167d565b80156106435780601f1061061857610100808354040283529160200191610643565b820191906000526020600020905b81548152906001019060200180831161062657829003601f168201915b5050505050905090565b600061065a338484610d47565b50600192915050565b6005546001600160a01b031633146106965760405162461bcd60e51b815260040161068d906115a9565b60405180910390fd5b81156106a25760075550565b426007555b5050565b60006106b8848484610e6c565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561073d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b606482015260840161068d565b61074a8533858403610d47565b506001949350505050565b60095460ff166107775760405162461bcd60e51b815260040161068d906115de565b6107a3336107843361103b565b336000908152600a602052604090205461079e919061160d565b61114a565b336000908152600a60209081526040808320839055600b9091529020429055565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161065a9185906107fb90869061160d565b610d47565b6005546001600160a01b0316331461082a5760405162461bcd60e51b815260040161068d906115a9565b6108346000611229565b565b60006108418261103b565b6001600160a01b0383166000908152600a6020526040902054610864919061160d565b92915050565b6060600480546105ca9061167d565b336000908152600c602052604090205460ff166108a85760405162461bcd60e51b815260040161068d906115de565b6106a7828261127b565b6005546001600160a01b031633146108dc5760405162461bcd60e51b815260040161068d906115a9565b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156109895760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161068d565b6109963385858403610d47565b5060019392505050565b600061065a338484610e6c565b6005546001600160a01b031633146109d75760405162461bcd60e51b815260040161068d906115a9565b600855565b336000908152600c602052604090205460ff16610a0b5760405162461bcd60e51b815260040161068d906115de565b6001600160a01b03821615801590610aba5750600660009054906101000a90046001600160a01b03166001600160a01b03166399bb35af6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa491906113f3565b6001600160a01b0316826001600160a01b031614155b15610b1157610ac88261103b565b6001600160a01b0383166000908152600a602052604081208054909190610af090849061160d565b90915550506001600160a01b0382166000908152600b602052604090204290555b6001600160a01b03811615801590610bc05750600660009054906101000a90046001600160a01b03166001600160a01b03166399bb35af6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7257600080fd5b505afa158015610b86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baa91906113f3565b6001600160a01b0316816001600160a01b031614155b156106a757610bce8161103b565b6001600160a01b0382166000908152600a602052604081208054909190610bf690849061160d565b90915550506001600160a01b03166000908152600b6020526040902042905550565b6005546001600160a01b03163314610c425760405162461bcd60e51b815260040161068d906115a9565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610c8e5760405162461bcd60e51b815260040161068d906115a9565b6009805460ff1916911515919091179055565b60006108648261103b565b6005546001600160a01b03163314610cd65760405162461bcd60e51b815260040161068d906115a9565b6001600160a01b038116610d3b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161068d565b610d4481611229565b50565b6001600160a01b038316610da95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161068d565b6001600160a01b038216610e0a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161068d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610ed05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161068d565b6001600160a01b038216610f325760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161068d565b6001600160a01b03831660009081526020819052604090205481811015610faa5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161068d565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fe190849061160d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161102d91815260200190565b60405180910390a350505050565b6008546006546040516370a0823160e01b81526001600160a01b038481166004830152600093849390929116906370a082319060240160206040518083038186803b15801561108957600080fd5b505afa15801561109d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c1919061153b565b6110cb9190611647565b6007546001600160a01b0385166000908152600b602052604090205491925011611132576001600160a01b0383166000908152600b602052604090205462015180906111179042611666565b6111219083611647565b61112b9190611625565b9392505050565b62015180600754426111179190611666565b50919050565b6001600160a01b0382166111a05760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161068d565b80600260008282546111b2919061160d565b90915550506001600160a01b038216600090815260208190526040812080548392906111df90849061160d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166112db5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161068d565b6001600160a01b0382166000908152602081905260409020548181101561134f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161068d565b6001600160a01b038316600090815260208190526040812083830390556002805484929061137e908490611666565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610e5f565b803580151581146113d157600080fd5b919050565b6000602082840312156113e857600080fd5b813561112b816116c8565b60006020828403121561140557600080fd5b815161112b816116c8565b6000806040838503121561142357600080fd5b823561142e816116c8565b9150602083013561143e816116c8565b809150509250929050565b60008060006060848603121561145e57600080fd5b8335611469816116c8565b92506020840135611479816116c8565b929592945050506040919091013590565b6000806040838503121561149d57600080fd5b82356114a8816116c8565b91506114b6602084016113c1565b90509250929050565b600080604083850312156114d257600080fd5b82356114dd816116c8565b946020939093013593505050565b6000602082840312156114fd57600080fd5b61112b826113c1565b6000806040838503121561151957600080fd5b6114dd836113c1565b60006020828403121561153457600080fd5b5035919050565b60006020828403121561154d57600080fd5b5051919050565b600060208083528351808285015260005b8181101561158157858101830151858201604001528201611565565b81811115611593576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260159082015274596f7520616e67657265642074686520676f64732160581b604082015260600190565b60008219821115611620576116206116b2565b500190565b60008261164257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611661576116616116b2565b500290565b600082821015611678576116786116b2565b500390565b600181811c9082168061169157607f821691505b6020821081141561114457634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610d4457600080fdfea26469706673582212203dfe29b4a7d169e1e0b461507152098fc8cdc8c1352ec189117495728bf9d53564736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,500 |
0x54e96d609b183196de657fc7380032a96f27f384 | pragma solidity ^0.4.25;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev Withdraw accumulated balance, called by payee.
*/
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(address(this).balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
payee.transfer(payment);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
contract CryptoEngineerInterface {
uint256 public prizePool = 0;
function calculateCurrentVirus(address /*_addr*/) public pure returns(uint256 /*_currentVirus*/) {}
function subVirus(address /*_addr*/, uint256 /*_value*/) public {}
function claimPrizePool(address /*_addr*/, uint256 /*_value*/) public {}
function fallback() public payable {}
}
interface CryptoMiningWarInterface {
function addCrystal( address /*_addr*/, uint256 /*_value*/ ) external;
function subCrystal( address /*_addr*/, uint256 /*_value*/ ) external;
}
contract CryptoBossWannaCry is PullPayment{
bool init = false;
address public administrator;
uint256 public bossRoundNumber;
uint256 private randNonce;
uint256 public BOSS_HP_DEFAULT = 10000000;
uint256 public HALF_TIME_ATK_BOSS = 0;
// engineer game infomation
uint256 constant public VIRUS_MINING_PERIOD = 86400;
uint256 public BOSS_DEF_DEFFAULT = 0;
CryptoEngineerInterface public EngineerContract;
CryptoMiningWarInterface public MiningwarContract;
// player information
mapping(address => PlayerData) public players;
// boss information
mapping(uint256 => BossData) public bossData;
struct PlayerData {
uint256 currentBossRoundNumber;
uint256 lastBossRoundNumber;
uint256 win;
uint256 share;
uint256 dame;
uint256 nextTimeAtk;
}
struct BossData {
uint256 bossRoundNumber;
uint256 bossHp;
uint256 def;
uint256 prizePool;
address playerLastAtk;
uint256 totalDame;
bool ended;
}
event eventAttackBoss(
uint256 bossRoundNumber,
address playerAtk,
uint256 virusAtk,
uint256 dame,
uint256 timeAtk,
bool isLastHit,
uint256 crystalsReward
);
event eventEndAtkBoss(
uint256 bossRoundNumber,
address playerWin,
uint256 ethBonus
);
modifier disableContract()
{
require(tx.origin == msg.sender);
_;
}
modifier isAdministrator()
{
require(msg.sender == administrator);
_;
}
constructor() public {
administrator = msg.sender;
// set interface main contract
EngineerContract = CryptoEngineerInterface(0x69fd0e5d0a93bf8bac02c154d343a8e3709adabf);
MiningwarContract = CryptoMiningWarInterface(0xf84c61bb982041c030b8580d1634f00fffb89059);
}
function () public payable
{
}
function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
/**
* @dev Main Contract call this function to setup mini game.
*/
function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
{
}
//@dev use this function in case of bug
function upgrade(address addr) public
{
require(msg.sender == administrator);
selfdestruct(addr);
}
function startGame() public isAdministrator
{
require(init == false);
init = true;
bossData[bossRoundNumber].ended = true;
startNewBoss();
}
/**
* @dev set defence for boss
* @param _value number defence
*/
function setDefenceBoss(uint256 _value) public isAdministrator
{
BOSS_DEF_DEFFAULT = _value;
}
/**
* @dev set HP for boss
* @param _value number HP default
*/
function setBossHPDefault(uint256 _value) public isAdministrator
{
BOSS_HP_DEFAULT = _value;
}
function setHalfTimeAtkBoss(uint256 _value) public isAdministrator
{
HALF_TIME_ATK_BOSS = _value;
}
function startNewBoss() private
{
require(bossData[bossRoundNumber].ended == true);
bossRoundNumber = bossRoundNumber + 1;
uint256 bossHp = BOSS_HP_DEFAULT * bossRoundNumber;
// claim 5% of current prizePool as rewards.
uint256 engineerPrizePool = getEngineerPrizePool();
uint256 prizePool = SafeMath.div(SafeMath.mul(engineerPrizePool, 5),100);
EngineerContract.claimPrizePool(address(this), prizePool);
bossData[bossRoundNumber] = BossData(bossRoundNumber, bossHp, BOSS_DEF_DEFFAULT, prizePool, 0x0, 0, false);
}
function endAtkBoss() private
{
require(bossData[bossRoundNumber].ended == false);
require(bossData[bossRoundNumber].totalDame >= bossData[bossRoundNumber].bossHp);
BossData storage b = bossData[bossRoundNumber];
b.ended = true;
// update eth bonus for player last hit
uint256 ethBonus = SafeMath.div( SafeMath.mul(b.prizePool, 5), 100 );
if (b.playerLastAtk != 0x0) {
PlayerData storage p = players[b.playerLastAtk];
p.win = p.win + ethBonus;
}
emit eventEndAtkBoss(bossRoundNumber, b.playerLastAtk, ethBonus);
startNewBoss();
}
/**
* @dev player atk the boss
* @param _value number virus for this attack boss
*/
function atkBoss(uint256 _value) public disableContract
{
require(bossData[bossRoundNumber].ended == false);
require(bossData[bossRoundNumber].totalDame < bossData[bossRoundNumber].bossHp);
require(players[msg.sender].nextTimeAtk <= now);
uint256 currentVirus = getEngineerCurrentVirus(msg.sender);
if (_value > currentVirus) { revert(); }
EngineerContract.subVirus(msg.sender, _value);
uint256 rate = 50 + randomNumber(msg.sender, 60); // 50 - 110%
uint256 atk = SafeMath.div(SafeMath.mul(_value, rate), 100);
updateShareETH(msg.sender);
// update dame
BossData storage b = bossData[bossRoundNumber];
uint256 currentTotalDame = b.totalDame;
uint256 dame = 0;
if (atk > b.def) {
dame = SafeMath.sub(atk, b.def);
}
b.totalDame = SafeMath.min(SafeMath.add(currentTotalDame, dame), b.bossHp);
b.playerLastAtk = msg.sender;
dame = SafeMath.sub(b.totalDame, currentTotalDame);
// bonus crystals
uint256 crystalsBonus = SafeMath.div(SafeMath.mul(dame, 5), 100);
MiningwarContract.addCrystal(msg.sender, crystalsBonus);
// update player
PlayerData storage p = players[msg.sender];
p.nextTimeAtk = now + HALF_TIME_ATK_BOSS;
if (p.currentBossRoundNumber == bossRoundNumber) {
p.dame = SafeMath.add(p.dame, dame);
} else {
p.currentBossRoundNumber = bossRoundNumber;
p.dame = dame;
}
bool isLastHit;
if (b.totalDame >= b.bossHp) {
isLastHit = true;
endAtkBoss();
}
// emit event attack boss
emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, now, isLastHit, crystalsBonus);
}
function updateShareETH(address _addr) private
{
PlayerData storage p = players[_addr];
if (
bossData[p.currentBossRoundNumber].ended == true &&
p.lastBossRoundNumber < p.currentBossRoundNumber
) {
p.share = SafeMath.add(p.share, calculateShareETH(msg.sender, p.currentBossRoundNumber));
p.lastBossRoundNumber = p.currentBossRoundNumber;
}
}
/**
* @dev calculate share Eth of player
*/
function calculateShareETH(address _addr, uint256 _bossRoundNumber) public view returns(uint256 _share)
{
PlayerData memory p = players[_addr];
BossData memory b = bossData[_bossRoundNumber];
if (
p.lastBossRoundNumber >= p.currentBossRoundNumber &&
p.currentBossRoundNumber != 0
) {
_share = 0;
} else {
_share = SafeMath.div(SafeMath.mul(SafeMath.mul(b.prizePool, 95), p.dame), SafeMath.mul(b.totalDame, 100)); // prizePool * 95% * playerDame / totalDame
}
if (b.ended == false) {
_share = 0;
}
}
function withdrawReward() public disableContract
{
updateShareETH(msg.sender);
PlayerData storage p = players[msg.sender];
uint256 reward = SafeMath.add(p.share, p.win);
msg.sender.send(reward);
// update player
p.win = 0;
p.share = 0;
}
//--------------------------------------------------------------------------
// INTERNAL FUNCTION
//--------------------------------------------------------------------------
function devFee(uint256 _amount) private pure returns(uint256)
{
return SafeMath.div(SafeMath.mul(_amount, 5), 100);
}
function randomNumber(address _addr, uint256 _maxNumber) private returns(uint256)
{
randNonce = randNonce + 1;
return uint256(keccak256(abi.encodePacked(now, _addr, randNonce))) % _maxNumber;
}
function getEngineerPrizePool() private view returns(uint256 _prizePool)
{
_prizePool = EngineerContract.prizePool();
}
function getEngineerCurrentVirus(address _addr) private view returns(uint256 _currentVirus)
{
_currentVirus = EngineerContract.calculateCurrentVirus(_addr);
_currentVirus = SafeMath.div(_currentVirus, VIRUS_MINING_PERIOD);
}
} | 0x | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-send", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,501 |
0x4a57e687b9126435a9b19e4a802113e266adebde | pragma solidity 0.4.23;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5f3b3e293a1f3e3430323d3e713c3032">[email protected]</a>
// released under Apache 2.0 licence
// input /Users/zacharykilgore/src/flexa/smart-contracts/contracts/Flexacoin.sol
// flattened : Saturday, 05-Jan-19 14:38:33 UTC
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* 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;
}
}
contract UpgradeAgent {
uint public originalSupply;
/** Interface methods */
function isUpgradeAgent() public view returns (bool);
function upgradeFrom(address _from, uint256 _value) public;
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
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;
}
}
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value
)
internal
{
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract 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 CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
}
contract Recoverable is CanReclaimToken, Claimable {
using SafeERC20 for ERC20Basic;
/**
* @dev Transfer all ether held by the contract to the contract owner.
*/
function reclaimEther() external onlyOwner {
owner.transfer(address(this).balance);
}
}
contract UpgradeableToken is StandardToken, Recoverable {
/** The contract that will handle the upgrading the tokens. */
UpgradeAgent public upgradeAgent;
/** How many tokens have been upgraded. */
uint256 public totalUpgraded = 0;
/**
* Upgrade states.
*
* - `Unknown`: Zero state to prevent erroneous state reporting. Should never be returned
* - `NotAllowed`: The child contract has not reached a condition where the upgrade can begin
* - `WaitingForAgent`: Allowed to upgrade, but agent has not been set
* - `ReadyToUpgrade`: The agent is set, but no tokens has been upgraded yet
* - `Upgrading`: Upgrade agent is set, and balance holders are upgrading their tokens
*/
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading}
/**
* Event to track that a token holder has upgraded some of their tokens.
* @param from Address of the token holder
* @param to Address of the upgrade agent
* @param value Number of tokens upgraded
*/
event Upgrade(address indexed from, address indexed to, uint256 value);
/**
* Event to signal that an upgrade agent contract has been set.
* @param upgradeAgent Address of the new upgrade agent
*/
event UpgradeAgentSet(address upgradeAgent);
/**
* @notice Allow the token holder to upgrade some of their tokens to the new
* contract.
* @param _value The amount of tokens to upgrade
*/
function upgrade(uint256 _value) public {
UpgradeState _state = getUpgradeState();
require(
_state == UpgradeState.ReadyToUpgrade || _state == UpgradeState.Upgrading,
"State must be correct for upgrade"
);
require(_value > 0, "Upgrade value must be greater than zero");
// Take tokens out of circulation
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
totalUpgraded = totalUpgraded.add(_value);
// Hand control to upgrade agent to process new tokens for the sender
upgradeAgent.upgradeFrom(msg.sender, _value);
emit Upgrade(msg.sender, upgradeAgent, _value);
}
/**
* @notice Set an upgrade agent contract to process the upgrade.
* @dev The _upgradeAgent contract address must satisfy the UpgradeAgent
* interface.
* @param _upgradeAgent The address of the new UpgradeAgent smart contract
*/
function setUpgradeAgent(UpgradeAgent _upgradeAgent) external onlyOwner {
require(canUpgrade(), "Ensure the token is upgradeable in the first place");
require(_upgradeAgent != address(0), "Ensure upgrade agent address is not blank");
require(getUpgradeState() != UpgradeState.Upgrading, "Ensure upgrade has not started");
upgradeAgent = _upgradeAgent;
require(upgradeAgent.isUpgradeAgent(), "New upgradeAgent must be UpgradeAgent");
require(
upgradeAgent.originalSupply() == totalSupply_,
"Make sure that token supplies match in source and target token contracts"
);
emit UpgradeAgentSet(upgradeAgent);
}
/**
* @notice Get the state of the token upgrade.
*/
function getUpgradeState() public view returns(UpgradeState) {
if(!canUpgrade()) return UpgradeState.NotAllowed;
else if(address(upgradeAgent) == address(0)) return UpgradeState.WaitingForAgent;
else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
/**
* @notice Can the contract be upgradead?
* @dev Child contract must implement and provide the condition when the upgrade
* can begin.
* @return true if the contract can be upgraded, false if not
*/
function canUpgrade() public view returns(bool);
}
contract Flexacoin is PausableToken, UpgradeableToken {
string public constant name = "Flexacoin";
string public constant symbol = "FXC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 100000000000 * (10 ** uint256(decimals));
/**
* @notice Flexacoin (ERC20 Token) contract constructor.
* @dev Assigns all tokens to contract creator.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Allow UpgradeableToken functionality only if contract is not paused.
*/
function canUpgrade() public view returns(bool) {
return !paused;
}
} | 0x60806040526004361061015e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610163578063095ea7b3146101ed57806317ffc3201461022557806318160ddd1461024857806323b872dd1461026f5780632ff2e9dc14610299578063313ce567146102ae5780633f4ba83a146102d957806345977d03146102ee5780634e71e0c8146103065780635c975abb1461031b5780635de4ccb014610330578063661884631461036157806370a08231146103855780638444b391146103a65780638456cb59146103df5780638da5cb5b146103f457806395d89b41146104095780639738968c1461041e5780639f727c2714610433578063a9059cbb14610448578063c752ff621461046c578063d73dd62314610481578063d7e7088a146104a5578063dd62ed3e146104c6578063e30c3978146104ed578063f2fde38b14610502575b600080fd5b34801561016f57600080fd5b50610178610523565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b257818101518382015260200161019a565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f957600080fd5b50610211600160a060020a036004351660243561055a565b604080519115158252519081900360200190f35b34801561023157600080fd5b50610246600160a060020a0360043516610596565b005b34801561025457600080fd5b5061025d61067b565b60408051918252519081900360200190f35b34801561027b57600080fd5b50610211600160a060020a0360043581169060243516604435610682565b3480156102a557600080fd5b5061025d6106c0565b3480156102ba57600080fd5b506102c36106d1565b6040805160ff9092168252519081900360200190f35b3480156102e557600080fd5b506102466106d6565b3480156102fa57600080fd5b50610246600435610763565b34801561031257600080fd5b506102466109d8565b34801561032757600080fd5b50610211610a66565b34801561033c57600080fd5b50610345610a87565b60408051600160a060020a039092168252519081900360200190f35b34801561036d57600080fd5b50610211600160a060020a0360043516602435610a96565b34801561039157600080fd5b5061025d600160a060020a0360043516610acb565b3480156103b257600080fd5b506103bb610ae6565b604051808260048111156103cb57fe5b60ff16815260200191505060405180910390f35b3480156103eb57600080fd5b50610246610b31565b34801561040057600080fd5b50610345610bd4565b34801561041557600080fd5b50610178610be3565b34801561042a57600080fd5b50610211610c1a565b34801561043f57600080fd5b50610246610c3c565b34801561045457600080fd5b50610211600160a060020a0360043516602435610c95565b34801561047857600080fd5b5061025d610cca565b34801561048d57600080fd5b50610211600160a060020a0360043516602435610cd0565b3480156104b157600080fd5b50610246600160a060020a0360043516610d05565b3480156104d257600080fd5b5061025d600160a060020a0360043581169060243516611158565b3480156104f957600080fd5b50610345611183565b34801561050e57600080fd5b50610246600160a060020a0360043516611192565b60408051808201909152600981527f466c657861636f696e0000000000000000000000000000000000000000000000602082015281565b60035460009074010000000000000000000000000000000000000000900460ff161561058557600080fd5b61058f83836111dc565b9392505050565b60035460009033600160a060020a039081169116146105b457600080fd5b81600160a060020a03166370a08231306040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561062857600080fd5b505af115801561063c573d6000803e3d6000fd5b505050506040513d602081101561065257600080fd5b505160035490915061067790600160a060020a0384811691168363ffffffff61124616565b5050565b6001545b90565b60035460009074010000000000000000000000000000000000000000900460ff16156106ad57600080fd5b6106b88484846112fb565b949350505050565b6c01431e0fae6d7217caa000000081565b601281565b60035433600160a060020a039081169116146106f157600080fd5b60035474010000000000000000000000000000000000000000900460ff16151561071a57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600061076d610ae6565b9050600381600481111561077d57fe5b14806107945750600481600481111561079257fe5b145b15156108155760408051600080516020611735833981519152815260206004820152602160248201527f5374617465206d75737420626520636f727265637420666f722075706772616460448201527f6500000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600082116108985760408051600080516020611735833981519152815260206004820152602760248201527f557067726164652076616c7565206d757374206265206772656174657220746860448201527f616e207a65726f00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0333166000908152602081905260409020546108c1908363ffffffff61147b16565b600160a060020a0333166000908152602081905260409020556001546108ed908363ffffffff61147b16565b600155600654610903908363ffffffff61148d16565b600655600554604080517f753e88e5000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018690529151919092169163753e88e591604480830192600092919082900301818387803b15801561097457600080fd5b505af1158015610988573d6000803e3d6000fd5b5050600554604080518681529051600160a060020a0392831694503390921692507f7e5c344a8141a805725cb476f76c6953b842222b967edd1f78ddb6e8b3f397ac919081900360200190a35050565b60045433600160a060020a039081169116146109f357600080fd5b600454600354604051600160a060020a0392831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600480546003805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60035474010000000000000000000000000000000000000000900460ff1681565b600554600160a060020a031681565b60035460009074010000000000000000000000000000000000000000900460ff1615610ac157600080fd5b61058f83836114a0565b600160a060020a031660009081526020819052604090205490565b6000610af0610c1a565b1515610afe5750600161067f565b600554600160a060020a03161515610b185750600261067f565b6006541515610b295750600361067f565b50600461067f565b60035433600160a060020a03908116911614610b4c57600080fd5b60035474010000000000000000000000000000000000000000900460ff1615610b7457600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600381527f4658430000000000000000000000000000000000000000000000000000000000602082015281565b60035474010000000000000000000000000000000000000000900460ff161590565b60035433600160a060020a03908116911614610c5757600080fd5b600354604051600160a060020a039182169130163180156108fc02916000818181858888f19350505050158015610c92573d6000803e3d6000fd5b50565b60035460009074010000000000000000000000000000000000000000900460ff1615610cc057600080fd5b61058f8383611599565b60065481565b60035460009074010000000000000000000000000000000000000000900460ff1615610cfb57600080fd5b61058f8383611692565b60035433600160a060020a03908116911614610d2057600080fd5b610d28610c1a565b1515610da95760408051600080516020611735833981519152815260206004820152603260248201527f456e737572652074686520746f6b656e206973207570677261646561626c652060448201527f696e2074686520666972737420706c6163650000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0381161515610e345760408051600080516020611735833981519152815260206004820152602960248201527f456e737572652075706772616465206167656e7420616464726573732069732060448201527f6e6f7420626c616e6b0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6004610e3e610ae6565b6004811115610e4957fe5b1415610ea45760408051600080516020611735833981519152815260206004820152601e60248201527f456e73757265207570677261646520686173206e6f7420737461727465640000604482015290519081900360640190fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055604080517f61d3d7a6000000000000000000000000000000000000000000000000000000008152905192909116916361d3d7a6916004808201926020929091908290030181600087803b158015610f2857600080fd5b505af1158015610f3c573d6000803e3d6000fd5b505050506040513d6020811015610f5257600080fd5b50511515610fd55760408051600080516020611735833981519152815260206004820152602560248201527f4e657720757067726164654167656e74206d757374206265205570677261646560448201527f4167656e74000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600154600560009054906101000a9004600160a060020a0316600160a060020a0316634b2ba0dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561104457600080fd5b505af1158015611058573d6000803e3d6000fd5b505050506040513d602081101561106e57600080fd5b5051146111165760408051600080516020611735833981519152815260206004820152604860248201527f4d616b652073757265207468617420746f6b656e20737570706c696573206d6160448201527f74636820696e20736f7572636520616e642074617267657420746f6b656e206360648201527f6f6e747261637473000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b60055460408051600160a060020a039092168252517f7845d5aa74cc410e35571258d954f23b82276e160fe8c188fa80566580f279cc9181900360200190a150565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600454600160a060020a031681565b60035433600160a060020a039081169116146111ad57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b82600160a060020a031663a9059cbb83836040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156112c257600080fd5b505af11580156112d6573d6000803e3d6000fd5b505050506040513d60208110156112ec57600080fd5b505115156112f657fe5b505050565b6000600160a060020a038316151561131257600080fd5b600160a060020a03841660009081526020819052604090205482111561133757600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561136a57600080fd5b600160a060020a038416600090815260208190526040902054611393908363ffffffff61147b16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546113c8908363ffffffff61148d16565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461140e908363ffffffff61147b16565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60008282111561148757fe5b50900390565b8181018281101561149a57fe5b92915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156114fd57600160a060020a033381166000908152600260209081526040808320938816835292905290812055611534565b61150d818463ffffffff61147b16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b6000600160a060020a03831615156115b057600080fd5b600160a060020a0333166000908152602081905260409020548211156115d557600080fd5b600160a060020a0333166000908152602081905260409020546115fe908363ffffffff61147b16565b600160a060020a033381166000908152602081905260408082209390935590851681522054611633908363ffffffff61148d16565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120546116ca908363ffffffff61148d16565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050560008c379a000000000000000000000000000000000000000000000000000000000a165627a7a72305820858d2334797c69e7319d3063fa72cbd95f36ec3c97ad1f0d728fe587f6035bee0029 | {"success": true, "error": null, "results": {}} | 1,502 |
0x681835d86965640399e4f17cb00f40a5812ec11d | /**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256){
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b,"Calculation error");
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,"Calculation error");
uint256 c = a / b;
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256){
require(b <= a,"Calculation error");
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,"Calculation error");
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,"Calculation error");
return a % b;
}
}
/**
* @title IToken
* @dev Contract interface for token contract
*/
contract IToken {
function balanceOf(address) public pure returns (uint256);
function transfer(address, uint256) public pure returns (bool);
function transferFrom(address, address, uint256) public pure returns (bool);
function approve(address , uint256) public pure returns (bool);
}
/**
* @title CLIQWETHLPStaking
* @dev CLIQWETHLP Staking Contract for LP token staking
*/
contract CLIQWETHLPStaking {
using SafeMath for uint256;
address private _owner; // variable for Owner of the Contract.
uint256 private _withdrawTime; // variable to manage withdraw time for Token
uint256 constant public PERIOD_SILVER = 90; // variable constant for time period managemnt
uint256 constant public PERIOD_GOLD = 180; // variable constant for time period managemnt
uint256 constant public PERIOD_PLATINUM = 270; // variable constant for time period managemnt
uint256 constant public WITHDRAW_TIME_SILVER = 45 * 1 days; // variable constant to manage withdraw time lock up
uint256 constant public WITHDRAW_TIME_GOLD = 90 * 1 days; // variable constant to manage withdraw time lock up
uint256 constant public WITHDRAW_TIME_PLATINUM = 135 * 1 days; // variable constant to manage withdraw time lock up
uint256 public TOKEN_REWARD_PERCENT_SILVER = 21788328; // variable constant to manage token reward percentage for silver
uint256 public TOKEN_REWARD_PERCENT_GOLD = 67332005; // variable constant to manage token reward percentage for gold
uint256 public TOKEN_REWARD_PERCENT_PLATINUM = 178233538; // variable constant to manage token reward percentage for platinum
uint256 public TOKEN_PENALTY_PERCENT_SILVER = 10894164; // variable constant to manage token penalty percentage for silver
uint256 public TOKEN_PENALTY_PERCENT_GOLD = 23566201; // variable constant to manage token penalty percentage for gold
uint256 public TOKEN_PENALTY_PERCENT_PLATINUM = 44558384; // variable constant to manage token penalty percentage for platinum
// events to handle staking pause or unpause for token
event Paused();
event Unpaused();
/*
* ---------------------------------------------------------------------------------------------------------------------------
* Functions for owner.
* ---------------------------------------------------------------------------------------------------------------------------
*/
/**
* @dev get address of smart contract owner
* @return address of owner
*/
function getowner() public view returns (address) {
return _owner;
}
/**
* @dev modifier to check if the message sender is owner
*/
modifier onlyOwner() {
require(isOwner(),"You are not authenticate to make this transfer");
_;
}
/**
* @dev Internal function for modifier
*/
function isOwner() internal view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfer ownership of the smart contract. For owner only
* @return request status
*/
function transferOwnership(address newOwner) public onlyOwner returns (bool){
_owner = newOwner;
return true;
}
/*
* ---------------------------------------------------------------------------------------------------------------------------
* Functionality of Constructor and Interface
* ---------------------------------------------------------------------------------------------------------------------------
*/
// constructor to declare owner of the contract during time of deploy
constructor() public {
_owner = msg.sender;
}
// Interface declaration for contract
IToken itoken;
// function to set Contract Address for Token Transfer Functions
function setContractAddress(address tokenContractAddress) external onlyOwner returns(bool){
itoken = IToken(tokenContractAddress);
return true;
}
/*
* ----------------------------------------------------------------------------------------------------------------------------
* Owner functions of get value, set value and other Functionality
* ----------------------------------------------------------------------------------------------------------------------------
*/
// function to add token reward in contract
function addTokenReward(uint256 token) external onlyOwner returns(bool){
_ownerTokenAllowance = _ownerTokenAllowance.add(token);
itoken.transferFrom(msg.sender, address(this), token);
return true;
}
// function to withdraw added token reward in contract
function withdrawAddedTokenReward(uint256 token) external onlyOwner returns(bool){
require(token < _ownerTokenAllowance,"Value is not feasible, Please Try Again!!!");
_ownerTokenAllowance = _ownerTokenAllowance.sub(token);
itoken.transfer(msg.sender, token);
return true;
}
// function to get token reward in contract
function getTokenReward() public view returns(uint256){
return _ownerTokenAllowance;
}
// function to pause Token Staking
function pauseTokenStaking() public onlyOwner {
tokenPaused = true;
emit Paused();
}
// function to unpause Token Staking
function unpauseTokenStaking() public onlyOwner {
tokenPaused = false;
emit Unpaused();
}
// function to set values
function setManager(uint256 tokenStakingCount, uint256 tokenTotalDays, address tokenStakingAddress, uint256 tokenStakingStartTime,
uint256 tokenStakingEndTime, uint256 usertokens) external onlyOwner returns(bool){
_tokenStakingCount = tokenStakingCount;
_tokenTotalDays[_tokenStakingCount] = tokenTotalDays;
_tokenStakingAddress[_tokenStakingCount] = tokenStakingAddress;
_tokenStakingId[tokenStakingAddress].push(_tokenStakingCount);
_tokenStakingEndTime[_tokenStakingCount] = tokenStakingEndTime;
_tokenStakingStartTime[_tokenStakingCount] = tokenStakingStartTime;
_usersTokens[_tokenStakingCount] = usertokens;
_TokenTransactionstatus[_tokenStakingCount] = false;
totalStakedToken = totalStakedToken.add(usertokens);
totalTokenStakesInContract = totalTokenStakesInContract.add(usertokens);
return true;
}
// function to set reward percent
function setRewardPercent(uint256 silver, uint256 gold, uint256 platinum) external onlyOwner returns(bool){
require(silver != 0 && gold != 0 && platinum !=0,"Invalid Reward Value or Zero value, Please Try Again!!!");
TOKEN_REWARD_PERCENT_SILVER = silver;
TOKEN_REWARD_PERCENT_GOLD = gold;
TOKEN_REWARD_PERCENT_PLATINUM = platinum;
return true;
}
// function to set penalty percent
function setPenaltyPercent(uint256 silver, uint256 gold, uint256 platinum) external onlyOwner returns(bool){
require(silver != 0 && gold != 0 && platinum !=0,"Invalid Penalty Value or Zero value, Please Try Again!!!");
TOKEN_PENALTY_PERCENT_SILVER = silver;
TOKEN_PENALTY_PERCENT_GOLD = gold;
TOKEN_PENALTY_PERCENT_PLATINUM = platinum;
return true;
}
// function to withdraw token from the contract
function withdrawToken(uint256 amount) external onlyOwner returns(bool){
itoken.transfer(msg.sender,amount);
return true;
}
// function to withdraw ETH from the contract
function withdrawETH() external onlyOwner returns(bool){
msg.sender.transfer(address(this).balance);
return true;
}
/*
* ----------------------------------------------------------------------------------------------------------------------------
* Variable, Mapping for Token Staking Functionality
* ----------------------------------------------------------------------------------------------------------------------------
*/
// mapping for users with id => address Staking Address
mapping (uint256 => address) private _tokenStakingAddress;
// mapping for users with address => id staking id
mapping (address => uint256[]) private _tokenStakingId;
// mapping for users with id => Staking Time
mapping (uint256 => uint256) private _tokenStakingStartTime;
// mapping for users with id => End Time
mapping (uint256 => uint256) private _tokenStakingEndTime;
// mapping for users with id => Tokens
mapping (uint256 => uint256) private _usersTokens;
// mapping for users with id => Status
mapping (uint256 => bool) private _TokenTransactionstatus;
// mapping to keep track of final withdraw value of staked token
mapping(uint256=>uint256) private _finalTokenStakeWithdraw;
// mapping to keep track total number of staking days
mapping(uint256=>uint256) private _tokenTotalDays;
// variable to keep count of Token Staking
uint256 private _tokenStakingCount = 0;
// variable to keep track on reward added by owner
uint256 private _ownerTokenAllowance = 0;
// variable for token time management
uint256 private _tokentime;
// variable for token staking pause and unpause mechanism
bool public tokenPaused = false;
// variable for total Token staked by user
uint256 public totalStakedToken = 0;
// variable for total stake token in contract
uint256 public totalTokenStakesInContract = 0;
// modifier to check the user for staking || Re-enterance Guard
modifier tokenStakeCheck(uint256 tokens, uint256 timePeriod){
require(tokens > 0, "Invalid Token Amount, Please Try Again!!! ");
require(timePeriod == PERIOD_SILVER || timePeriod == PERIOD_GOLD || timePeriod == PERIOD_PLATINUM, "Enter the Valid Time Period and Try Again !!!");
_;
}
/*
* ------------------------------------------------------------------------------------------------------------------------------
* Functions for Token Staking Functionality
* ------------------------------------------------------------------------------------------------------------------------------
*/
// function to performs staking for user tokens for a specific period of time
function stakeToken(uint256 tokens, uint256 time) public tokenStakeCheck(tokens, time) returns(bool){
require(tokenPaused == false, "Staking is Paused, Please try after staking get unpaused!!!");
_tokentime = now + (time * 1 days);
_tokenStakingCount = _tokenStakingCount +1;
_tokenTotalDays[_tokenStakingCount] = time;
_tokenStakingAddress[_tokenStakingCount] = msg.sender;
_tokenStakingId[msg.sender].push(_tokenStakingCount);
_tokenStakingEndTime[_tokenStakingCount] = _tokentime;
_tokenStakingStartTime[_tokenStakingCount] = now;
_usersTokens[_tokenStakingCount] = tokens;
_TokenTransactionstatus[_tokenStakingCount] = false;
totalStakedToken = totalStakedToken.add(tokens);
totalTokenStakesInContract = totalTokenStakesInContract.add(tokens);
itoken.transferFrom(msg.sender, address(this), tokens);
return true;
}
// function to get staking count for token
function getTokenStakingCount() public view returns(uint256){
return _tokenStakingCount;
}
// function to get total Staked tokens
function getTotalStakedToken() public view returns(uint256){
return totalStakedToken;
}
// function to calculate reward for the message sender for token
function getTokenRewardDetailsByStakingId(uint256 id) public view returns(uint256){
if(_tokenTotalDays[id] == PERIOD_SILVER) {
return (_usersTokens[id]*TOKEN_REWARD_PERCENT_SILVER/100000000);
} else if(_tokenTotalDays[id] == PERIOD_GOLD) {
return (_usersTokens[id]*TOKEN_REWARD_PERCENT_GOLD/100000000);
} else if(_tokenTotalDays[id] == PERIOD_PLATINUM) {
return (_usersTokens[id]*TOKEN_REWARD_PERCENT_PLATINUM/100000000);
} else{
return 0;
}
}
// function to calculate penalty for the message sender for token
function getTokenPenaltyDetailByStakingId(uint256 id) public view returns(uint256){
if(_tokenStakingEndTime[id] > now){
if(_tokenTotalDays[id]==PERIOD_SILVER){
return (_usersTokens[id]*TOKEN_PENALTY_PERCENT_SILVER/100000000);
} else if(_tokenTotalDays[id] == PERIOD_GOLD) {
return (_usersTokens[id]*TOKEN_PENALTY_PERCENT_GOLD/100000000);
} else if(_tokenTotalDays[id] == PERIOD_PLATINUM) {
return (_usersTokens[id]*TOKEN_PENALTY_PERCENT_PLATINUM/100000000);
} else {
return 0;
}
} else{
return 0;
}
}
// function for withdrawing staked tokens
function withdrawStakedTokens(uint256 stakingId) public returns(bool) {
require(_tokenStakingAddress[stakingId] == msg.sender,"No staked token found on this address and ID");
require(_TokenTransactionstatus[stakingId] != true,"Either tokens are already withdrawn or blocked by admin");
if(_tokenTotalDays[stakingId] == PERIOD_SILVER){
require(now >= _tokenStakingStartTime[stakingId] + WITHDRAW_TIME_SILVER, "Unable to Withdraw Staked token before 45 days of staking start time, Please Try Again Later!!!");
_TokenTransactionstatus[stakingId] = true;
if(now >= _tokenStakingEndTime[stakingId]){
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenRewardDetailsByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
} else {
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenPenaltyDetailByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
}
} else if(_tokenTotalDays[stakingId] == PERIOD_GOLD){
require(now >= _tokenStakingStartTime[stakingId] + WITHDRAW_TIME_GOLD, "Unable to Withdraw Staked token before 90 days of staking start time, Please Try Again Later!!!");
_TokenTransactionstatus[stakingId] = true;
if(now >= _tokenStakingEndTime[stakingId]){
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenRewardDetailsByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
} else {
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenPenaltyDetailByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
}
} else if(_tokenTotalDays[stakingId] == PERIOD_PLATINUM){
require(now >= _tokenStakingStartTime[stakingId] + WITHDRAW_TIME_PLATINUM, "Unable to Withdraw Staked token before 135 days of staking start time, Please Try Again Later!!!");
_TokenTransactionstatus[stakingId] = true;
if(now >= _tokenStakingEndTime[stakingId]){
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenRewardDetailsByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
} else {
_finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId].add(getTokenPenaltyDetailByStakingId(stakingId));
itoken.transfer(msg.sender,_finalTokenStakeWithdraw[stakingId]);
totalTokenStakesInContract = totalTokenStakesInContract.sub(_usersTokens[stakingId]);
}
} else {
return false;
}
return true;
}
// function to get Final Withdraw Staked value for token
function getFinalTokenStakeWithdraw(uint256 id) public view returns(uint256){
return _finalTokenStakeWithdraw[id];
}
// function to get total token stake in contract
function getTotalTokenStakesInContract() public view returns(uint256){
return totalTokenStakesInContract;
}
/*
* -------------------------------------------------------------------------------------------------------------------------------
* Get Functions for Stake Token Functionality
* -------------------------------------------------------------------------------------------------------------------------------
*/
// function to get Token Staking address by id
function getTokenStakingAddressById(uint256 id) external view returns (address){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenStakingAddress[id];
}
// function to get Token staking id by address
function getTokenStakingIdByAddress(address add) external view returns(uint256[] memory){
require(add != address(0),"Invalid Address, Pleae Try Again!!!");
return _tokenStakingId[add];
}
// function to get Token Staking Starting time by id
function getTokenStakingStartTimeById(uint256 id) external view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenStakingStartTime[id];
}
// function to get Token Staking Ending time by id
function getTokenStakingEndTimeById(uint256 id) external view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenStakingEndTime[id];
}
// function to get Token Staking Total Days by Id
function getTokenStakingTotalDaysById(uint256 id) external view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenTotalDays[id];
}
// function to get Staking tokens by id
function getStakingTokenById(uint256 id) external view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _usersTokens[id];
}
// function to get Token lockstatus by id
function getTokenLockStatus(uint256 id) external view returns(bool){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _TokenTransactionstatus[id];
}
} | 0x60806040526004361061020e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663032f3b0981146102135780630a0453c11461023d5780630a57336a14610281578063106c85d5146102995780632458eee9146102b75780632841a143146102cc5780632b74c89d146102e4578063332a35d2146102f95780633e4ffb1614610311578063423eea0714610326578063477bddaa1461033b57806350baa6221461035c57806350ff92a9146103745780635248eede1461038957806354439ad01461039e5780635673017a146103b6578063578b7e4d146103ce57806360c2a348146103e357806368cf8631146103fb5780636f37ac581461041057806370c6bc771461042557806382e19c4b1461043a578063846981901461044f5780638586ca0014610466578063863997b21461047e57806386c75e74146104965780638cc15d4f146104ab5780638e492344146104c057806390645979146104d5578063925672c1146104ea5780639d6c890d146104ff578063b248c81214610533578063b8c1fc331461054b578063b9f7549b14610563578063c26b2a95146105d4578063cb6d8ee6146105f2578063e086e5ec14610607578063e382c2a91461061c578063eff36c1214610631578063f2fde38b14610646578063fa8eb78214610667578063fe0174bd1461067c578063ffab4bd914610691575b600080fd5b34801561021f57600080fd5b5061022b6004356106ac565b60408051918252519081900360200190f35b34801561024957600080fd5b5061026d600435602435600160a060020a036044351660643560843560a435610721565b604080519115158252519081900360200190f35b34801561028d57600080fd5b5061026d60043561085b565b3480156102a557600080fd5b5061026d600435602435604435610dd0565b3480156102c357600080fd5b5061022b610ed9565b3480156102d857600080fd5b5061026d600435610ee0565b3480156102f057600080fd5b5061022b610fff565b34801561030557600080fd5b5061022b600435611005565b34801561031d57600080fd5b5061022b611077565b34801561033257600080fd5b5061022b61107d565b34801561034757600080fd5b5061026d600160a060020a0360043516611083565b34801561036857600080fd5b5061026d600435611117565b34801561038057600080fd5b5061022b6111d0565b34801561039557600080fd5b5061022b6111d6565b3480156103aa57600080fd5b5061022b6004356111db565b3480156103c257600080fd5b5061026d60043561124d565b3480156103da57600080fd5b5061022b6112c2565b3480156103ef57600080fd5b5061022b6004356112c9565b34801561040757600080fd5b5061022b6112db565b34801561041c57600080fd5b5061022b6112e1565b34801561043157600080fd5b5061022b6112e7565b34801561044657600080fd5b5061022b6112ec565b34801561045b57600080fd5b506104646112f2565b005b34801561047257600080fd5b5061022b60043561138a565b34801561048a57600080fd5b5061022b600435611444565b3480156104a257600080fd5b5061026d6114e4565b3480156104b757600080fd5b506104646114ed565b3480156104cc57600080fd5b5061022b611582565b3480156104e157600080fd5b5061022b611588565b3480156104f657600080fd5b5061022b61158e565b34801561050b57600080fd5b50610517600435611595565b60408051600160a060020a039092168252519081900360200190f35b34801561053f57600080fd5b5061022b600435611610565b34801561055757600080fd5b5061026d600435611682565b34801561056f57600080fd5b50610584600160a060020a03600435166117d0565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156105c05781810151838201526020016105a8565b505050509050019250505060405180910390f35b3480156105e057600080fd5b5061026d6004356024356044356118c2565b3480156105fe57600080fd5b5061022b6119cb565b34801561061357600080fd5b5061026d6119d1565b34801561062857600080fd5b5061022b611a68565b34801561063d57600080fd5b5061022b611a6e565b34801561065257600080fd5b5061026d600160a060020a0360043516611a74565b34801561067357600080fd5b5061022b611b08565b34801561068857600080fd5b50610517611b0e565b34801561069d57600080fd5b5061026d600435602435611b1d565b60115460009082111561070b576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b506000818152600b60205260409020545b919050565b600061072b611e42565b1515610783576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b601187815560008881526010602090815260408083208a90558354835260098252808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038b169081179091558352600a8252808320845481546001810183559185528385209091015583548352600c825280832087905583548352600b825280832088905583548352600d825280832086905592548252600e905220805460ff191690556015546108359083611e53565b60155560165461084b908363ffffffff611e5316565b6016555060019695505050505050565b600081815260096020526040812054600160a060020a031633146108ef576040805160e560020a62461bcd02815260206004820152602c60248201527f4e6f207374616b656420746f6b656e20666f756e64206f6e207468697320616460448201527f647265737320616e642049440000000000000000000000000000000000000000606482015290519081900360840190fd5b6000828152600e602052604090205460ff16151560011415610981576040805160e560020a62461bcd02815260206004820152603760248201527f45697468657220746f6b656e732061726520616c72656164792077697468647260448201527f61776e206f7220626c6f636b65642062792061646d696e000000000000000000606482015290519081900360840190fd5b600082815260106020526040902054605a1415610c23576000828152600b6020526040902054623b538001421015610a4f576040805160e560020a62461bcd02815260206004820152605f60248201527f556e61626c6520746f205769746864726177205374616b656420746f6b656e2060448201527f6265666f72652034352064617973206f66207374616b696e672073746172742060648201527f74696d652c20506c656173652054727920416761696e204c6174657221212100608482015290519081900360a40190fd5b6000828152600e60209081526040808320805460ff19166001179055600c9091529020544210610b5b57610aa0610a8583611444565b6000848152600d60205260409020549063ffffffff611e5316565b6000838152600f60209081526040808320849055600854815160e060020a63a9059cbb02815233600482015260248101959095529051600160a060020a039091169363a9059cbb9360448083019493928390030190829087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b505050506040513d6020811015610b3057600080fd5b50506000828152600d6020526040902054601654610b539163ffffffff611eb716565b601655610c1e565b610b67610a858361138a565b6000838152600f60209081526040808320849055600854815160e060020a63a9059cbb02815233600482015260248101959095529051600160a060020a039091169363a9059cbb9360448083019493928390030190829087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d6020811015610bf757600080fd5b50506000828152600d6020526040902054601654610c1a9163ffffffff611eb716565b6016555b610dc8565b60008281526010602052604090205460b41415610cf1576000828152600b60205260409020546276a70001421015610a4f576040805160e560020a62461bcd02815260206004820152605f60248201527f556e61626c6520746f205769746864726177205374616b656420746f6b656e2060448201527f6265666f72652039302064617973206f66207374616b696e672073746172742060648201527f74696d652c20506c656173652054727920416761696e204c6174657221212100608482015290519081900360a40190fd5b60008281526010602052604090205461010e1415610dc0576000828152600b602052604090205462b1fa8001421015610a4f576040805160e560020a62461bcd02815260206004820152606060248201527f556e61626c6520746f205769746864726177205374616b656420746f6b656e2060448201527f6265666f7265203133352064617973206f66207374616b696e6720737461727460648201527f2074696d652c20506c656173652054727920416761696e204c61746572212121608482015290519081900360a40190fd5b50600061071c565b506001919050565b6000610dda611e42565b1515610e32576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b8315801590610e4057508215155b8015610e4b57508115155b1515610ec7576040805160e560020a62461bcd02815260206004820152603760248201527f496e76616c6964205265776172642056616c7565206f72205a65726f2076616c60448201527f75652c20506c656173652054727920416761696e212121000000000000000000606482015290519081900360840190fd5b50600292909255600355600455600190565b62b1fa8081565b6000610eea611e42565b1515610f42576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b601254610f55908363ffffffff611e5316565b601255600854604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018590529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b158015610fcb57600080fd5b505af1158015610fdf573d6000803e3d6000fd5b505050506040513d6020811015610ff557600080fd5b5060019392505050565b61010e81565b601154600090821115611064576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b506000908152600d602052604090205490565b60115490565b60155490565b600061108d611e42565b15156110e5576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b5060088054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b6000611121611e42565b1515611179576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b6008546040805160e060020a63a9059cbb028152336004820152602481018590529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015610fcb57600080fd5b60165490565b605a81565b60115460009082111561123a576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b506000908152600c602052604090205490565b6011546000908211156112ac576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b506000908152600e602052604090205460ff1690565b623b538081565b6000908152600f602052604090205490565b60065481565b60025481565b60b481565b60055481565b6112fa611e42565b1515611352576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b6014805460ff191660011790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6000818152600c6020526040812054421015610dc057600082815260106020526040902054605a14156113d9576005546000838152600d60205260409020546305f5e10091025b04905061071c565b60008281526010602052604090205460b4141561140e576006546000838152600d60205260409020546305f5e10091026113d1565b60008281526010602052604090205461010e1415610dc0576007546000838152600d60205260409020546305f5e10091026113d1565b600081815260106020526040812054605a1415611479576002546000838152600d60205260409020546305f5e10091026113d1565b60008281526010602052604090205460b414156114ae576003546000838152600d60205260409020546305f5e10091026113d1565b60008281526010602052604090205461010e1415610dc0576004546000838152600d60205260409020546305f5e10091026113d1565b60145460ff1681565b6114f5611e42565b151561154d576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b6014805460ff191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b60045481565b60165481565b6276a70081565b6011546000908211156115f4576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b50600090815260096020526040902054600160a060020a031690565b60115460009082111561166f576040805160e560020a62461bcd02815260206004820152603b6024820152600080516020611f1a8339815191526044820152600080516020611f3a833981519152606482015290519081900360840190fd5b5060009081526010602052604090205490565b600061168c611e42565b15156116e4576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b6012548210611763576040805160e560020a62461bcd02815260206004820152602a60248201527f56616c7565206973206e6f74206665617369626c652c20506c6561736520547260448201527f7920416761696e21212100000000000000000000000000000000000000000000606482015290519081900360840190fd5b601254611776908363ffffffff611eb716565b6012556008546040805160e060020a63a9059cbb028152336004820152602481018590529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015610fcb57600080fd5b6060600160a060020a0382161515611858576040805160e560020a62461bcd02815260206004820152602360248201527f496e76616c696420416464726573732c20506c6561652054727920416761696e60448201527f2121210000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0382166000908152600a6020908152604091829020805483518184028101840190945280845290918301828280156118b657602002820191906000526020600020905b8154815260200190600101908083116118a2575b50505050509050919050565b60006118cc611e42565b1515611924576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b831580159061193257508215155b801561193d57508115155b15156119b9576040805160e560020a62461bcd02815260206004820152603860248201527f496e76616c69642050656e616c74792056616c7565206f72205a65726f20766160448201527f6c75652c20506c656173652054727920416761696e2121210000000000000000606482015290519081900360840190fd5b50600592909255600655600755600190565b60155481565b60006119db611e42565b1515611a33576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b6040513390303180156108fc02916000818181858888f19350505050158015611a60573d6000803e3d6000fd5b506001905090565b60075481565b60035481565b6000611a7e611e42565b1515611ad6576040805160e560020a62461bcd02815260206004820152602e6024820152600080516020611f5a8339815191526044820152600080516020611f7a833981519152606482015290519081900360840190fd5b5060008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60125490565b600054600160a060020a031690565b60008282828211611b9e576040805160e560020a62461bcd02815260206004820152602a60248201527f496e76616c696420546f6b656e20416d6f756e742c20506c656173652054727960448201527f20416761696e2121212000000000000000000000000000000000000000000000606482015290519081900360840190fd5b605a811480611bad575060b481145b80611bb9575061010e81145b1515611c35576040805160e560020a62461bcd02815260206004820152602d60248201527f456e746572207468652056616c69642054696d6520506572696f6420616e642060448201527f54727920416761696e2021212100000000000000000000000000000000000000606482015290519081900360840190fd5b60145460ff1615611cb6576040805160e560020a62461bcd02815260206004820152603b60248201527f5374616b696e67206973205061757365642c20506c656173652074727920616660448201527f746572207374616b696e672067657420756e7061757365642121210000000000606482015290519081900360840190fd5b426201518085028101601390815560118054600190810180835560009081526010602090815260408083208b90558454835260098252808320805473ffffffffffffffffffffffffffffffffffffffff1916339081179091558352600a825280832085548154958601825590845282842090940193909355935483548252600c85528282205582548152600b84528181209490945581548452600d835280842089905590548352600e9091529020805460ff19169055601554611d7f908663ffffffff611e5316565b601555601654611d95908663ffffffff611e5316565b601655600854604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018890529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b505050506040513d6020811015611e3557600080fd5b5060019695505050505050565b600054600160a060020a0316331490565b600082820183811015611eb0576040805160e560020a62461bcd02815260206004820152601160248201527f43616c63756c6174696f6e206572726f72000000000000000000000000000000604482015290519081900360640190fd5b9392505050565b60008083831115611f12576040805160e560020a62461bcd02815260206004820152601160248201527f43616c63756c6174696f6e206572726f72000000000000000000000000000000604482015290519081900360640190fd5b50509003905600556e61626c6520746f2072657465726976652064617461206f6e207370656369666965642069642c20506c656173652074727920616761696e21210000000000596f7520617265206e6f742061757468656e74696361746520746f206d616b652074686973207472616e73666572000000000000000000000000000000000000a165627a7a723058202dfae46420df0bfdad465902835f569bdb585dd93d58fc33815e2cd0cb1fd89d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,503 |
0x77c9acc811e4cf4b51dc3a3e05dc5d62fa887767 | pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
interface CryptoMiningWarInterface {
function subCrystal( address /*_addr*/, uint256 /*_value*/ ) external pure;
function addCrystal( address /*_addr*/, uint256 /*_value*/ ) external pure;
function isMiningWarContract() external pure returns(bool);
}
interface CryptoEngineerInterface {
function addVirus(address /*_addr*/, uint256 /*_value*/) external pure;
function subVirus(address /*_addr*/, uint256 /*_value*/) external pure;
function isContractMiniGame() external pure returns( bool /*_isContractMiniGame*/);
function isEngineerContract() external pure returns(bool);
function calCurrentVirus(address /*_addr*/) external view returns(uint256 /*_currentVirus*/);
function calCurrentCrystals(address /*_addr*/) external pure returns(uint256 /*_currentCrystals*/);
}
interface CryptoProgramFactoryInterface {
function isContractMiniGame() external pure returns( bool /*_isContractMiniGame*/ );
function isProgramFactoryContract() external pure returns(bool);
function subPrograms(address /*_addr*/, uint256[] /*_programs*/) external;
function getData(address _addr) external pure returns(uint256 /*_factoryLevel*/, uint256 /*_factoryTime*/, uint256[] /*memory _programs*/);
function getProgramsValue() external pure returns(uint256[]);
}
interface MiniGameInterface {
function isContractMiniGame() external pure returns( bool /*_isContractMiniGame*/ );
function fallback() external payable;
}
contract CrryptoArena {
using SafeMath for uint256;
address public administrator;
uint256 public VIRUS_NORMAL = 0;
uint256 public HALF_TIME_ATK= 60 * 15;
uint256 public CRTSTAL_MINING_PERIOD = 86400;
uint256 public VIRUS_MINING_PERIOD = 86400;
address public engineerAddress;
CryptoMiningWarInterface public MiningWar;
CryptoEngineerInterface public Engineer;
CryptoProgramFactoryInterface public Factory;
// factory info
// player info
mapping(address => Player) public players;
mapping(uint256 => Virus) public viruses;
// minigame info
mapping(address => bool) public miniGames;
struct Player {
uint256 virusDef;
uint256 nextTimeAtk;
uint256 endTimeUnequalledDef;
}
struct Virus {
uint256 atk;
uint256 def;
}
modifier isAdministrator()
{
require(msg.sender == administrator);
_;
}
modifier onlyContractsMiniGame()
{
require(miniGames[msg.sender] == true);
_;
}
event Attack(address atkAddress, address defAddress, bool victory, uint256 reward, uint256 virusAtkDead, uint256 virusDefDead, uint256 atk, uint256 def, uint256 round); // 1 : crystals, 2: hashrate, 3: virus
event Programs(uint256 programLv1, uint256 programLv2, uint256 programLv3, uint256 programLv4);
constructor() public {
administrator = msg.sender;
// set interface contract
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
setFactoryInterface(0x0498e54b6598e96b7a42ade3d238378dc57b5bb2);
// setting virusupd
viruses[VIRUS_NORMAL] = Virus(1,1);
}
function () public payable
{
}
/**
* @dev MainContract used this function to verify game's contract
*/
function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
function isArenaContract() public pure returns(bool)
{
return true;
}
function upgrade(address addr) public isAdministrator
{
selfdestruct(addr);
}
/**
* @dev Main Contract call this function to setup mini game.
*/
function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
{
}
//--------------------------------------------------------------------------
// SETTING CONTRACT MINI GAME
//--------------------------------------------------------------------------
function setContractsMiniGame( address _addr ) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) revert();
miniGames[_addr] = true;
}
/**
* @dev remove mini game contract from main contract
* @param _addr mini game contract address
*/
function removeContractMiniGame(address _addr) public isAdministrator
{
miniGames[_addr] = false;
}
// ---------------------------------------------------------------------------------------
// SET INTERFACE CONTRACT
// ---------------------------------------------------------------------------------------
function setMiningWarInterface(address _addr) public isAdministrator
{
CryptoMiningWarInterface miningWarInterface = CryptoMiningWarInterface(_addr);
require(miningWarInterface.isMiningWarContract() == true);
MiningWar = miningWarInterface;
}
function setEngineerInterface(address _addr) public isAdministrator
{
CryptoEngineerInterface engineerInterface = CryptoEngineerInterface(_addr);
require(engineerInterface.isEngineerContract() == true);
engineerAddress = _addr;
Engineer = engineerInterface;
}
function setFactoryInterface(address _addr) public isAdministrator
{
CryptoProgramFactoryInterface factoryInterface = CryptoProgramFactoryInterface(_addr);
Factory = factoryInterface;
}
// --------------------------------------------------------------------------------------------------------------
// FUCTION FOR NEXT VERSION
// --------------------------------------------------------------------------------------------------------------
/**
* @dev additional time unequalled defence
* @param _addr player address
*/
function setAtkNowForPlayer(address _addr) public onlyContractsMiniGame
{
Player storage p = players[_addr];
p.nextTimeAtk = now;
}
function setPlayerVirusDef(address _addr, uint256 _value) public onlyContractsMiniGame
{
players[_addr].virusDef = SafeMath.mul(_value, VIRUS_MINING_PERIOD);
}
function addVirusDef(address _addr, uint256 _virus) public
{
require(miniGames[msg.sender] == true || msg.sender == _addr);
Engineer.subVirus(_addr, _virus);
Player storage p = players[_addr];
p.virusDef += SafeMath.mul(_virus, VIRUS_MINING_PERIOD);
}
function subVirusDef(address _addr, uint256 _virus) public onlyContractsMiniGame
{
_virus = SafeMath.mul(_virus, VIRUS_MINING_PERIOD);
require(players[_addr].virusDef >= _virus);
Player storage p = players[_addr];
p.virusDef -= _virus;
}
function addTimeUnequalledDefence(address _addr, uint256 _value) public onlyContractsMiniGame
{
Player storage p = players[_addr];
uint256 currentTimeUnequalled = p.endTimeUnequalledDef;
if (currentTimeUnequalled < now) currentTimeUnequalled = now;
p.endTimeUnequalledDef = SafeMath.add(currentTimeUnequalled, _value);
}
// --------------------------------------------------------------------------------------------------------------
// MAIN CONTENT
// --------------------------------------------------------------------------------------------------------------
function setVirusInfo(uint256 _atk, uint256 _def) public isAdministrator
{
Virus storage v = viruses[VIRUS_NORMAL];
v.atk = _atk;
v.def = _def;
}
/**
* @dev ATTACK
* _programs[0]: + 10% _virus;
* _programs[1]: revival 15 % _virus if this atk lose(not use item before)
* _programs[2]: + 20% dame
* _programs[3]: -5% virus defence of player you want attack
*/
function attack(address _defAddress, uint256 _virus, uint256[] _programs) public
{
require(validateAttack(msg.sender, _defAddress) == true);
require(_programs.length == 4);
require(validatePrograms(_programs) == true);
Factory.subPrograms(msg.sender, _programs);
players[msg.sender].nextTimeAtk = now + HALF_TIME_ATK;
if (players[_defAddress].virusDef == 0) return endAttack(_defAddress, true, 0, 0, SafeMath.mul(_virus, VIRUS_MINING_PERIOD), 0, 1, _programs);
Engineer.subVirus(msg.sender, _virus);
uint256[] memory programsValue = Factory.getProgramsValue();
bool victory;
uint256 atk;
uint256 def;
uint256 virusAtkDead;
uint256 virusDefDead;
(victory, atk, def, virusAtkDead, virusDefDead) = firstAttack(_defAddress, SafeMath.mul(_virus, VIRUS_MINING_PERIOD), _programs, programsValue);
endAttack(_defAddress, victory, SafeMath.div(virusAtkDead, VIRUS_MINING_PERIOD), SafeMath.div(virusDefDead, VIRUS_MINING_PERIOD), atk, def, 1, _programs);
if (_programs[1] == 1 && victory == false)
againAttack(_defAddress, SafeMath.div(SafeMath.mul(SafeMath.mul(_virus, VIRUS_MINING_PERIOD), programsValue[1]), 100)); // revival 15 % _virus if this atk lose(not use item before)
}
function firstAttack(address _defAddress, uint256 _virus, uint256[] _programs, uint256[] programsValue)
private
returns(
bool victory,
uint256 atk,
uint256 def,
uint256 virusAtkDead,
uint256 virusDefDead
)
{
Player storage pDef = players[_defAddress];
atk = _virus;
uint256 rateAtk = 50 + randomNumber(msg.sender, 1, 101);
uint256 rateDef = 50 + randomNumber(_defAddress, rateAtk, 101);
if (_programs[0] == 1) // + 10% _virus;
atk += SafeMath.div(SafeMath.mul(atk, programsValue[0]), 100);
if (_programs[3] == 1) // -5% virus defence of player you want attack
pDef.virusDef = SafeMath.sub(pDef.virusDef, SafeMath.div(SafeMath.mul(pDef.virusDef, programsValue[3]), 100));
atk = SafeMath.div(SafeMath.mul(SafeMath.mul(atk, viruses[VIRUS_NORMAL].atk), rateAtk), 100);
def = SafeMath.div(SafeMath.mul(SafeMath.mul(pDef.virusDef, viruses[VIRUS_NORMAL].def), rateDef), 100);
if (_programs[2] == 1) //+ 20% dame
atk += SafeMath.div(SafeMath.mul(atk, programsValue[2]), 100);
if (atk >= def) {
virusAtkDead = SafeMath.min(_virus, SafeMath.div(SafeMath.mul(def, 100), SafeMath.mul(viruses[VIRUS_NORMAL].atk, rateAtk)));
virusDefDead = pDef.virusDef;
victory = true;
} else {
virusAtkDead = _virus;
virusDefDead = SafeMath.min(pDef.virusDef, SafeMath.div(SafeMath.mul(atk, 100), SafeMath.mul(viruses[VIRUS_NORMAL].def, rateDef)));
}
pDef.virusDef = SafeMath.sub(pDef.virusDef, virusDefDead);
if (_virus > virusAtkDead)
Engineer.addVirus(msg.sender, SafeMath.div(SafeMath.sub(_virus, virusAtkDead), VIRUS_MINING_PERIOD));
}
function againAttack(address _defAddress, uint256 _virus) private returns(bool victory)
{
Player storage pDef = players[_defAddress];
// virus normal info
Virus memory v = viruses[VIRUS_NORMAL];
uint256 rateAtk = 50 + randomNumber(msg.sender, 1, 101);
uint256 rateDef = 50 + randomNumber(_defAddress, rateAtk, 101);
uint256 atk = SafeMath.div(SafeMath.mul(SafeMath.mul(_virus, v.atk), rateAtk), 100);
uint256 def = SafeMath.div(SafeMath.mul(SafeMath.mul(pDef.virusDef, v.def), rateDef), 100);
uint256 virusDefDead = 0;
uint256[] memory programs;
if (atk >= def) {
virusDefDead = pDef.virusDef;
victory = true;
} else {
virusDefDead = SafeMath.min(pDef.virusDef, SafeMath.div(SafeMath.mul(atk, 100), SafeMath.mul(v.def, rateDef)));
}
pDef.virusDef = SafeMath.sub(pDef.virusDef, virusDefDead);
endAttack(_defAddress, victory, 0, SafeMath.div(virusDefDead, VIRUS_MINING_PERIOD), atk, def, 2, programs);
}
function endAttack(address _defAddress, bool victory, uint256 virusAtkDead, uint256 virusDefDead, uint256 atk, uint256 def, uint256 round, uint256[] programs) private
{
uint256 reward = 0;
if (victory == true) {
uint256 pDefCrystals = Engineer.calCurrentCrystals(_defAddress);
// subtract random 10% to 50% current crystals of player defence
uint256 rate = 10 + randomNumber(_defAddress, pDefCrystals, 41);
reward = SafeMath.div(SafeMath.mul(pDefCrystals, rate),100);
if (reward > 0) {
MiningWar.subCrystal(_defAddress, reward);
MiningWar.addCrystal(msg.sender, reward);
}
}
emit Attack(msg.sender, _defAddress, victory, reward, virusAtkDead, virusDefDead, atk, def, round);
if (round == 1) emit Programs( programs[0], programs[1], programs[2], programs[3]);
}
function validateAttack(address _atkAddress, address _defAddress) private view returns(bool _status)
{
if (
_atkAddress != _defAddress &&
players[_atkAddress].nextTimeAtk <= now &&
canAttack(_defAddress) == true
) {
_status = true;
}
}
function validatePrograms(uint256[] _programs) private view returns(bool _status)
{
_status = true;
for(uint256 idx = 0; idx < _programs.length; idx++) {
if (_programs[idx] != 0 && _programs[idx] != 1) _status = false;
}
}
function canAttack(address _addr) private view returns(bool _canAtk)
{
if (
players[_addr].endTimeUnequalledDef < now &&
Engineer.calCurrentCrystals(_addr) >= 5000
) {
_canAtk = true;
}
}
// --------------------------------------------------------------------------------------------------------------
// CALL FUNCTION
// --------------------------------------------------------------------------------------------------------------
function getData(address _addr)
public
view
returns(
uint256 _virusDef,
uint256 _nextTimeAtk,
uint256 _endTimeUnequalledDef,
bool _canAtk,
// engineer
uint256 _currentVirus,
// mingin war
uint256 _currentCrystals
) {
Player memory p = players[_addr];
_virusDef = SafeMath.div(p.virusDef, VIRUS_MINING_PERIOD);
_nextTimeAtk = p.nextTimeAtk;
_endTimeUnequalledDef= p.endTimeUnequalledDef;
_currentVirus = SafeMath.div(Engineer.calCurrentVirus(_addr), VIRUS_MINING_PERIOD);
_currentCrystals = Engineer.calCurrentCrystals(_addr);
_canAtk = canAttack(_addr);
}
// --------------------------------------------------------------------------------------------------------------
// INTERNAL FUNCTION
// --------------------------------------------------------------------------------------------------------------
function randomNumber(address _addr, uint256 randNonce, uint256 _maxNumber) private view returns(uint256)
{
return uint256(keccak256(abi.encodePacked(now, _addr, randNonce))) % _maxNumber;
}
} | 0x608060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f0101461017757806319afa824146101ba5780631bb57b96146101fd57806330061596146102455780633281d5761461029c578063374e164c146102cb57806338266b22146103185780634bbb58b2146103965780637df841cd146103cd5780637f3e4d1b1461041a57806384ffcb5d1461045d5780638890e13d146104a05780638a56b230146104cf57806398598905146105125780639ff12bba1461055f578063b239dac6146105a2578063b4bd7d41146105fd578063be7ccd7e14610654578063c3f656f11461068b578063c83dd231146106e2578063cee0b4fe14610739578063e12936d014610764578063e2eb41ff1461078f578063f0af0844146107f4578063f53d0a8e14610841578063f85033ac14610898578063f94b965f146108c3578063feb31939146108ee578063ffa651b61461097e575b005b34801561018357600080fd5b506101b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c1565b005b3480156101c657600080fd5b506101fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a35565b005b34801561020957600080fd5b5061022860048036038101908080359060200190929190505050610ada565b604051808381526020018281526020019250505060405180910390f35b34801561025157600080fd5b5061025a610afe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102a857600080fd5b506102b1610b24565b604051808215151515815260200191505060405180910390f35b3480156102d757600080fd5b50610316600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2d565b005b34801561032457600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d04565b6040518087815260200186815260200185815260200184151515158152602001838152602001828152602001965050505050505060405180910390f35b3480156103a257600080fd5b506103cb6004803603810190808035906020019092919080359060200190929190505050610fb4565b005b3480156103d957600080fd5b50610418600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061103f565b005b34801561042657600080fd5b5061045b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110f4565b005b34801561046957600080fd5b5061049e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a3565b005b3480156104ac57600080fd5b506104b561130f565b604051808215151515815260200191505060405180910390f35b3480156104db57600080fd5b50610510600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611318565b005b34801561051e57600080fd5b5061055d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061146e565b005b34801561056b57600080fd5b506105a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611586565b005b3480156105ae57600080fd5b506105e3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061163c565b604051808215151515815260200191505060405180910390f35b34801561060957600080fd5b5061061261165c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066057600080fd5b506106896004803603810190808035906020019092919080359060200190929190505050611682565b005b34801561069757600080fd5b506106a0611686565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106ee57600080fd5b506106f76116ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074557600080fd5b5061074e6116d2565b6040518082815260200191505060405180910390f35b34801561077057600080fd5b506107796116d8565b6040518082815260200191505060405180910390f35b34801561079b57600080fd5b506107d0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116de565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561080057600080fd5b5061083f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611708565b005b34801561084d57600080fd5b506108566117d6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108a457600080fd5b506108ad6117fb565b6040518082815260200191505060405180910390f35b3480156108cf57600080fd5b506108d8611801565b6040518082815260200191505060405180910390f35b3480156108fa57600080fd5b5061097c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611807565b005b34801561098a57600080fd5b506109bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cf7565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a9257600080fd5b81905080600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600a6020528060005260406000206000915090508060000154908060010154905082565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006001905090565b600060011515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151480610bb957508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610bc457600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663920775d484846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610c8957600080fd5b505af1158015610c9d573d6000803e3d6000fd5b50505050600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050610cee82600454611e8e565b8160000160008282540192505081905550505050565b600080600080600080610d15612c5b565b600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206060604051908101604052908160008201548152602001600182015481526020016002820154815250509050610d908160000151600454611ec9565b96508060200151955080604001519450610ea3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166378f556228a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e6057600080fd5b505af1158015610e74573d6000803e3d6000fd5b505050506040513d6020811015610e8a57600080fd5b8101908080519060200190929190505050600454611ec9565b9250600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395360a02896040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f6257600080fd5b505af1158015610f76573d6000803e3d6000fd5b505050506040513d6020811015610f8c57600080fd5b81019080805190602001909291905050509150610fa888611ee4565b93505091939550919395565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101157600080fd5b600a600060015481526020019081526020016000209050828160000181905550818160010181905550505050565b60011515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561109e57600080fd5b6110aa81600454611e8e565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505050565b600060011515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561115557600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090504281600101819055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120057600080fd5b819050600015158173ffffffffffffffffffffffffffffffffffffffff16633281d5766040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561126b57600080fd5b505af115801561127f573d6000803e3d6000fd5b505050506040513d602081101561129557600080fd5b8101908080519060200190929190505050151514156112b357600080fd5b6001600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60006001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137557600080fd5b819050600115158173ffffffffffffffffffffffffffffffffffffffff1663688b5c2b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156113e057600080fd5b505af11580156113f4573d6000803e3d6000fd5b505050506040513d602081101561140a57600080fd5b8101908080519060200190929190505050151514151561142957600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600060011515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156114cf57600080fd5b6114db82600454611e8e565b915081600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015151561152e57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160000160008282540392505081905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115e157600080fd5b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600b6020528060005260406000206000915054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60045481565b60096020528060005260406000206000915090508060000154908060010154908060020154905083565b60008060011515600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561176a57600080fd5b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915081600201549050428110156117be574290505b6117c8818461203f565b826002018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b60015481565b606060008060008060006001151561181f338b61205d565b151514151561182d57600080fd5b6004875114151561183d57600080fd5b6001151561184a88612105565b151514151561185857600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632222e43a33896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561193857808201518184015260208101905061191d565b505050509050019350505050600060405180830381600087803b15801561195e57600080fd5b505af1158015611972573d6000803e3d6000fd5b505050506002544201600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506000600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415611a3057611a2b896001600080611a218d600454611e8e565b600060018e612177565b611cec565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663920775d4338a6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015611af557600080fd5b505af1158015611b09573d6000803e3d6000fd5b50505050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663669a828b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b158015611b9357600080fd5b505af1158015611ba7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015611bd157600080fd5b810190808051640100000000811115611be957600080fd5b82810190506020810184811115611bff57600080fd5b8151856020820283011164010000000082111715611c1c57600080fd5b50509291905050509550611c3d89611c368a600454611e8e565b898961260b565b8095508196508297508398508499505050505050611c788986611c6285600454611ec9565b611c6e85600454611ec9565b888860018e612177565b6001876001815181101515611c8957fe5b90602001906020020151148015611ca4575060001515851515145b15611ceb57611ce989611ce4611cdd611cbf8c600454611e8e565b8a6001815181101515611cce57fe5b90602001906020020151611e8e565b6064611ec9565b6129ba565b505b5b505050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d5457600080fd5b819050600115158173ffffffffffffffffffffffffffffffffffffffff1663b9a59b836040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611dbf57600080fd5b505af1158015611dd3573d6000803e3d6000fd5b505050506040513d6020811015611de957600080fd5b81019080805190602001909291905050501515141515611e0857600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000806000841415611ea35760009150611ec2565b8284029050828482811515611eb457fe5b04141515611ebe57fe5b8091505b5092915050565b6000808284811515611ed757fe5b0490508091505092915050565b600042600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541080156120305750611388600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395360a02846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611ff257600080fd5b505af1158015612006573d6000803e3d6000fd5b505050506040513d602081101561201c57600080fd5b810190808051906020019092919050505010155b1561203a57600190505b919050565b600080828401905083811015151561205357fe5b8091505092915050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156120dd575042600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411155b80156120f55750600115156120f183611ee4565b1515145b156120ff57600190505b92915050565b60008060019150600090505b8251811015612171576000838281518110151561212a57fe5b906020019060200201511415801561215a57506001838281518110151561214d57fe5b9060200190602002015114155b1561216457600091505b8080600101915050612111565b50919050565b6000806000809250600115158a1515141561247257600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395360a028c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561224957600080fd5b505af115801561225d573d6000803e3d6000fd5b505050506040513d602081101561227357600080fd5b810190808051906020019092919050505091506122928b836029612b42565b600a0190506122ab6122a48383611e8e565b6064611ec9565b9250600083111561247157600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b04eb6398c856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561237b57600080fd5b505af115801561238f573d6000803e3d6000fd5b50505050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6e212ea33856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561245857600080fd5b505af115801561246c573d6000803e3d6000fd5b505050505b5b7fb521f84624afe810424a8cbb85a0740a5999831e697a75fa208455349473e7c7338c8c868d8d8d8d8d604051808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188151515158152602001878152602001868152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390a160018514156125fe577fe71af83b34f734e9b87bbcb0fba4bf4e7c28c768c814fe98932dc7ce791d0fb684600081518110151561257e57fe5b9060200190602002015185600181518110151561259757fe5b906020019060200201518660028151811015156125b057fe5b906020019060200201518760038151811015156125c957fe5b906020019060200201516040518085815260200184815260200183815260200182815260200194505050505060405180910390a15b5050505050505050505050565b600080600080600080600080600960008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092508a96506126683360016065612b42565b60320191506126798c836065612b42565b603201905060018a600081518110151561268f57fe5b9060200190602002015114156126d0576126cb6126c4888b60008151811015156126b557fe5b90602001906020020151611e8e565b6064611ec9565b870196505b60018a60038151811015156126e157fe5b9060200190602002015114156127375761272e836000015461272961272286600001548d600381518110151561271357fe5b90602001906020020151611e8e565b6064611ec9565b612c29565b83600001819055505b61276c61276561275f89600a6000600154815260200190815260200160002060000154611e8e565b84611e8e565b6064611ec9565b96506127a76127a061279a8560000154600a6000600154815260200190815260200160002060010154611e8e565b83611e8e565b6064611ec9565b955060018a60028151811015156127ba57fe5b9060200190602002015114156127fb576127f66127ef888b60028151811015156127e057fe5b90602001906020020151611e8e565b6064611ec9565b870196505b8587101515612854576128428b61283d612816896064611e8e565b612838600a600060015481526020019081526020016000206000015487611e8e565b611ec9565b612c42565b9450826000015493506001975061289c565b8a9450612899836000015461289461286d8a6064611e8e565b61288f600a600060015481526020019081526020016000206001015486611e8e565b611ec9565b612c42565b93505b6128aa836000015485612c29565b8360000181905550848b11156129ac57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ec6f772d3361290e6129068f8a612c29565b600454611ec9565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561299357600080fd5b505af11580156129a7573d6000803e3d6000fd5b505050505b505050945094509450945094565b6000806129c5612c7d565b60008060008060006060600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209750600a60006001548152602001908152602001600020604080519081016040529081600082015481526020016001820154815250509650612a533360016065612b42565b6032019550612a648b876065612b42565b6032019450612a8a612a83612a7d8c8a60000151611e8e565b88611e8e565b6064611ec9565b9350612ab1612aaa612aa48a600001548a60200151611e8e565b87611e8e565b6064611ec9565b9250600091508284101515612ad0578760000154915060019850612b01565b612afe8860000154612af9612ae6876064611e8e565b612af48b602001518a611e8e565b611ec9565b612c42565b91505b612b0f886000015483612c29565b8860000181905550612b348b8a6000612b2a86600454611ec9565b8888600288612177565b505050505050505092915050565b600081428585604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140182815260200193505050506040516020818303038152906040526040518082805190602001908083835b602083101515612be55780518252602082019150602081019050602083039250612bc0565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060019004811515612c1f57fe5b0690509392505050565b6000828211151515612c3757fe5b818303905092915050565b6000818310612c515781612c53565b825b905092915050565b6060604051908101604052806000815260200160008152602001600081525090565b6040805190810160405280600081526020016000815250905600a165627a7a72305820d56f6939b81bf504ae8e3de19653455e8a5d593decf74d518678259528e7f6090029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}} | 1,504 |
0x8aa77aa79e49ffb89ea6c1a0e7b64b342a98b7ba | // SPDX-License-Identifier: MIT
// File: contracts/3_VMSCOIN.sol
pragma solidity ^0.6.2;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping (bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
bytes32 lastvalue = set._values[lastIndex];
set._values[toDeleteIndex] = lastvalue;
set._indexes[lastvalue] = toDeleteIndex + 1;
set._values.pop();
delete set._indexes[value];
return true;
} else {
return false;
}
}
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.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];
}
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _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");
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
abstract contract ERC20Burnable is Context, ERC20 {
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount*(10**uint256(decimals())));
}
}
contract Lockable is Context {
event Locked(address account);
event Unlocked(address account);
mapping(address => bool) private _locked;
function locked(address _to) internal view returns (bool) {
return _locked[_to];
}
function _lock(address to) internal virtual {
require(to != address(0), "ERC20: lock to the zero address");
_locked[to] = true;
emit Locked(to);
}
function _unlock(address to) internal virtual {
require(to != address(0), "ERC20: lock to the zero address");
_locked[to] = false;
emit Unlocked(to);
}
}
contract ERC20PresetMinterPauser is Context, ERC20Burnable, Lockable {
constructor(string memory name, string memory symbol) internal ERC20(name, symbol) {
}
function mint(address to, uint256 amount) internal virtual {
_mint(to, amount);
}
function lock(address to) public virtual {
_lock(to);
}
function unlock(address to) public virtual {
_unlock(to);
}
}
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() internal view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() internal virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) internal virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract CreateToken is Ownable, ERC20PresetMinterPauser {
constructor ()
ERC20PresetMinterPauser("Vehicle Mining System", "VMS")
public
{
mint(msg.sender, 40*(10**8)*(10**uint256(decimals())));
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063313ce56711610071578063313ce5671461027f57806342966c68146102a357806370a08231146102d157806395d89b4114610329578063a9059cbb146103ac578063f435f5a714610412576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b55780632f6c493c1461023b575b600080fd5b6100b6610456565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104f8565b604051808215151515815260200191505060405180910390f35b61019f610516565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610520565b604051808215151515815260200191505060405180910390f35b61027d6004803603602081101561025157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610538565b005b610287610544565b604051808260ff1660ff16815260200191505060405180910390f35b6102cf600480360360208110156102b957600080fd5b810190808035906020019092919050505061055b565b005b610313600480360360208110156102e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061057e565b6040518082815260200191505060405180910390f35b6103316105c7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610371578082015181840152602081019050610356565b50505050905090810190601f16801561039e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f8600480360360408110156103c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610669565b604051808215151515815260200191505060405180910390f35b6104546004803603602081101561042857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610687565b005b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ee5780601f106104c3576101008083540402835291602001916104ee565b820191906000526020600020905b8154815290600101906020018083116104d157829003601f168201915b5050505050905090565b600061050c610505610693565b848461069b565b6001905092915050565b6000600254905090565b600061052d848484610811565b600190509392505050565b61054181610ad6565b50565b6000600560009054906101000a900460ff16905090565b61057b610566610693565b61056e610544565b60ff16600a0a8302610c37565b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561065f5780601f106106345761010080835404028352916020019161065f565b820191906000526020600020905b81548152906001019060200180831161064257829003601f168201915b5050505050905090565b600061067d610676610693565b8484610811565b6001905092915050565b61069081610dfd565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610721576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806111c96024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061113b6022913960400191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610897576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806111a46025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561091d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806110f66023913960400191505060405180910390fd5b610928838383610f5e565b6109948160405180606001604052806026815260200161115d60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f639092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a2981600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461102390919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206c6f636b20746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f7e6adfec7e3f286831a0200a754127c171a2da564078722cb97704741bbdb0ea81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cbd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806111836021913960400191505060405180910390fd5b610cc982600083610f5e565b610d358160405180606001604052806022815260200161111960229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f639092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d8d816002546110ab90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ea0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206c6f636b20746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f44427e3003a08f22cf803894075ac0297524e09e521fc1c15bc91741ce3dc15981604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b505050565b6000838311158290611010576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fd5578082015181840152602081019050610fba565b50505050905090810190601f1680156110025780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156110a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006110ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f63565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122045aa7e9b49416add612b126b761515c0057c425552d1763d094360453e86719764736f6c63430006020033 | {"success": true, "error": null, "results": {}} | 1,505 |
0x0b9c10b43025719022fb7c1493ca3f4ec9f0e10f | /**
*Submitted for verification at Etherscan.io on 2021-11-12
*/
/*
* Join our Telegram at https://t.me/EatTheDipToken
* Fair launched
* Prepare for liftoff
*/
// 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 ETD 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 _isnotTaxed;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotalAmt = (MAX-(MAX%_tTotal));
uint256 private _tFeeTotalAmt;
uint256 private _feeForAddr1;
uint256 private _feeForAddr2;
address payable private _marketingWallet;
string private constant _name = "EAT THE DIP";
string private constant _symbol = "ETD";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingWallet = payable(0xDaB5dc22350f9a6Aff03Cf3D9341aAD0ba42d2a6);
_rOwned[_msgSender()] = _rTotalAmt;
_isnotTaxed[owner()] = true;
_isnotTaxed[address(this)] = true;
_isnotTaxed[_marketingWallet] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotalAmt, "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");
_feeForAddr1 = 2;
_feeForAddr2 = 3;
if (from != owner() && to != owner()) {
if (from != address(uniswapV2Router) && to == uniswapV2Pair && ! _isnotTaxed[from]) {
_feeForAddr1 = 2;
_feeForAddr2 = 4;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = 1e11 * 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 {
_rTotalAmt = _rTotalAmt.sub(rFee);
_tFeeTotalAmt = _tFeeTotalAmt.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, _feeForAddr1, _feeForAddr2);
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 = _rTotalAmt;
uint256 tSupply = _tTotal;
if (rSupply < _rTotalAmt.div(_tTotal)) return (_rTotalAmt, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100ab5760003560e01c8063715018a611610064578063715018a6146101ef5780638da5cb5b1461020657806395d89b4114610231578063a9059cbb1461025c578063c9567bf914610299578063dd62ed3e146102b0576100b2565b806306fdde03146100b7578063095ea7b3146100e257806318160ddd1461011f57806323b872dd1461014a578063313ce5671461018757806370a08231146101b2576100b2565b366100b257005b600080fd5b3480156100c357600080fd5b506100cc6102ed565b6040516100d991906121c6565b60405180910390f35b3480156100ee57600080fd5b5061010960048036038101906101049190611dc2565b61032a565b60405161011691906121ab565b60405180910390f35b34801561012b57600080fd5b50610134610348565b6040516101419190612328565b60405180910390f35b34801561015657600080fd5b50610171600480360381019061016c9190611d73565b610359565b60405161017e91906121ab565b60405180910390f35b34801561019357600080fd5b5061019c610432565b6040516101a9919061239d565b60405180910390f35b3480156101be57600080fd5b506101d960048036038101906101d49190611ce5565b61043b565b6040516101e69190612328565b60405180910390f35b3480156101fb57600080fd5b5061020461048c565b005b34801561021257600080fd5b5061021b6105df565b60405161022891906120dd565b60405180910390f35b34801561023d57600080fd5b50610246610608565b60405161025391906121c6565b60405180910390f35b34801561026857600080fd5b50610283600480360381019061027e9190611dc2565b610645565b60405161029091906121ab565b60405180910390f35b3480156102a557600080fd5b506102ae610663565b005b3480156102bc57600080fd5b506102d760048036038101906102d29190611d37565b610ba5565b6040516102e49190612328565b60405180910390f35b60606040518060400160405280600b81526020017f4541542054484520444950000000000000000000000000000000000000000000815250905090565b600061033e610337610c2c565b8484610c34565b6001905092915050565b600068056bc75e2d63100000905090565b6000610366848484610dff565b61042784610372610c2c565b6104228560405180606001604052806028815260200161291560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006103d8610c2c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461118e9092919063ffffffff16565b610c34565b600190509392505050565b60006009905090565b6000610485600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111f2565b9050919050565b610494610c2c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610521576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051890612288565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4554440000000000000000000000000000000000000000000000000000000000815250905090565b6000610659610652610c2c565b8484610dff565b6001905092915050565b61066b610c2c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef90612288565b60405180910390fd5b600c60149054906101000a900460ff1615610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073f90612308565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506107d830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d63100000610c34565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561081e57600080fd5b505afa158015610832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108569190611d0e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b857600080fd5b505afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f09190611d0e565b6040518363ffffffff1660e01b815260040161090d9291906120f8565b602060405180830381600087803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f9190611d0e565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306109e83061043b565b6000806109f36105df565b426040518863ffffffff1660e01b8152600401610a159695949392919061214a565b6060604051808303818588803b158015610a2e57600080fd5b505af1158015610a42573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a679190611e27565b5050506001600c60166101000a81548160ff02191690831515021790555068056bc75e2d63100000600d819055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b4f929190612121565b602060405180830381600087803b158015610b6957600080fd5b505af1158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190611dfe565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ca4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b906122e8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b90612228565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610df29190612328565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e66906122c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed6906121e8565b60405180910390fd5b60008111610f22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f19906122a8565b60405180910390fd5b60026008819055506003600981905550610f3a6105df565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610fa85750610f786105df565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561117e57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110585750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80156110ae5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156110c457600260088190555060046009819055505b60006110cf3061043b565b9050600c60159054906101000a900460ff1615801561113c5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156111545750600c60169054906101000a900460ff165b1561117c5761116281611260565b6000479050600081111561117a576111794761155a565b5b505b505b6111898383836115c6565b505050565b60008383111582906111d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111cd91906121c6565b60405180910390fd5b50600083856111e591906124ee565b9050809150509392505050565b6000600654821115611239576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123090612208565b60405180910390fd5b60006112436115d6565b9050611258818461160190919063ffffffff16565b915050919050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112be577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156112ec5781602001602082028036833780820191505090505b509050308160008151811061132a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114049190611d0e565b8160018151811061143e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506114a530600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610c34565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611509959493929190612343565b600060405180830381600087803b15801561152357600080fd5b505af1158015611537573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115c2573d6000803e3d6000fd5b5050565b6115d183838361164b565b505050565b60008060006115e3611816565b915091506115fa818361160190919063ffffffff16565b9250505090565b600061164383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611878565b905092915050565b60008060008060008061165d876118db565b9550955095509550955095506116bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061175085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179c816119eb565b6117a68483611aa8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118039190612328565b60405180910390a3505050505050505050565b60008060006006549050600068056bc75e2d63100000905061184c68056bc75e2d6310000060065461160190919063ffffffff16565b82101561186b5760065468056bc75e2d63100000935093505050611874565b81819350935050505b9091565b600080831182906118bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b691906121c6565b60405180910390fd5b50600083856118ce9190612463565b9050809150509392505050565b60008060008060008060008060006118f88a600854600954611ae2565b92509250925060006119086115d6565b9050600080600061191b8e878787611b78565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061198583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061118e565b905092915050565b600080828461199c919061240d565b9050838110156119e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d890612248565b60405180910390fd5b8091505092915050565b60006119f56115d6565b90506000611a0c8284611c0190919063ffffffff16565b9050611a6081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611abd8260065461194390919063ffffffff16565b600681905550611ad88160075461198d90919063ffffffff16565b6007819055505050565b600080600080611b0e6064611b00888a611c0190919063ffffffff16565b61160190919063ffffffff16565b90506000611b386064611b2a888b611c0190919063ffffffff16565b61160190919063ffffffff16565b90506000611b6182611b53858c61194390919063ffffffff16565b61194390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611b918589611c0190919063ffffffff16565b90506000611ba88689611c0190919063ffffffff16565b90506000611bbf8789611c0190919063ffffffff16565b90506000611be882611bda858761194390919063ffffffff16565b61194390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c145760009050611c76565b60008284611c229190612494565b9050828482611c319190612463565b14611c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6890612268565b60405180910390fd5b809150505b92915050565b600081359050611c8b816128cf565b92915050565b600081519050611ca0816128cf565b92915050565b600081519050611cb5816128e6565b92915050565b600081359050611cca816128fd565b92915050565b600081519050611cdf816128fd565b92915050565b600060208284031215611cf757600080fd5b6000611d0584828501611c7c565b91505092915050565b600060208284031215611d2057600080fd5b6000611d2e84828501611c91565b91505092915050565b60008060408385031215611d4a57600080fd5b6000611d5885828601611c7c565b9250506020611d6985828601611c7c565b9150509250929050565b600080600060608486031215611d8857600080fd5b6000611d9686828701611c7c565b9350506020611da786828701611c7c565b9250506040611db886828701611cbb565b9150509250925092565b60008060408385031215611dd557600080fd5b6000611de385828601611c7c565b9250506020611df485828601611cbb565b9150509250929050565b600060208284031215611e1057600080fd5b6000611e1e84828501611ca6565b91505092915050565b600080600060608486031215611e3c57600080fd5b6000611e4a86828701611cd0565b9350506020611e5b86828701611cd0565b9250506040611e6c86828701611cd0565b9150509250925092565b6000611e828383611e8e565b60208301905092915050565b611e9781612522565b82525050565b611ea681612522565b82525050565b6000611eb7826123c8565b611ec181856123eb565b9350611ecc836123b8565b8060005b83811015611efd578151611ee48882611e76565b9750611eef836123de565b925050600181019050611ed0565b5085935050505092915050565b611f1381612534565b82525050565b611f2281612577565b82525050565b6000611f33826123d3565b611f3d81856123fc565b9350611f4d818560208601612589565b611f568161261a565b840191505092915050565b6000611f6e6023836123fc565b9150611f798261262b565b604082019050919050565b6000611f91602a836123fc565b9150611f9c8261267a565b604082019050919050565b6000611fb46022836123fc565b9150611fbf826126c9565b604082019050919050565b6000611fd7601b836123fc565b9150611fe282612718565b602082019050919050565b6000611ffa6021836123fc565b915061200582612741565b604082019050919050565b600061201d6020836123fc565b915061202882612790565b602082019050919050565b60006120406029836123fc565b915061204b826127b9565b604082019050919050565b60006120636025836123fc565b915061206e82612808565b604082019050919050565b60006120866024836123fc565b915061209182612857565b604082019050919050565b60006120a96017836123fc565b91506120b4826128a6565b602082019050919050565b6120c881612560565b82525050565b6120d78161256a565b82525050565b60006020820190506120f26000830184611e9d565b92915050565b600060408201905061210d6000830185611e9d565b61211a6020830184611e9d565b9392505050565b60006040820190506121366000830185611e9d565b61214360208301846120bf565b9392505050565b600060c08201905061215f6000830189611e9d565b61216c60208301886120bf565b6121796040830187611f19565b6121866060830186611f19565b6121936080830185611e9d565b6121a060a08301846120bf565b979650505050505050565b60006020820190506121c06000830184611f0a565b92915050565b600060208201905081810360008301526121e08184611f28565b905092915050565b6000602082019050818103600083015261220181611f61565b9050919050565b6000602082019050818103600083015261222181611f84565b9050919050565b6000602082019050818103600083015261224181611fa7565b9050919050565b6000602082019050818103600083015261226181611fca565b9050919050565b6000602082019050818103600083015261228181611fed565b9050919050565b600060208201905081810360008301526122a181612010565b9050919050565b600060208201905081810360008301526122c181612033565b9050919050565b600060208201905081810360008301526122e181612056565b9050919050565b6000602082019050818103600083015261230181612079565b9050919050565b600060208201905081810360008301526123218161209c565b9050919050565b600060208201905061233d60008301846120bf565b92915050565b600060a08201905061235860008301886120bf565b6123656020830187611f19565b81810360408301526123778186611eac565b90506123866060830185611e9d565b61239360808301846120bf565b9695505050505050565b60006020820190506123b260008301846120ce565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061241882612560565b915061242383612560565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612458576124576125bc565b5b828201905092915050565b600061246e82612560565b915061247983612560565b925082612489576124886125eb565b5b828204905092915050565b600061249f82612560565b91506124aa83612560565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156124e3576124e26125bc565b5b828202905092915050565b60006124f982612560565b915061250483612560565b925082821015612517576125166125bc565b5b828203905092915050565b600061252d82612540565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061258282612560565b9050919050565b60005b838110156125a757808201518184015260208101905061258c565b838111156125b6576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6128d881612522565b81146128e357600080fd5b50565b6128ef81612534565b81146128fa57600080fd5b50565b61290681612560565b811461291157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220166671d86e8826484a00bcd0933a0e628002363b891197e0709b3f644ebfa76a64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,506 |
0x7a2ec39ce65b19471a335551621da03f03bdf8a2 | pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="6b181f0e0d0a05450c0e04190c0e2b080405180e0518121845050e1f">[email protected]</span>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610add565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b71565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610bf0565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610c24565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c8d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610dbb565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f3d565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f43565b005b341561052a57600080fd5b610162600435610fd9565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110cb95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110eb565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110f0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110f6565b005b341561062a57600080fd5b6101626004356112b7565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c290826115cd565b5060035460045411156107db576003546107db90610f43565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c057600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109e857600080fd5b81600160a060020a03811615156109fe57600080fd5b60038054905060010160045460328211158015610a1b5750818111155b8015610a2657508015155b8015610a3157508115155b1515610a3c57600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a7483826115cd565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b695760008481526001602052604081206003805491929184908110610b0b57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b4d576001820191505b600454821415610b605760019250610b69565b5b600101610ae2565b5b5050919050565b6000805b600354811015610be95760008381526001602052604081206003805491929184908110610b9e57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610be0576001820191505b5b600101610b75565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c2c611621565b6003805480602002602001604051908101604052809291908181526020018280548015610c8257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c64575b505050505090505b90565b610c95611621565b610c9d611621565b600080600554604051805910610cb05750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4857858015610cf6575060008181526020819052604090206003015460ff16155b80610d1a5750848015610d1a575060008181526020819052604090206003015460ff165b5b15610d3f5780838381518110610d2d57fe5b60209081029091010152600191909101905b5b600101610ccd565b878703604051805910610d585750595b908082528060200260200182016040525b5093508790505b86811015610daf57828181518110610d8457fe5b906020019060200201518489830381518110610d9c57fe5b602090810290910101525b600101610d70565b5b505050949350505050565b610dc3611621565b610dcb611621565b6003546000908190604051805910610de05750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ec35760008581526001602052604081206003805491929184908110610e2657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eba576003805482908110610e6f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9b57fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dfd565b81604051805910610ed15750595b908082528060200260200182016040525b509350600090505b81811015610f3457828181518110610efe57fe5b90602001906020020151848281518110610f1457fe5b600160a060020a039092166020928302909101909101525b600101610eea565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f6357600080fd5b6003548160328211801590610f785750818111155b8015610f8357508015155b8015610f8e57508115155b1515610f9957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff16151561100157600080fd5b6000828152602081905260409020548290600160a060020a0316151561102657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561105a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f2856112b7565b5b5b50505b505b5050565b60006110d88484846114a6565b90506110e381610fd9565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561111857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561114157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561116957600080fd5b600092505b6003548310156112115784600160a060020a031660038481548110151561119157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561120557836003848154811015156111d057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611211565b5b60019092019161116e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156112e257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16151561131757600080fd5b600085815260208190526040902060030154859060ff161561133857600080fd5b61134186610add565b15611499576000868152602081815260409182902060038101805460ff1916600190811790915581548183015460028085018054959c5061142897600160a060020a039094169692956000199581161561010002959095019094160492918391601f83018190048102019051908101604052809291908181526020018280546001816001161561010002031660029004801561141e5780601f106113f35761010080835404028352916020019161141e565b820191906000526020600020905b81548152906001019060200180831161140157829003601f168201915b50505050506115a5565b1561145f57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611499565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b5b5b5b505b50505b505050565b600083600160a060020a03811615156114be57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015181600201908051611549929160200190611645565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b6000806040516020840160008287838a8c6187965a03f1925050508091505b50949350505050565b815481835581811511610813576000838152602090206108139181019083016116c4565b5b505050565b815481835581811511610813576000838152602090206108139181019083016116c4565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061168657805160ff19168380011785556116b3565b828001600101855582156116b3579182015b828111156116b3578251825591602001919060010190611698565b5b506116c09291506116c4565b5090565b610c8a91905b808211156116c057600081556001016116ca565b5090565b905600a165627a7a7230582004f530a717bb133f673c9408b237de8d5bf4588fa84cb10ae21adba3d28f94570029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,507 |
0x73db6843e600597eeefde0cc218bf17f6463b538 | pragma solidity ^0.5.0;
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,"Calculation error");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256){
// Solidity only automatically asserts when dividing by 0
require(b > 0,"Calculation error");
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,"Calculation error");
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256){
uint256 c = a + b;
require(c >= a,"Calculation error");
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256){
require(b != 0,"Calculation error");
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract Layerx is IERC20, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
uint public ethToNextStake = 0;
uint stakeNum = 0;
uint constant CAP = 1000000000000000000; //smallest currency unit
uint amtByDay = 27397260274000000000;
address public stakeCreator = owner;
address[] private activeHolders;
bool isPaused = false;
struct Stake {
uint start;
uint end;
uint layerLockedTotal;
uint rewardPayment;
uint ethLayerx;
}
struct StakeHolder {
uint layerLocked;
uint id;
}
struct Rewards {
uint layersx;
uint eth;
bool withLayersx;
}
event logLockedTokens(address holder, uint amountLocked, uint stakeId);
event logUnlockedTokens(address holder, uint amountUnlocked);
event logNewStakePayment(uint id, uint amount);
event logWithdraw(address holder, uint amount, uint stakeId);
event logTradeLayersxEth(address holder, uint amount, uint stakeId);
modifier paused {
require(isPaused == false, "This contract was paused by the owner!");
_;
}
modifier exist (uint index) {
require(index <= stakeNum, 'This stake does not exist.');
_;
}
mapping (address => StakeHolder) public stakeHolders;
mapping (address => mapping (uint => Rewards)) public rewards;
mapping (uint => Stake) public stakes;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
IERC20 UNILAYER = IERC20(0x0fF6ffcFDa92c53F615a4A75D982f399C989366b);
constructor() public {
symbol = "LAYERX";
name = "UNILAYERX";
decimals = 18;
_totalSupply = 40000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
stakes[0] = Stake(now, 0, 0, 0, 0);
}
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function setNewStakeCreator(address _stakeCreator) external onlyOwner {
require(_stakeCreator != address(0), 'Do not use 0 address');
stakeCreator = _stakeCreator;
}
function setIsPaused(bool newIsPaused) external onlyOwner {
isPaused = newIsPaused;
}
function removeHolder(StakeHolder memory holder) internal {
uint openId = holder.id;
address openWallet = activeHolders[openId];
if(activeHolders.length > 1) {
uint lastId = activeHolders.length-1;
address lastWallet = activeHolders[lastId];
StakeHolder memory lastHolder = stakeHolders[lastWallet];
lastHolder.id = openId;
stakeHolders[lastWallet] = lastHolder;
activeHolders[openId] = lastWallet;
}
activeHolders.pop();
holder.id = 0;
stakeHolders[openWallet] = holder;
}
function lock(uint payment) external paused {
require(payment > 0, 'Payment must be greater than 0.');
require(UNILAYER.balanceOf(msg.sender) >= payment, 'Holder does not have enough tokens.');
UNILAYER.transferFrom(msg.sender, address(this), payment);
StakeHolder memory holder = stakeHolders[msg.sender];
if(holder.layerLocked == 0) {
uint holderId = activeHolders.length;
activeHolders.push(msg.sender);
holder.id = holderId;
}
holder.layerLocked = holder.layerLocked.add(payment);
Stake memory stake = stakes[stakeNum];
stake.layerLockedTotal = stake.layerLockedTotal.add(payment);
stakeHolders[msg.sender] = holder;
stakes[stakeNum] = stake;
emit logLockedTokens(msg.sender, payment, stakeNum);
}
function unlock() external paused {
StakeHolder memory holder = stakeHolders[msg.sender];
uint amt = holder.layerLocked;
require(amt > 0, 'You do not have locked tokens.');
UNILAYER.transfer(msg.sender, amt);
Stake memory stake = stakes[stakeNum];
require(stake.end == 0, 'Invalid date for unlock, please use withdraw.');
stake.layerLockedTotal = stake.layerLockedTotal.sub(amt);
stakes[stakeNum] = stake;
holder.layerLocked = 0;
stakeHolders[msg.sender] = holder;
removeHolder(holder);
emit logUnlockedTokens(msg.sender, amt);
}
function addStakePayment() external {
require(msg.sender == stakeCreator, 'You cannot call this function');
Stake memory stake = stakes[stakeNum];
stake.end = now;
stake.rewardPayment = stake.rewardPayment.add(ethToNextStake);
ethToNextStake = 0;
uint days_passed = stake.end.sub(stake.start).mul(100000000).div(86400); //86400 = 1 day
uint amtLayerx = days_passed.mul(amtByDay).div(100000000);
for(uint i = 0; i < activeHolders.length; i++) {
StakeHolder memory holder = stakeHolders[activeHolders[i]];
uint rate = holder.layerLocked.mul(CAP).div(stake.layerLockedTotal);
rewards[activeHolders[i]][stakeNum].layersx = amtLayerx.mul(rate).div(CAP);
}
stake.ethLayerx = stake.rewardPayment.mul(CAP).div(amtLayerx);
stakes[stakeNum] = stake;
emit logNewStakePayment(stakeNum, ethToNextStake);
stakeNum++;
stakes[stakeNum] = Stake(now, 0, stake.layerLockedTotal, 0, 0);
}
function withdraw(uint index) external paused exist(index) {
Rewards memory rwds = rewards[msg.sender][index];
Stake memory stake = stakes[index];
require(stake.end <= now, 'Invalid date for withdrawal.');
require(stake.rewardPayment > 0, 'There is no value to distribute.');
require(rwds.withLayersx == false, 'You already withdrawal your Layersx.');
require(rwds.layersx > 0, 'You dont have Layerx to withdraw.');
balances[owner] = balances[owner].sub(rwds.layersx);
balances[msg.sender] = balances[msg.sender].add(rwds.layersx);
rwds.withLayersx = true;
emit logWithdraw(msg.sender, rwds.layersx, index);
rewards[msg.sender][index] = rwds;
}
function tradeLayersxToEth(uint index) external paused exist(index) {
Rewards memory rwds = rewards[msg.sender][index];
Stake memory stake = stakes[index];
require(stake.end <= now, 'Invalid date for withdrawal.');
require(rwds.layersx > 0, 'You do not have Layersx for this stake to exchange for ETH.');
require(rwds.eth == 0, 'You already traded the Layersx of this stake for ETH');
balances[msg.sender] = balances[msg.sender].sub(rwds.layersx);
balances[owner] = balances[owner].add(rwds.layersx);
uint eths = stake.ethLayerx.mul(rwds.layersx).div(CAP);
rwds.eth = eths;
msg.sender.transfer(eths);
rewards[msg.sender][index] = rwds;
emit logTradeLayersxEth(msg.sender, eths, index);
}
function getStakesNum() external view returns (uint) {
return stakeNum+1;
}
function() external payable {
ethToNextStake = ethToNextStake.add(msg.value);
}
} | 0x6080604052600436106101665760003560e01c8063a69df4b5116100d1578063dd4670641161008a578063ea40450e11610064578063ea40450e146106a2578063eba39ef5146106b7578063f20d76be146106cc578063f2fde38b146106e157610166565b8063dd467064146105f1578063dd62ed3e1461061b578063e26ff10a1461065657610166565b8063a69df4b514610418578063a9059cbb1461042d578063b933ceac14610466578063cae9ca51146104bf578063d5a44f8614610587578063d73531b9146105dc57610166565b80632e1a7d4d116101235780632e1a7d4d14610320578063313ce5671461034a5780634ce129db1461037557806370a082311461039f5780638da5cb5b146103d257806395d89b411461040357610166565b806305e55e221461017e57806306fdde03146101b3578063095ea7b31461023d57806318160ddd1461028a57806323b872dd146102b1578063240976bf146102f4575b600554610179903463ffffffff61071416565b600555005b34801561018a57600080fd5b506101b1600480360360208110156101a157600080fd5b50356001600160a01b031661076b565b005b3480156101bf57600080fd5b506101c86107f6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102025781810151838201526020016101ea565b50505050905090810190601f16801561022f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024957600080fd5b506102766004803603604081101561026057600080fd5b506001600160a01b038135169060200135610881565b604080519115158252519081900360200190f35b34801561029657600080fd5b5061029f6108e7565b60408051918252519081900360200190f35b3480156102bd57600080fd5b50610276600480360360608110156102d457600080fd5b506001600160a01b0381358116916020810135909116906040013561092a565b34801561030057600080fd5b506101b16004803603602081101561031757600080fd5b50351515610a35565b34801561032c57600080fd5b506101b16004803603602081101561034357600080fd5b5035610a5f565b34801561035657600080fd5b5061035f610dc2565b6040805160ff9092168252519081900360200190f35b34801561038157600080fd5b506101b16004803603602081101561039857600080fd5b5035610dcb565b3480156103ab57600080fd5b5061029f600480360360208110156103c257600080fd5b50356001600160a01b0316611132565b3480156103de57600080fd5b506103e761114d565b604080516001600160a01b039092168252519081900360200190f35b34801561040f57600080fd5b506101c861115c565b34801561042457600080fd5b506101b16111b6565b34801561043957600080fd5b506102766004803603604081101561045057600080fd5b506001600160a01b03813516906020013561144e565b34801561047257600080fd5b5061049f6004803603604081101561048957600080fd5b506001600160a01b0381351690602001356114fe565b604080519384526020840192909252151582820152519081900360600190f35b3480156104cb57600080fd5b50610276600480360360608110156104e257600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561051257600080fd5b82018360208201111561052457600080fd5b8035906020019184600183028401116401000000008311171561054657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061152d945050505050565b34801561059357600080fd5b506105b1600480360360208110156105aa57600080fd5b5035611675565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b3480156105e857600080fd5b506103e76116a4565b3480156105fd57600080fd5b506101b16004803603602081101561061457600080fd5b50356116b3565b34801561062757600080fd5b5061029f6004803603604081101561063e57600080fd5b506001600160a01b0381358116916020013516611a26565b34801561066257600080fd5b506106896004803603602081101561067957600080fd5b50356001600160a01b0316611a51565b6040805192835260208301919091528051918290030190f35b3480156106ae57600080fd5b5061029f611a6a565b3480156106c357600080fd5b5061029f611a73565b3480156106d857600080fd5b506101b1611a79565b3480156106ed57600080fd5b506101b16004803603602081101561070457600080fd5b50356001600160a01b0316611db0565b600082820183811015610762576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b90505b92915050565b6000546001600160a01b0316331461078257600080fd5b6001600160a01b0381166107d4576040805162461bcd60e51b8152602060048201526014602482015273446f206e6f74207573652030206164647265737360601b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156108795780601f1061084e57610100808354040283529160200191610879565b820191906000526020600020905b81548152906001019060200180831161085c57829003601f168201915b505050505081565b336000818152600f602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000808052600e6020527fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c546004546109259163ffffffff611e6716565b905090565b6001600160a01b0383166000908152600e6020526040812054610953908363ffffffff611e6716565b6001600160a01b0385166000908152600e6020908152604080832093909355600f815282822033835290522054610990908363ffffffff611e6716565b6001600160a01b038086166000908152600f602090815260408083203384528252808320949094559186168152600e90915220546109d4908363ffffffff61071416565b6001600160a01b038085166000818152600e602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b6000546001600160a01b03163314610a4c57600080fd5b600a805460ff1916911515919091179055565b600a5460ff1615610aa15760405162461bcd60e51b815260040180806020018281038252602681526020018061221e6026913960400191505060405180910390fd5b80600654811115610af9576040805162461bcd60e51b815260206004820152601a60248201527f54686973207374616b6520646f6573206e6f742065786973742e000000000000604482015290519081900360640190fd5b610b016120ce565b50336000908152600c602090815260408083208584528252918290208251606081018452815481526001820154928101929092526002015460ff16151591810191909152610b4d6120f1565b506000838152600d6020908152604091829020825160a08101845281548152600182015492810183905260028201549381019390935260038101546060840152600401546080830152421015610bea576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206461746520666f72207769746864726177616c2e00000000604482015290519081900360640190fd5b6000816060015111610c43576040805162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f2076616c756520746f20646973747269627574652e604482015290519081900360640190fd5b604082015115610c845760405162461bcd60e51b81526004018080602001828103825260248152602001806122446024913960400191505060405180910390fd5b8151610cc15760405162461bcd60e51b815260040180806020018281038252602181526020018061213b6021913960400191505060405180910390fd5b8151600080546001600160a01b03168152600e6020526040902054610ceb9163ffffffff611e6716565b600080546001600160a01b03168152600e602052604080822092909255835133825291902054610d209163ffffffff61071416565b336000818152600e602090815260409182902093909355600185820152845181519283529282019290925280820186905290517fff68bac75290440ad4e2e04952d4eb6b308d5a3dc9e284319beca871101ce9f29181900360600190a150336000908152600c6020908152604080832095835294815290849020825181559082015160018201559201516002909201805460ff19169215159290921790915550565b60035460ff1681565b600a5460ff1615610e0d5760405162461bcd60e51b815260040180806020018281038252602681526020018061221e6026913960400191505060405180910390fd5b80600654811115610e65576040805162461bcd60e51b815260206004820152601a60248201527f54686973207374616b6520646f6573206e6f742065786973742e000000000000604482015290519081900360640190fd5b610e6d6120ce565b50336000908152600c602090815260408083208584528252918290208251606081018452815481526001820154928101929092526002015460ff16151591810191909152610eb96120f1565b506000838152600d6020908152604091829020825160a08101845281548152600182015492810183905260028201549381019390935260038101546060840152600401546080830152421015610f56576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206461746520666f72207769746864726177616c2e00000000604482015290519081900360640190fd5b8151610f935760405162461bcd60e51b815260040180806020018281038252603b81526020018061215c603b913960400191505060405180910390fd5b602082015115610fd45760405162461bcd60e51b81526004018080602001828103825260348152602001806121bd6034913960400191505060405180910390fd5b8151336000908152600e6020526040902054610ff59163ffffffff611e6716565b336000908152600e602052604080822092909255835181546001600160a01b031682529190205461102b9163ffffffff61071416565b600080546001600160a01b03168152600e60205260408120919091558251608083015161107791670de0b6b3a76400009161106b9163ffffffff611eb816565b9063ffffffff611f1b16565b60208401819052604051909150339082156108fc029083906000818181858888f193505050501580156110ae573d6000803e3d6000fd5b50336000818152600c6020908152604080832089845282529182902086518155868201516001820155868301516002909101805460ff191691151591909117905581519283528201839052818101879052517f988498f37870c15861d5e3ef8232a667df426258fa40b836b0d1d86a3fadb995916060908290030190a15050505050565b6001600160a01b03166000908152600e602052604090205490565b6000546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108795780601f1061084e57610100808354040283529160200191610879565b600a5460ff16156111f85760405162461bcd60e51b815260040180806020018281038252602681526020018061221e6026913960400191505060405180910390fd5b611200612120565b50336000908152600b6020908152604091829020825180840190935280548084526001909101549183019190915280611280576040805162461bcd60e51b815260206004820152601e60248201527f596f7520646f206e6f742068617665206c6f636b656420746f6b656e732e0000604482015290519081900360640190fd5b6010546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156112d457600080fd5b505af11580156112e8573d6000803e3d6000fd5b505050506040513d60208110156112fe57600080fd5b5061130990506120f1565b506006546000908152600d6020908152604091829020825160a08101845281548152600182015492810183905260028201549381019390935260038101546060840152600401546080830152156113915760405162461bcd60e51b815260040180806020018281038252602d8152602001806121f1602d913960400191505060405180910390fd5b60408101516113a6908363ffffffff611e6716565b60408083019182526006546000908152600d6020908152828220855181558186015160018083019190915594516002820155606086015160038201556080860151600490910155818752338252600b8152919020855181559085015191015561140e83611f79565b604080513381526020810184905281517f1e1c7315f93a6e1b6bfe0e451712d9bbed8801b4181d6b6156ac15cfdec52317929181900390910190a1505050565b336000908152600e602052604081205461146e908363ffffffff611e6716565b336000908152600e6020526040808220929092556001600160a01b038516815220546114a0908363ffffffff61071416565b6001600160a01b0384166000818152600e60209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600c60209081526000928352604080842090915290825290208054600182015460029092015490919060ff1683565b336000818152600f602090815260408083206001600160a01b038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a3604051638f4ffcb160e01b815233600482018181526024830186905230604484018190526080606485019081528651608486015286516001600160a01b038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b838110156116045781810151838201526020016115ec565b50505050905090810190601f1680156116315780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561165357600080fd5b505af1158015611667573d6000803e3d6000fd5b506001979650505050505050565b600d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b6008546001600160a01b031681565b600a5460ff16156116f55760405162461bcd60e51b815260040180806020018281038252602681526020018061221e6026913960400191505060405180910390fd5b6000811161174a576040805162461bcd60e51b815260206004820152601f60248201527f5061796d656e74206d7573742062652067726561746572207468616e20302e00604482015290519081900360640190fd5b601054604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561179457600080fd5b505afa1580156117a8573d6000803e3d6000fd5b505050506040513d60208110156117be57600080fd5b505110156117fd5760405162461bcd60e51b81526004018080602001828103825260238152602001806122686023913960400191505060405180910390fd5b601054604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561185757600080fd5b505af115801561186b573d6000803e3d6000fd5b505050506040513d602081101561188157600080fd5b5061188c9050612120565b50336000908152600b6020908152604091829020825180840190935280548084526001909101549183019190915261190757600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180546001600160a01b0319163317905560208201525b8051611919908363ffffffff61071416565b81526119236120f1565b506006546000908152600d6020908152604091829020825160a0810184528154815260018201549281019290925260028101549282018390526003810154606083015260040154608082015290611980908463ffffffff61071416565b6040808301918252336000818152600b60209081528382208751815581880151600191820155600680548452600d8352928590208751815582880151918101919091559451600286015560608087015160038701556080870151600490960195909555905483519283529082018790528183015290517f2ee996d27bca8b62e571470f16dbf7738e6fb7b30525d09904e20647f863edd2929181900390910190a1505050565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205490565b600b602052600090815260409020805460019091015482565b60065460010190565b60055481565b6008546001600160a01b03163314611ad8576040805162461bcd60e51b815260206004820152601d60248201527f596f752063616e6e6f742063616c6c20746869732066756e6374696f6e000000604482015290519081900360640190fd5b611ae06120f1565b506006546000908152600d6020908152604091829020825160a0810184528154815260028201549381019390935260038101546060840181905260049091015460808401524291830191909152600554611b40919063ffffffff61071416565b60608201526000600581905581516020830151611b8191620151809161106b916305f5e10091611b759163ffffffff611e6716565b9063ffffffff611eb816565b90506000611ba26305f5e10061106b60075485611eb890919063ffffffff16565b905060005b600954811015611c9a57611bb9612120565b600b600060098481548110611bca57fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812082518084018452815480825260019290920154948101949094529188015192935091611c2f9161106b90670de0b6b3a764000063ffffffff611eb816565b9050611c4d670de0b6b3a764000061106b868463ffffffff611eb816565b600c600060098681548110611c5e57fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060065482529092529020555050600101611ba7565b50611cbe8161106b670de0b6b3a76400008660600151611eb890919063ffffffff16565b60808401908152600680546000908152600d602090815260409182902087518155818801516001820155828801516002820155606088015160038201559351600490940193909355905460055482519182529281019290925280517fd1b6b1ffebabe406cdd91d77a18826f8cc1b35e378a6e042b48524ea86b906f69281900390910190a15050600680546001908101918290556040805160a08101825242815260006020808301828152968401518385019081526060840183815260808501848152978452600d90925293909120915182559451928101929092555160028201559151600383015551600490910155565b6000546001600160a01b03163314611dc757600080fd5b6001600160a01b038116611e0c5760405162461bcd60e51b81526004018080602001828103825260268152602001806121976026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082821115611eb2576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b50900390565b600082611ec757506000610765565b82820282848281611ed457fe5b0414610762576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b6000808211611f65576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b6000828481611f7057fe5b04949350505050565b600081602001519050600060098281548110611f9157fe5b6000918252602090912001546009546001600160a01b0390911691506001101561206f576009805460001981019160009183908110611fcc57fe5b6000918252602090912001546001600160a01b03169050611feb612120565b506001600160a01b0381166000818152600b602081815260408084208151808301909252805482528183018a815295909452919052805182559151600190910155600980548391908790811061203d57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050505b600980548061207a57fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092558481018281526001600160a01b03939093168252600b90526040902092518355516001929092019190915550565b604051806060016040528060008152602001600081526020016000151581525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b60405180604001604052806000815260200160008152509056fe596f7520646f6e742068617665204c617965727820746f2077697468647261772e596f7520646f206e6f742068617665204c61796572737820666f722074686973207374616b6520746f2065786368616e676520666f72204554482e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373596f7520616c72656164792074726164656420746865204c617965727378206f662074686973207374616b6520666f7220455448496e76616c6964206461746520666f7220756e6c6f636b2c20706c65617365207573652077697468647261772e5468697320636f6e7472616374207761732070617573656420627920746865206f776e657221596f7520616c7265616479207769746864726177616c20796f7572204c6179657273782e486f6c64657220646f6573206e6f74206861766520656e6f75676820746f6b656e732ea265627a7a7231582026d02043519c0cde4fbea80c583e95930d2789b8730377bd973197243c37ed7864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,508 |
0xa228454322dea09aae5f835b2e30f1b099fa75a6 | pragma solidity ^0.4.23;
/**
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
*/
contract ERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
function implementsERC721() public pure returns (bool);
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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 CurioAuction
* @dev CurioAuction contract implements clock auction for tokens sale.
*/
contract CurioAuction is Pausable {
event AuctionCreated(
uint256 indexed tokenId,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration
);
event AuctionSuccessful(
uint256 indexed tokenId,
uint256 totalPrice,
address indexed winner
);
event AuctionCancelled(uint256 indexed tokenId);
// Represents an auction on a token
struct Auction {
// Current owner of token
address seller;
// Price (in wei) at beginning of auction
uint128 startingPrice;
// Price (in wei) at end of auction
uint128 endingPrice;
// Duration (in seconds) of auction
uint64 duration;
// Time when auction started (0 if this auction has been concluded)
uint64 startedAt;
}
// Check that this contract is correct for Curio main contract
bool public isCurioAuction = true;
// Reference to token contract
ERC721 public tokenContract;
// Value of fee (1/100 of a percent; 0-10,000 map to 0%-100%)
uint256 public feePercent;
// Map from token ID to auction
mapping (uint256 => Auction) tokenIdToAuction;
// Count of release tokens sold by auction
uint256 public releaseTokensSaleCount;
// Limit of start and end prices in wei
uint256 public auctionPriceLimit;
/**
* @dev Constructor function
* @param _tokenAddress Address of ERC721 token contract (Curio core contract)
* @param _fee Percent of fee (0-10,000)
* @param _auctionPriceLimit Limit of start and end price in auction (in wei)
*/
constructor(
address _tokenAddress,
uint256 _fee,
uint256 _auctionPriceLimit
)
public
{
require(_fee <= 10000);
feePercent = _fee;
ERC721 candidateContract = ERC721(_tokenAddress);
require(candidateContract.implementsERC721());
tokenContract = candidateContract;
require(_auctionPriceLimit == uint256(uint128(_auctionPriceLimit)));
auctionPriceLimit = _auctionPriceLimit;
}
// -----------------------------------------
// External interface
// -----------------------------------------
/**
* @dev Creates a new auction.
* @param _tokenId ID of token to auction, sender must be owner
* @param _startingPrice Price of item (in wei) at beginning of auction
* @param _endingPrice Price of item (in wei) at end of auction
* @param _duration Length of auction (in seconds)
* @param _seller Seller address
*/
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
whenNotPaused
external
{
// Overflow and limitation input check
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_startingPrice < auctionPriceLimit);
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_endingPrice < auctionPriceLimit);
require(_duration == uint256(uint64(_duration)));
// Check call from token contract
require(msg.sender == address(tokenContract));
// Transfer token from seller to this contract
_deposit(_seller, _tokenId);
// Create an auction
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
/**
* @dev Returns auction info for a token on auction.
* @param _tokenId ID of token on auction
*/
function getAuction(uint256 _tokenId) external view
returns
(
address seller,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration,
uint256 startedAt
) {
// Check token on auction
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return (
auction.seller,
auction.startingPrice,
auction.endingPrice,
auction.duration,
auction.startedAt
);
}
/**
* @dev Returns the current price of an auction.
* @param _tokenId ID of the token price we are checking
*/
function getCurrentPrice(uint256 _tokenId) external view returns (uint256) {
// Check token on auction
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return _currentPrice(auction);
}
/**
* @dev Bids on an open auction, completing the auction and transferring
* ownership of the token if enough Ether is supplied.
* @param _tokenId ID of token to bid on
*/
function bid(uint256 _tokenId) external payable whenNotPaused {
address seller = tokenIdToAuction[_tokenId].seller;
// Check auction conditions and transfer Ether to seller
// _bid verifies token ID size
_bid(_tokenId, msg.value);
// Transfer token from this contract to msg.sender after successful bid
_transfer(msg.sender, _tokenId);
// If seller is tokenContract then increase counter of release tokens
if (seller == address(tokenContract)) {
releaseTokensSaleCount++;
}
}
/**
* @dev Cancels an auction. Returns the token to original owner.
* This is a state-modifying function that can
* be called while the contract is paused.
* @param _tokenId ID of token on auction
*/
function cancelAuction(uint256 _tokenId) external {
// Check token on auction
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
// Check sender as seller
address seller = auction.seller;
require(msg.sender == seller);
_cancelAuction(_tokenId, seller);
}
/**
* @dev Cancels an auction when the contract is paused. Only owner.
* Returns the token to seller. This should only be used in emergencies.
* @param _tokenId ID of the NFT on auction to cancel
*/
function cancelAuctionWhenPaused(uint256 _tokenId) whenPaused onlyOwner external {
// Check token on auction
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
/**
* @dev Withdraw all Ether (fee) from auction contract to token contract.
* Only auction contract owner.
*/
function withdrawBalance() external {
address tokenAddress = address(tokenContract);
// Check sender as owner or token contract
require(msg.sender == owner || msg.sender == tokenAddress);
// Send Ether on this contract to token contract
// Boolean method make sure that even if one fails it will still work
bool res = tokenAddress.send(address(this).balance);
}
/**
* @dev Set new auction price limit.
* @param _newAuctionPriceLimit Start and end price limit
*/
function setAuctionPriceLimit(uint256 _newAuctionPriceLimit) external {
address tokenAddress = address(tokenContract);
// Check sender as owner or token contract
require(msg.sender == owner || msg.sender == tokenAddress);
// Check overflow
require(_newAuctionPriceLimit == uint256(uint128(_newAuctionPriceLimit)));
// Set new auction price limit
auctionPriceLimit = _newAuctionPriceLimit;
}
// -----------------------------------------
// Internal interface
// -----------------------------------------
/**
* @dev Returns true if the claimant owns the token.
* @param _claimant Address claiming to own the token
* @param _tokenId ID of token whose ownership to verify
*/
function _owns(
address _claimant,
uint256 _tokenId
)
internal
view
returns (bool)
{
return (tokenContract.ownerOf(_tokenId) == _claimant);
}
/**
* @dev Transfer token from owner to this contract.
* @param _owner Current owner address of token to escrow
* @param _tokenId ID of token whose approval to verify
*/
function _deposit(
address _owner,
uint256 _tokenId
)
internal
{
tokenContract.transferFrom(_owner, this, _tokenId);
}
/**
* @dev Transfers token owned by this contract to another address.
* Returns true if the transfer succeeds.
* @param _receiver Address to transfer token to
* @param _tokenId ID of token to transfer
*/
function _transfer(
address _receiver,
uint256 _tokenId
)
internal
{
tokenContract.transfer(_receiver, _tokenId);
}
/**
* @dev Adds an auction to the list of open auctions.
* @param _tokenId The ID of the token to be put on auction
* @param _auction Auction to add
*/
function _addAuction(
uint256 _tokenId,
Auction _auction
)
internal
{
// Require that all auctions have a duration of at least one minute.
require(_auction.duration >= 1 minutes);
tokenIdToAuction[_tokenId] = _auction;
emit AuctionCreated(
uint256(_tokenId),
uint256(_auction.startingPrice),
uint256(_auction.endingPrice),
uint256(_auction.duration)
);
}
/**
* @dev Removes an auction from the list of open auctions.
* @param _tokenId ID of token on auction
*/
function _removeAuction(uint256 _tokenId) internal {
delete tokenIdToAuction[_tokenId];
}
/**
* @dev Remove an auction and transfer token from this contract to seller address.
* @param _tokenId The ID of the token
* @param _seller Seller address
*/
function _cancelAuction(
uint256 _tokenId,
address _seller
)
internal
{
// Remove auction from list
_removeAuction(_tokenId);
// Transfer token to seller
_transfer(_seller, _tokenId);
emit AuctionCancelled(_tokenId);
}
/**
* @dev Check token is on auction.
* @param _auction Auction to check
*/
function _isOnAuction(Auction storage _auction) internal view returns (bool) {
return (_auction.startedAt > 0);
}
/**
* @dev Calculates fee of a sale.
* @param _price Token price
*/
function _calculateFee(uint256 _price) internal view returns (uint256) {
return _price * feePercent / 10000;
}
/**
* @dev Returns current price of a token on auction.
* @param _auction Auction for calculate current price
*/
function _currentPrice(Auction storage _auction) internal view returns (uint256) {
uint256 secondsPassed = 0;
// Check that auction were started
// Variable secondsPassed is positive
if (now > _auction.startedAt) {
secondsPassed = now - _auction.startedAt;
}
return _calculateCurrentPrice(
_auction.startingPrice,
_auction.endingPrice,
_auction.duration,
secondsPassed
);
}
/**
* @dev Calculate the current price of an auction.
* @param _startingPrice Price of item (in wei) at beginning of auction
* @param _endingPrice Price of item (in wei) at end of auction
* @param _duration Length of auction (in seconds)
* @param _secondsPassed Seconds passed after auction start
*/
function _calculateCurrentPrice(
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
uint256 _secondsPassed
)
internal
pure
returns (uint256)
{
if (_secondsPassed >= _duration) {
// The auction lasts longer duration
// Return end price
return _endingPrice;
} else {
// totalPriceChange can be negative
int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice);
// This multiplication can't overflow, _secondsPassed will easily fit within
// 64-bits, and totalPriceChange will easily fit within 128-bits, their product
// will always fit within 256-bits.
int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration);
// currentPriceChange can be negative, but if so, will have a magnitude
// less that _startingPrice. Thus, this result will always end up positive.
int256 currentPrice = int256(_startingPrice) + currentPriceChange;
return uint256(currentPrice);
}
}
/**
* @dev Calculate auction price and transfers winnings. Does NOT transfer ownership of token.
* @param _tokenId The ID of the token
* @param _bidAmount Amount (in wei) offered for auction
*/
function _bid(
uint256 _tokenId,
uint256 _bidAmount
)
internal
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
// Check that this auction is currently live
require(_isOnAuction(auction));
// Check that the incoming bid is higher than the current price
uint256 price = _currentPrice(auction);
require(_bidAmount >= price);
address seller = auction.seller;
_removeAuction(_tokenId);
// Transfer proceeds to seller
if (price > 0) {
uint256 fee = _calculateFee(price);
uint256 sellerProceeds = price - fee;
// Transfer proceeds to seller
seller.transfer(sellerProceeds);
}
// Calculate excess funds and transfer it back to bidder
uint256 bidExcess = _bidAmount - price;
msg.sender.transfer(bidExcess);
emit AuctionSuccessful(_tokenId, price, msg.sender);
return price;
}
} | 0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166327ebe40a81146101005780633f4ba83a1461012f57806340ec0b6a14610144578063454a2ab31461016d57806355a373d6146101785780635c975abb146101a95780635fd8c710146101be57806378bd7935146101d35780637afd4762146102205780637fd6f15c146102475780638456cb591461025c578063878eb368146102715780638da5cb5b1461028957806396b5a7551461029e578063c55d0f56146102b6578063cf7c2985146102ce578063f2fde38b146102e6578063fa31e68414610307575b600080fd5b34801561010c57600080fd5b5061012d600435602435604435606435600160a060020a036084351661031c565b005b34801561013b57600080fd5b5061012d610447565b34801561015057600080fd5b506101596104bd565b604080519115158252519081900360200190f35b61012d6004356104df565b34801561018457600080fd5b5061018d610549565b60408051600160a060020a039092168252519081900360200190f35b3480156101b557600080fd5b50610159610558565b3480156101ca57600080fd5b5061012d610568565b3480156101df57600080fd5b506101eb6004356105c5565b60408051600160a060020a03909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b34801561022c57600080fd5b5061023561065b565b60408051918252519081900360200190f35b34801561025357600080fd5b50610235610661565b34801561026857600080fd5b5061012d610667565b34801561027d57600080fd5b5061012d6004356106e2565b34801561029557600080fd5b5061018d61074b565b3480156102aa57600080fd5b5061012d60043561075a565b3480156102c257600080fd5b506102356004356107a4565b3480156102da57600080fd5b5061012d6004356107d6565b3480156102f257600080fd5b5061012d600160a060020a036004351661082d565b34801561031357600080fd5b506102356108c1565b610324610db2565b60005460a060020a900460ff161561033b57600080fd5b6fffffffffffffffffffffffffffffffff8516851461035957600080fd5b600554851061036757600080fd5b6fffffffffffffffffffffffffffffffff8416841461038557600080fd5b600554841061039357600080fd5b67ffffffffffffffff831683146103a957600080fd5b600154600160a060020a031633146103c057600080fd5b6103ca82876108c7565b60a06040519081016040528083600160a060020a03168152602001866fffffffffffffffffffffffffffffffff168152602001856fffffffffffffffffffffffffffffffff1681526020018467ffffffffffffffff1681526020014267ffffffffffffffff16815250905061043f868261094f565b505050505050565b600054600160a060020a0316331461045e57600080fd5b60005460a060020a900460ff16151561047657600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b6000547501000000000000000000000000000000000000000000900460ff1681565b6000805460a060020a900460ff16156104f757600080fd5b50600081815260036020526040902054600160a060020a031661051a8234610a9d565b506105253383610bbb565b600154600160a060020a0382811691161415610545576004805460010190555b5050565b600154600160a060020a031681565b60005460a060020a900460ff1681565b60015460008054600160a060020a039283169216331480610591575033600160a060020a038316145b151561059c57600080fd5b604051600160a060020a03831690303180156108fc02916000818181858888f150505050505050565b600081815260036020526040812081908190819081906105e481610c29565b15156105ef57600080fd5b80546001820154600290920154600160a060020a03909116986fffffffffffffffffffffffffffffffff8084169950700100000000000000000000000000000000909304909216965067ffffffffffffffff808216965068010000000000000000909104169350915050565b60055481565b60025481565b600054600160a060020a0316331461067e57600080fd5b60005460a060020a900460ff161561069557600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b6000805460a060020a900460ff1615156106fb57600080fd5b600054600160a060020a0316331461071257600080fd5b50600081815260036020526040902061072a81610c29565b151561073557600080fd5b8054610545908390600160a060020a0316610c4a565b600054600160a060020a031681565b60008181526003602052604081209061077282610c29565b151561077d57600080fd5b508054600160a060020a031633811461079557600080fd5b61079f8382610c4a565b505050565b60008181526003602052604081206107bb81610c29565b15156107c657600080fd5b6107cf81610c8c565b9392505050565b600154600054600160a060020a0391821691163314806107fe575033600160a060020a038216145b151561080957600080fd5b6fffffffffffffffffffffffffffffffff8216821461082757600080fd5b50600555565b600054600160a060020a0316331461084457600080fd5b600160a060020a038116151561085957600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045481565b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015230602483015260448201859052915191909216916323b872dd91606480830192600092919082900301818387803b15801561093b57600080fd5b505af115801561043f573d6000803e3d6000fd5b603c816060015167ffffffffffffffff161015151561096d57600080fd5b60008281526003602090815260409182902083518154600160a060020a0390911673ffffffffffffffffffffffffffffffffffffffff1990911617815581840151600182018054858701516fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000081029482166fffffffffffffffffffffffffffffffff1990931683179091169390931790915560608087015160029094018054608089015167ffffffffffffffff90811668010000000000000000026fffffffffffffffff0000000000000000199190971667ffffffffffffffff1990921682171695909517905585519182529381019190915280840191909152915184927fa9c8dfcda5664a5a124c713e386da27de87432d5b668e79458501eb296389ba792908290030190a25050565b60008281526003602052604081208180808080610ab986610c29565b1515610ac457600080fd5b610acd86610c8c565b945084881015610adc57600080fd5b8554600160a060020a03169350610af289610d1c565b6000851115610b4457610b0485610d69565b6040519093508386039250600160a060020a0385169083156108fc029084906000818181858888f19350505050158015610b42573d6000803e3d6000fd5b505b5060405184880390339082156108fc029083906000818181858888f19350505050158015610b76573d6000803e3d6000fd5b5060408051868152905133918b917f4fcc30d90a842164dd58501ab874a101a3749c3d4747139cefe7c876f4ccebd29181900360200190a35092979650505050505050565b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb91604480830192600092919082900301818387803b15801561093b57600080fd5b6002015460006801000000000000000090910467ffffffffffffffff161190565b610c5382610d1c565b610c5d8183610bbb565b60405182907f2809c7e17bf978fbc7194c0a694b638c4215e9140cacc6c38ca36010b45697df90600090a25050565b6002810154600090819068010000000000000000900467ffffffffffffffff16421115610cd25750600282015468010000000000000000900467ffffffffffffffff1642035b600183015460028401546107cf916fffffffffffffffffffffffffffffffff80821692700100000000000000000000000000000000909204169067ffffffffffffffff1684610d75565b6000908152600360205260408120805473ffffffffffffffffffffffffffffffffffffffff19168155600181019190915560020180546fffffffffffffffffffffffffffffffff19169055565b60025461271091020490565b6000808080858510610d8957869350610da7565b878703925085858402811515610d9b57fe5b05915081880190508093505b505050949350505050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a7230582095f6191f424b8743a9cdcc6afe5a39e658b6c4eb96ba26e50cf9c73be99be1780029 | {"success": true, "error": null, "results": {}} | 1,509 |
0xA2eecb40b232fB5968B70DF5A2fb89541E31374A | /*
Ivory Inu -> $IVORY
Telegram: https://t.me/ivoryinutoken
/$$$$$$ /$$$$$$
|_ $$_/ |_ $$_/
| $$ /$$ /$$/$$$$$$ /$$$$$$ /$$ /$$ | $$ /$$$$$$$ /$$ /$$
| $$| $$ /$$/$$__ $$ /$$__ $$| $$ | $$ | $$ | $$__ $$| $$ | $$
| $$ \ $$/$$/ $$ \ $$| $$ \__/| $$ | $$ | $$ | $$ \ $$| $$ | $$
| $$ \ $$$/| $$ | $$| $$ | $$ | $$ | $$ | $$ | $$| $$ | $$
/$$$$$$ \ $/ | $$$$$$/| $$ | $$$$$$$ /$$$$$$| $$ | $$| $$$$$$/
|______/ \_/ \______/ |__/ \____ $$ |______/|__/ |__/ \______/
/$$ | $$
| $$$$$$/
\______/
*/
// 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
);
}
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 IvoryInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ivory Inu";
string private constant _symbol = "IVORY";
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 = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 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 + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4500 * 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);
}
}
| 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d5578063a9059cbb14610303578063c3c8cd8014610323578063d543dbeb14610338578063dd62ed3e1461035857600080fd5b80636fc3eaec1461026357806370a0823114610278578063715018a6146102985780638da5cb5b146102ad57600080fd5b806323b872dd116100dc57806323b872dd146101d2578063293230b8146101f2578063313ce567146102075780635932ead1146102235780636b9990531461024357600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b5061013861013336600461189e565b61039e565b005b34801561014657600080fd5b5060408051808201909152600981526849766f727920496e7560b81b60208201525b60405161017591906119e2565b60405180910390f35b34801561018a57600080fd5b5061019e610199366004611873565b61044b565b6040519015158152602001610175565b3480156101ba57600080fd5b5066038d7ea4c680005b604051908152602001610175565b3480156101de57600080fd5b5061019e6101ed366004611833565b610462565b3480156101fe57600080fd5b506101386104cb565b34801561021357600080fd5b5060405160098152602001610175565b34801561022f57600080fd5b5061013861023e366004611965565b61088a565b34801561024f57600080fd5b5061013861025e3660046117c3565b6108d2565b34801561026f57600080fd5b5061013861091d565b34801561028457600080fd5b506101c46102933660046117c3565b61094a565b3480156102a457600080fd5b5061013861096c565b3480156102b957600080fd5b506000546040516001600160a01b039091168152602001610175565b3480156102e157600080fd5b5060408051808201909152600581526449564f525960d81b6020820152610168565b34801561030f57600080fd5b5061019e61031e366004611873565b6109e0565b34801561032f57600080fd5b506101386109ed565b34801561034457600080fd5b5061013861035336600461199d565b610a23565b34801561036457600080fd5b506101c46103733660046117fb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d15760405162461bcd60e51b81526004016103c890611a35565b60405180910390fd5b60005b8151811015610447576001600a600084848151811061040357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061043f81611b48565b9150506103d4565b5050565b6000610458338484610af4565b5060015b92915050565b600061046f848484610c18565b6104c184336104bc85604051806060016040528060288152602001611bb3602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061102a565b610af4565b5060019392505050565b6000546001600160a01b031633146104f55760405162461bcd60e51b81526004016103c890611a35565b600f54600160a01b900460ff161561054f5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103c8565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058a308266038d7ea4c68000610af4565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c357600080fd5b505afa1580156105d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fb91906117df565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064357600080fd5b505afa158015610657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067b91906117df565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c357600080fd5b505af11580156106d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fb91906117df565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072b8161094a565b6000806107406000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a357600080fd5b505af11580156107b7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107dc91906119b5565b5050600f8054650417bce6c80060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561085257600080fd5b505af1158015610866573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104479190611981565b6000546001600160a01b031633146108b45760405162461bcd60e51b81526004016103c890611a35565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146108fc5760405162461bcd60e51b81526004016103c890611a35565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461093d57600080fd5b4761094781611064565b50565b6001600160a01b03811660009081526002602052604081205461045c906110e9565b6000546001600160a01b031633146109965760405162461bcd60e51b81526004016103c890611a35565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610458338484610c18565b600c546001600160a01b0316336001600160a01b031614610a0d57600080fd5b6000610a183061094a565b90506109478161116d565b6000546001600160a01b03163314610a4d5760405162461bcd60e51b81526004016103c890611a35565b60008111610a9d5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103c8565b610ab96064610ab366038d7ea4c6800084611312565b90611391565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b565760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c8565b6001600160a01b038216610bb75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c7c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c8565b6001600160a01b038216610cde5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c8565b60008111610d405760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103c8565b6000546001600160a01b03848116911614801590610d6c57506000546001600160a01b03838116911614155b15610fcd57600f54600160b81b900460ff1615610e53576001600160a01b0383163014801590610da557506001600160a01b0382163014155b8015610dbf5750600e546001600160a01b03848116911614155b8015610dd95750600e546001600160a01b03838116911614155b15610e5357600e546001600160a01b0316336001600160a01b03161480610e135750600f546001600160a01b0316336001600160a01b0316145b610e535760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103c8565b601054811115610e6257600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ea457506001600160a01b0382166000908152600a602052604090205460ff16155b610ead57600080fd5b600f546001600160a01b038481169116148015610ed85750600e546001600160a01b03838116911614155b8015610efd57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f125750600f54600160b81b900460ff165b15610f60576001600160a01b0382166000908152600b60205260409020544211610f3b57600080fd5b610f4642600a611ada565b6001600160a01b0383166000908152600b60205260409020555b6000610f6b3061094a565b600f54909150600160a81b900460ff16158015610f965750600f546001600160a01b03858116911614155b8015610fab5750600f54600160b01b900460ff165b15610fcb57610fb98161116d565b478015610fc957610fc947611064565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061100f57506001600160a01b03831660009081526005602052604090205460ff165b15611018575060005b611024848484846113d3565b50505050565b6000818484111561104e5760405162461bcd60e51b81526004016103c891906119e2565b50600061105b8486611b31565b95945050505050565b600c546001600160a01b03166108fc61107e836002611391565b6040518115909202916000818181858888f193505050501580156110a6573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110c1836002611391565b6040518115909202916000818181858888f19350505050158015610447573d6000803e3d6000fd5b60006006548211156111505760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103c8565b600061115a6113ff565b90506111668382611391565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111c357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124f91906117df565b8160018151811061127057634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112969130911684610af4565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112cf908590600090869030904290600401611a6a565b600060405180830381600087803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826113215750600061045c565b600061132d8385611b12565b90508261133a8583611af2565b146111665760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103c8565b600061116683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611422565b806113e0576113e0611450565b6113eb848484611473565b80611024576110246005600855600a600955565b600080600061140c61156a565b909250905061141b8282611391565b9250505090565b600081836114435760405162461bcd60e51b81526004016103c891906119e2565b50600061105b8486611af2565b6008541580156114605750600954155b1561146757565b60006008819055600955565b600080600080600080611485876115a8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114b79087611605565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114e69086611647565b6001600160a01b038916600090815260026020526040902055611508816116a6565b61151284836116f0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161155791815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c680006115848282611391565b82101561159f5750506006549266038d7ea4c6800092509050565b90939092509050565b60008060008060008060008060006115c58a600854600954611714565b92509250925060006115d56113ff565b905060008060006115e88e878787611763565b919e509c509a509598509396509194505050505091939550919395565b600061116683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061102a565b6000806116548385611ada565b9050838110156111665760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103c8565b60006116b06113ff565b905060006116be8383611312565b306000908152600260205260409020549091506116db9082611647565b30600090815260026020526040902055505050565b6006546116fd9083611605565b60065560075461170d9082611647565b6007555050565b60008080806117286064610ab38989611312565b9050600061173b6064610ab38a89611312565b905060006117538261174d8b86611605565b90611605565b9992985090965090945050505050565b60008080806117728886611312565b905060006117808887611312565b9050600061178e8888611312565b905060006117a08261174d8686611605565b939b939a50919850919650505050505050565b80356117be81611b8f565b919050565b6000602082840312156117d4578081fd5b813561116681611b8f565b6000602082840312156117f0578081fd5b815161116681611b8f565b6000806040838503121561180d578081fd5b823561181881611b8f565b9150602083013561182881611b8f565b809150509250929050565b600080600060608486031215611847578081fd5b833561185281611b8f565b9250602084013561186281611b8f565b929592945050506040919091013590565b60008060408385031215611885578182fd5b823561189081611b8f565b946020939093013593505050565b600060208083850312156118b0578182fd5b823567ffffffffffffffff808211156118c7578384fd5b818501915085601f8301126118da578384fd5b8135818111156118ec576118ec611b79565b8060051b604051601f19603f8301168101818110858211171561191157611911611b79565b604052828152858101935084860182860187018a101561192f578788fd5b8795505b8386101561195857611944816117b3565b855260019590950194938601938601611933565b5098975050505050505050565b600060208284031215611976578081fd5b813561116681611ba4565b600060208284031215611992578081fd5b815161116681611ba4565b6000602082840312156119ae578081fd5b5035919050565b6000806000606084860312156119c9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a0e578581018301518582016040015282016119f2565b81811115611a1f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ab95784516001600160a01b031683529383019391830191600101611a94565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611aed57611aed611b63565b500190565b600082611b0d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b2c57611b2c611b63565b500290565b600082821015611b4357611b43611b63565b500390565b6000600019821415611b5c57611b5c611b63565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094757600080fd5b801515811461094757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dabb6ba1d9e24d4f5fae7d42931aae33ccee96394a907821efcde836e14218f064736f6c63430008040033 | {"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"}]}} | 1,510 |
0xeae0fbf5400e508ffe6a4c8810d7e3505f7eda08 | /**
There are about 100,000,000,000 planets in the Galaxy, and each token represents a planet
t.me/Orion_Cat
*/
// 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 OrionCat is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Orion Cat";
string private constant _symbol = "ORION";
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 = 100000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _taxFeeOnSell = 13;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x8db5248F1C22dC30a557F05014086acf02f3AB7F);
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 = 1000000000 * 10**9;
uint256 public _maxWalletSize = 2500000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000000 * 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 OpenTrading(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;
}
} | 0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b806323b872dd1161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b806323b872dd146103155780632fd689e314610352578063313ce5671461037d57806349bd5a5e146103a8576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c15780631f600db0146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe919061301c565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190613506565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f5b565b61084e565b60405161026491906134d0565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906130bf565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b891906134eb565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906136e8565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190613065565b61092a565b005b34801561032157600080fd5b5061033c60048036038101906103379190612ec8565b6109c3565b60405161034991906134d0565b60405180910390f35b34801561035e57600080fd5b50610367610a9c565b60405161037491906136e8565b60405180910390f35b34801561038957600080fd5b50610392610aa2565b60405161039f919061375d565b60405180910390f35b3480156103b457600080fd5b506103bd610aab565b6040516103ca9190613454565b60405180910390f35b3480156103df57600080fd5b506103fa60048036038101906103f59190612f1b565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e9190612f9b565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190612e2e565b610c98565b005b34801561045a57600080fd5b5061047560048036038101906104709190613065565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190612e2e565b610e08565b6040516104ab91906136e8565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613092565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906136e8565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b6040516105419190613454565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906136e8565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190613506565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613092565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f5b565b6110ff565b60405161061491906134d0565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612e2e565b61111d565b60405161065191906134d0565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b5061069860048036038101906106939190612e88565b6111d2565b6040516106a591906136e8565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613092565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190612e2e565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390613648565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a0613adb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080590613a34565b91505061077f565b5050565b60606040518060400160405280600981526020017f4f72696f6e204361740000000000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df90613648565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b610932611495565b73ffffffffffffffffffffffffffffffffffffffff16610950610f65565b73ffffffffffffffffffffffffffffffffffffffff16146109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099d90613648565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b60006109d0848484611668565b610a91846109dc611495565b610a8c85604051806060016040528060288152602001613f6360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a42611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4490613648565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90613648565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c48613adb565b5b9050602002016020810190610c5e9190612e2e565b858585818110610c7157610c70613adb565b5b90506020020135612062565b508080610c8990613a34565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b90613648565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de290613648565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec490613648565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c90613648565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100190613648565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600581526020017f4f52494f4e000000000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec90613648565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b090613648565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613648565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290613648565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613568565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906136c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490613588565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906136e8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf90613688565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90613528565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613668565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906135c8565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613548565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906135a8565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb919061381e565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b10919061381e565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613608565b60405180910390fd5b5b600f5481611b5f84610e08565b611b69919061381e565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba0906136a8565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190613506565b60405180910390fd5b506000838561205591906138ff565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906136e8565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d91906138ff565b905060004790506000600267ffffffffffffffff81111561237157612370613b0a565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b6613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190612e5b565b816001815181106124a5576124a4613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613703565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af919061381e565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb906135e8565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f91906138a5565b905082848261272e9190613874565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613628565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a29695949392919061346f565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f491906130ff565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906136e8565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190613506565b60405180910390fd5b5060008385612b2b9190613874565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906136e8565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000612c8e612c898461379d565b613778565b90508083825260208201905082856020860282011115612cb157612cb0613b43565b5b60005b85811015612ce15781612cc78882612ceb565b845260208401935060208301925050600181019050612cb4565b5050509392505050565b600081359050612cfa81613f1d565b92915050565b600081519050612d0f81613f1d565b92915050565b60008083601f840112612d2b57612d2a613b3e565b5b8235905067ffffffffffffffff811115612d4857612d47613b39565b5b602083019150836020820283011115612d6457612d63613b43565b5b9250929050565b600082601f830112612d8057612d7f613b3e565b5b8135612d90848260208601612c7b565b91505092915050565b60008083601f840112612daf57612dae613b3e565b5b8235905067ffffffffffffffff811115612dcc57612dcb613b39565b5b602083019150836020820283011115612de857612de7613b43565b5b9250929050565b600081359050612dfe81613f34565b92915050565b600081359050612e1381613f4b565b92915050565b600081519050612e2881613f4b565b92915050565b600060208284031215612e4457612e43613b4d565b5b6000612e5284828501612ceb565b91505092915050565b600060208284031215612e7157612e70613b4d565b5b6000612e7f84828501612d00565b91505092915050565b60008060408385031215612e9f57612e9e613b4d565b5b6000612ead85828601612ceb565b9250506020612ebe85828601612ceb565b9150509250929050565b600080600060608486031215612ee157612ee0613b4d565b5b6000612eef86828701612ceb565b9350506020612f0086828701612ceb565b9250506040612f1186828701612e04565b9150509250925092565b60008060408385031215612f3257612f31613b4d565b5b6000612f4085828601612ceb565b9250506020612f5185828601612def565b9150509250929050565b60008060408385031215612f7257612f71613b4d565b5b6000612f8085828601612ceb565b9250506020612f9185828601612e04565b9150509250929050565b60008060008060408587031215612fb557612fb4613b4d565b5b600085013567ffffffffffffffff811115612fd357612fd2613b48565b5b612fdf87828801612d15565b9450945050602085013567ffffffffffffffff81111561300257613001613b48565b5b61300e87828801612d99565b925092505092959194509250565b60006020828403121561303257613031613b4d565b5b600082013567ffffffffffffffff8111156130505761304f613b48565b5b61305c84828501612d6b565b91505092915050565b60006020828403121561307b5761307a613b4d565b5b600061308984828501612def565b91505092915050565b6000602082840312156130a8576130a7613b4d565b5b60006130b684828501612e04565b91505092915050565b600080604083850312156130d6576130d5613b4d565b5b60006130e485828601612e04565b92505060206130f585828601612e04565b9150509250929050565b60008060006060848603121561311857613117613b4d565b5b600061312686828701612e19565b935050602061313786828701612e19565b925050604061314886828701612e19565b9150509250925092565b600061315e838361316a565b60208301905092915050565b61317381613933565b82525050565b61318281613933565b82525050565b6000613193826137d9565b61319d81856137fc565b93506131a8836137c9565b8060005b838110156131d95781516131c08882613152565b97506131cb836137ef565b9250506001810190506131ac565b5085935050505092915050565b6131ef81613945565b82525050565b6131fe81613988565b82525050565b61320d8161399a565b82525050565b600061321e826137e4565b613228818561380d565b93506132388185602086016139d0565b61324181613b52565b840191505092915050565b600061325960238361380d565b915061326482613b63565b604082019050919050565b600061327c601c8361380d565b915061328782613bb2565b602082019050919050565b600061329f60268361380d565b91506132aa82613bdb565b604082019050919050565b60006132c260228361380d565b91506132cd82613c2a565b604082019050919050565b60006132e560238361380d565b91506132f082613c79565b604082019050919050565b6000613308601e8361380d565b915061331382613cc8565b602082019050919050565b600061332b601b8361380d565b915061333682613cf1565b602082019050919050565b600061334e60268361380d565b915061335982613d1a565b604082019050919050565b600061337160218361380d565b915061337c82613d69565b604082019050919050565b600061339460208361380d565b915061339f82613db8565b602082019050919050565b60006133b760298361380d565b91506133c282613de1565b604082019050919050565b60006133da60258361380d565b91506133e582613e30565b604082019050919050565b60006133fd60238361380d565b915061340882613e7f565b604082019050919050565b600061342060248361380d565b915061342b82613ece565b604082019050919050565b61343f81613971565b82525050565b61344e8161397b565b82525050565b60006020820190506134696000830184613179565b92915050565b600060c0820190506134846000830189613179565b6134916020830188613436565b61349e6040830187613204565b6134ab6060830186613204565b6134b86080830185613179565b6134c560a0830184613436565b979650505050505050565b60006020820190506134e560008301846131e6565b92915050565b600060208201905061350060008301846131f5565b92915050565b600060208201905081810360008301526135208184613213565b905092915050565b600060208201905081810360008301526135418161324c565b9050919050565b600060208201905081810360008301526135618161326f565b9050919050565b6000602082019050818103600083015261358181613292565b9050919050565b600060208201905081810360008301526135a1816132b5565b9050919050565b600060208201905081810360008301526135c1816132d8565b9050919050565b600060208201905081810360008301526135e1816132fb565b9050919050565b600060208201905081810360008301526136018161331e565b9050919050565b6000602082019050818103600083015261362181613341565b9050919050565b6000602082019050818103600083015261364181613364565b9050919050565b6000602082019050818103600083015261366181613387565b9050919050565b60006020820190508181036000830152613681816133aa565b9050919050565b600060208201905081810360008301526136a1816133cd565b9050919050565b600060208201905081810360008301526136c1816133f0565b9050919050565b600060208201905081810360008301526136e181613413565b9050919050565b60006020820190506136fd6000830184613436565b92915050565b600060a0820190506137186000830188613436565b6137256020830187613204565b81810360408301526137378186613188565b90506137466060830185613179565b6137536080830184613436565b9695505050505050565b60006020820190506137726000830184613445565b92915050565b6000613782613793565b905061378e8282613a03565b919050565b6000604051905090565b600067ffffffffffffffff8211156137b8576137b7613b0a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061382982613971565b915061383483613971565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561386957613868613a7d565b5b828201905092915050565b600061387f82613971565b915061388a83613971565b92508261389a57613899613aac565b5b828204905092915050565b60006138b082613971565b91506138bb83613971565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138f4576138f3613a7d565b5b828202905092915050565b600061390a82613971565b915061391583613971565b92508282101561392857613927613a7d565b5b828203905092915050565b600061393e82613951565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613993826139ac565b9050919050565b60006139a582613971565b9050919050565b60006139b7826139be565b9050919050565b60006139c982613951565b9050919050565b60005b838110156139ee5780820151818401526020810190506139d3565b838111156139fd576000848401525b50505050565b613a0c82613b52565b810181811067ffffffffffffffff82111715613a2b57613a2a613b0a565b5b80604052505050565b6000613a3f82613971565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a7257613a71613a7d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f2681613933565b8114613f3157600080fd5b50565b613f3d81613945565b8114613f4857600080fd5b50565b613f5481613971565b8114613f5f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220103e5ef5a0e3708fd68b9bfd2216252396ce7ae623a39ba263f6e687f5f0036164736f6c63430008070033 | {"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"}]}} | 1,511 |
0x4d71c437be3bdcf1e798b173681a47034adfb625 | /**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
// $ForeverBuy
// Telegram: https://t.me/ForeverBuy
// With thanks and major props to the EverRise team!
// Check them out at everrisecoin.com!
// Fair Launch, no Dev Tokens. 100% LP.
// Snipers will be nuked.
// LP Lock immediately on launch.
// Ownership will be renounced 30 minutes after launch.
// Slippage Recommended: 20%+
/**
*
*
*______________________________________________________________
* _
* / ` /
*--_/__-----__---)__----__---------__---)__---/__--------------
* / / ) / ) /___) | / /___) / ) / ) / / / /
*_/______(___/_/_____(___ __|/__(___ _/_____(___/_(___(__(___/_
* /
* (_ /
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 ForeverBuy 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 = "ForeverBuy";
string private constant _symbol = "ForeverBuy";
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 = 30;
}
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d79565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128a3565b61045e565b6040516101789190612d5e565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612efb565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612850565b610490565b6040516101e09190612d5e565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127b6565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612f70565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061292c565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127b6565b610786565b6040516102b19190612efb565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612c90565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612d79565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128a3565b610990565b60405161035b9190612d5e565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128e3565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612986565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612810565b611200565b6040516104189190612efb565b60405180910390f35b60606040518060400160405280600a81526020017f466f726576657242757900000000000000000000000000000000000000000000815250905090565b600061047261046b611287565b848461128f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d84848461145a565b61055e846104a9611287565b6105598560405180606001604052806028815260200161364e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f611287565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b129092919063ffffffff16565b61128f565b600190509392505050565b610571611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612e5b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612e5b565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610755611287565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b76565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c71565b9050919050565b6107df611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612e5b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f466f726576657242757900000000000000000000000000000000000000000000815250905090565b60006109a461099d611287565b848461145a565b6001905092915050565b6109b6611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612e5b565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a676132b8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc90613211565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b19611287565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611cdf565b50565b610b5a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612e5b565b60405180910390fd5b601160149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612edb565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061128f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906127e3565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de291906127e3565b6040518363ffffffff1660e01b8152600401610dff929190612cab565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5191906127e3565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612cfd565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5991906129b3565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cd4565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612959565b5050565b6110bc611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e5b565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e1b565b60405180910390fd5b6111be60646111b0836b033b2e3c9fd0803ce8000000611f6790919063ffffffff16565b611fe290919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f59190612efb565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f690612ebb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136690612ddb565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144d9190612efb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c190612e9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561153a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153190612d9b565b60405180910390fd5b6000811161157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490612e7b565b60405180910390fd5b6005600a81905550600a600b8190555061159561092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160357506115d361092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4f57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ac5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b557600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117605750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117ce5750601160179054906101000a900460ff165b1561187e576012548111156117e257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182d57600080fd5b601e4261183a9190613031565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119295750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611995576005600a81905550601e600b819055505b60006119a030610786565b9050601160159054906101000a900460ff16158015611a0d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a255750601160169054906101000a900460ff165b15611a4d57611a3381611cdf565b60004790506000811115611a4b57611a4a47611b76565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b0057600090505b611b0c8484848461202c565b50505050565b6000838311158290611b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b519190612d79565b60405180910390fd5b5060008385611b699190613112565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bc6600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bf1573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c42600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c6d573d6000803e3d6000fd5b5050565b6000600854821115611cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611caf90612dbb565b60405180910390fd5b6000611cc2612059565b9050611cd78184611fe290919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d1757611d166132e7565b5b604051908082528060200260200182016040528015611d455781602001602082028036833780820191505090505b5090503081600081518110611d5d57611d5c6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dff57600080fd5b505afa158015611e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3791906127e3565b81600181518110611e4b57611e4a6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611eb230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128f565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f16959493929190612f16565b600060405180830381600087803b158015611f3057600080fd5b505af1158015611f44573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f7a5760009050611fdc565b60008284611f8891906130b8565b9050828482611f979190613087565b14611fd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fce90612e3b565b60405180910390fd5b809150505b92915050565b600061202483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612084565b905092915050565b8061203a576120396120e7565b5b61204584848461212a565b80612053576120526122f5565b5b50505050565b6000806000612066612309565b9150915061207d8183611fe290919063ffffffff16565b9250505090565b600080831182906120cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c29190612d79565b60405180910390fd5b50600083856120da9190613087565b9050809150509392505050565b6000600a541480156120fb57506000600b54145b1561210557612128565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061213c87612374565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123dc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612484565b6122858483612541565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612efb565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123456b033b2e3c9fd0803ce8000000600854611fe290919063ffffffff16565b821015612367576008546b033b2e3c9fd0803ce8000000935093505050612370565b81819350935050505b9091565b60008060008060008060008060006123918a600a54600b5461257b565b92509250925060006123a1612059565b905060008060006123b48e878787612611565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061241e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b12565b905092915050565b60008082846124359190613031565b90508381101561247a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247190612dfb565b60405180910390fd5b8091505092915050565b600061248e612059565b905060006124a58284611f6790919063ffffffff16565b90506124f981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612556826008546123dc90919063ffffffff16565b6008819055506125718160095461242690919063ffffffff16565b6009819055505050565b6000806000806125a76064612599888a611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125d160646125c3888b611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125fa826125ec858c6123dc90919063ffffffff16565b6123dc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061262a8589611f6790919063ffffffff16565b905060006126418689611f6790919063ffffffff16565b905060006126588789611f6790919063ffffffff16565b905060006126818261267385876123dc90919063ffffffff16565b6123dc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126ad6126a884612fb0565b612f8b565b905080838252602082019050828560208602820111156126d0576126cf61331b565b5b60005b8581101561270057816126e6888261270a565b8452602084019350602083019250506001810190506126d3565b5050509392505050565b60008135905061271981613608565b92915050565b60008151905061272e81613608565b92915050565b600082601f83011261274957612748613316565b5b813561275984826020860161269a565b91505092915050565b6000813590506127718161361f565b92915050565b6000815190506127868161361f565b92915050565b60008135905061279b81613636565b92915050565b6000815190506127b081613636565b92915050565b6000602082840312156127cc576127cb613325565b5b60006127da8482850161270a565b91505092915050565b6000602082840312156127f9576127f8613325565b5b60006128078482850161271f565b91505092915050565b6000806040838503121561282757612826613325565b5b60006128358582860161270a565b92505060206128468582860161270a565b9150509250929050565b60008060006060848603121561286957612868613325565b5b60006128778682870161270a565b93505060206128888682870161270a565b92505060406128998682870161278c565b9150509250925092565b600080604083850312156128ba576128b9613325565b5b60006128c88582860161270a565b92505060206128d98582860161278c565b9150509250929050565b6000602082840312156128f9576128f8613325565b5b600082013567ffffffffffffffff81111561291757612916613320565b5b61292384828501612734565b91505092915050565b60006020828403121561294257612941613325565b5b600061295084828501612762565b91505092915050565b60006020828403121561296f5761296e613325565b5b600061297d84828501612777565b91505092915050565b60006020828403121561299c5761299b613325565b5b60006129aa8482850161278c565b91505092915050565b6000806000606084860312156129cc576129cb613325565b5b60006129da868287016127a1565b93505060206129eb868287016127a1565b92505060406129fc868287016127a1565b9150509250925092565b6000612a128383612a1e565b60208301905092915050565b612a2781613146565b82525050565b612a3681613146565b82525050565b6000612a4782612fec565b612a51818561300f565b9350612a5c83612fdc565b8060005b83811015612a8d578151612a748882612a06565b9750612a7f83613002565b925050600181019050612a60565b5085935050505092915050565b612aa381613158565b82525050565b612ab28161319b565b82525050565b6000612ac382612ff7565b612acd8185613020565b9350612add8185602086016131ad565b612ae68161332a565b840191505092915050565b6000612afe602383613020565b9150612b098261333b565b604082019050919050565b6000612b21602a83613020565b9150612b2c8261338a565b604082019050919050565b6000612b44602283613020565b9150612b4f826133d9565b604082019050919050565b6000612b67601b83613020565b9150612b7282613428565b602082019050919050565b6000612b8a601d83613020565b9150612b9582613451565b602082019050919050565b6000612bad602183613020565b9150612bb88261347a565b604082019050919050565b6000612bd0602083613020565b9150612bdb826134c9565b602082019050919050565b6000612bf3602983613020565b9150612bfe826134f2565b604082019050919050565b6000612c16602583613020565b9150612c2182613541565b604082019050919050565b6000612c39602483613020565b9150612c4482613590565b604082019050919050565b6000612c5c601783613020565b9150612c67826135df565b602082019050919050565b612c7b81613184565b82525050565b612c8a8161318e565b82525050565b6000602082019050612ca56000830184612a2d565b92915050565b6000604082019050612cc06000830185612a2d565b612ccd6020830184612a2d565b9392505050565b6000604082019050612ce96000830185612a2d565b612cf66020830184612c72565b9392505050565b600060c082019050612d126000830189612a2d565b612d1f6020830188612c72565b612d2c6040830187612aa9565b612d396060830186612aa9565b612d466080830185612a2d565b612d5360a0830184612c72565b979650505050505050565b6000602082019050612d736000830184612a9a565b92915050565b60006020820190508181036000830152612d938184612ab8565b905092915050565b60006020820190508181036000830152612db481612af1565b9050919050565b60006020820190508181036000830152612dd481612b14565b9050919050565b60006020820190508181036000830152612df481612b37565b9050919050565b60006020820190508181036000830152612e1481612b5a565b9050919050565b60006020820190508181036000830152612e3481612b7d565b9050919050565b60006020820190508181036000830152612e5481612ba0565b9050919050565b60006020820190508181036000830152612e7481612bc3565b9050919050565b60006020820190508181036000830152612e9481612be6565b9050919050565b60006020820190508181036000830152612eb481612c09565b9050919050565b60006020820190508181036000830152612ed481612c2c565b9050919050565b60006020820190508181036000830152612ef481612c4f565b9050919050565b6000602082019050612f106000830184612c72565b92915050565b600060a082019050612f2b6000830188612c72565b612f386020830187612aa9565b8181036040830152612f4a8186612a3c565b9050612f596060830185612a2d565b612f666080830184612c72565b9695505050505050565b6000602082019050612f856000830184612c81565b92915050565b6000612f95612fa6565b9050612fa182826131e0565b919050565b6000604051905090565b600067ffffffffffffffff821115612fcb57612fca6132e7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061303c82613184565b915061304783613184565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561307c5761307b61325a565b5b828201905092915050565b600061309282613184565b915061309d83613184565b9250826130ad576130ac613289565b5b828204905092915050565b60006130c382613184565b91506130ce83613184565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131075761310661325a565b5b828202905092915050565b600061311d82613184565b915061312883613184565b92508282101561313b5761313a61325a565b5b828203905092915050565b600061315182613164565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131a682613184565b9050919050565b60005b838110156131cb5780820151818401526020810190506131b0565b838111156131da576000848401525b50505050565b6131e98261332a565b810181811067ffffffffffffffff82111715613208576132076132e7565b5b80604052505050565b600061321c82613184565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561324f5761324e61325a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361181613146565b811461361c57600080fd5b50565b61362881613158565b811461363357600080fd5b50565b61363f81613184565b811461364a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209b97251f8e81920470950d32eaefa54136a885ef7aa0a01941eaa4a590ad0ec464736f6c63430008050033 | {"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"}]}} | 1,512 |
0x6f5c616ccf0f0e434ceb3f17ac5c4b8d53c9aa56 | /**
*Submitted for verification at Etherscan.io on 2021-06-12
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
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 PROGEV2 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ERC20";
string private constant _symbol = "erc20";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public _progeBurned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
address payable private _presa;
address payable private _rogeTreasury;
address public ROGE = 0x45734927Fa2f616FbE19E65f42A0ef3d37d1c80A;
address public animalSanctuary = 0x4A462404ca4b7caE9F639732EB4DaB75d6E88d19;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool public tradeAllowed = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool public swapEnabled = false;
bool private feeEnabled = false;
bool private limitTX = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _reflection = 2;
uint256 private _contractFee = 9;
uint256 private _progeBurn = 1;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_presa = addr1;
_rogeTreasury = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_presa] = true;
_isExcludedFromFee[_rogeTreasury] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setFeeEnabled( bool enable) public onlyOwner {
feeEnabled = enable;
}
function setLimitTx( bool enable) public onlyOwner {
limitTX = enable;
}
function enableTrading( bool enable) public onlyOwner {
require(liquidityAdded);
tradeAllowed = enable;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
liquidityAdded = true;
feeEnabled = true;
limitTX = true;
_maxTxAmount = 1000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualSwapTokensForEth() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualDistributeETH() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
distributeETH(contractETHBalance);
}
function manualRoge(uint amount) external onlyOwner() {
swapETHforRoge(amount);
}
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 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 == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradeAllowed);
if (limitTX) {
require(amount <= _maxTxAmount);
}
_contractFee = 9;
_reflection = 2;
_progeBurn = 1;
uint contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
swapETHforRoge(address(this).balance);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(tradeAllowed);
if (limitTX) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
}
uint initialETHBalance = address(this).balance;
swapTokensForEth(contractTokenBalance);
uint newETHBalance = address(this).balance;
uint ethToDistribute = newETHBalance.sub(initialETHBalance);
if (ethToDistribute > 0) {
distributeETH(ethToDistribute);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || !feeEnabled) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function removeAllFee() private {
if (_reflection == 0 && _contractFee == 0 && _progeBurn == 0) return;
_reflection = 0;
_contractFee = 0;
_progeBurn = 0;
}
function restoreAllFee() private {
_reflection = 2;
_contractFee = 9;
_progeBurn = 1;
}
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 amount) private {
(uint256 tAmount, uint256 tBurn) = _progeEthBurn(amount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount, tBurn);
_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 _progeEthBurn(uint amount) private returns (uint, uint) {
uint orgAmount = amount;
uint256 currentRate = _getRate();
uint256 tBurn = amount.mul(_progeBurn).div(100);
uint256 rBurn = tBurn.mul(currentRate);
_tTotal = _tTotal.sub(tBurn);
_rTotal = _rTotal.sub(rBurn);
_progeBurned = _progeBurned.add(tBurn);
return (orgAmount, tBurn);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount, uint256 tBurn) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _reflection, _contractFee, tBurn);
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, uint256 tBurn) 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).sub(tBurn);
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 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 swapETHforRoge(uint ethAmount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(ROGE);
_approve(address(this), address(uniswapV2Router), ethAmount);
uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(ethAmount,path,address(animalSanctuary),block.timestamp);
}
function distributeETH(uint256 amount) private {
_presa.transfer(amount.div(9));
_rogeTreasury.transfer(amount.div(3));
}
receive() external payable {}
} | 0x60806040526004361061016a5760003560e01c806370a08231116100d1578063a2b174121161008a578063dd62ed3e11610064578063dd62ed3e146104d5578063e8078d9414610510578063f275f64b14610525578063f89ff9021461055157610171565b8063a2b174121461045d578063a9059cbb14610472578063d543dbeb146104ab57610171565b806370a08231146103aa578063715018a6146103dd5780637a32bae4146103f25780637b934dcd146104075780638da5cb5b1461043357806395d89b411461044857610171565b8063313ce56711610123578063313ce5671461031657806332976a251461034157806349abb68e1461035657806349bd5a5e1461036b5780636a66e9e3146103805780636ddd17131461039557610171565b806306fdde0314610176578063095ea7b3146102005780630db474fa1461024d57806310336de01461027b57806318160ddd146102ac57806323b872dd146102d357610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b61057b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c55781810151838201526020016101ad565b50505050905090810190601f1680156101f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020c57600080fd5b506102396004803603604081101561022357600080fd5b506001600160a01b03813516906020013561059a565b604080519115158252519081900360200190f35b34801561025957600080fd5b506102796004803603602081101561027057600080fd5b503515156105b8565b005b34801561028757600080fd5b5061029061062e565b604080516001600160a01b039092168252519081900360200190f35b3480156102b857600080fd5b506102c161063d565b60408051918252519081900360200190f35b3480156102df57600080fd5b50610239600480360360608110156102f657600080fd5b506001600160a01b03813581169160208101359091169060400135610643565b34801561032257600080fd5b5061032b6106ca565b6040805160ff9092168252519081900360200190f35b34801561034d57600080fd5b506102c16106cf565b34801561036257600080fd5b506102906106d5565b34801561037757600080fd5b506102906106e4565b34801561038c57600080fd5b506102796106f3565b3480156103a157600080fd5b50610239610758565b3480156103b657600080fd5b506102c1600480360360208110156103cd57600080fd5b50356001600160a01b0316610768565b3480156103e957600080fd5b5061027961078a565b3480156103fe57600080fd5b5061023961082c565b34801561041357600080fd5b506102796004803603602081101561042a57600080fd5b5035151561083c565b34801561043f57600080fd5b506102906108b2565b34801561045457600080fd5b5061018b6108c1565b34801561046957600080fd5b506102796108e0565b34801561047e57600080fd5b506102396004803603604081101561049557600080fd5b506001600160a01b03813516906020013561094e565b3480156104b757600080fd5b50610279600480360360208110156104ce57600080fd5b5035610962565b3480156104e157600080fd5b506102c1600480360360408110156104f857600080fd5b506001600160a01b0381358116916020013516610a69565b34801561051c57600080fd5b50610279610a94565b34801561053157600080fd5b506102796004803603602081101561054857600080fd5b50351515610e34565b34801561055d57600080fd5b506102796004803603602081101561057457600080fd5b5035610ec0565b604080518082019091526005815264045524332360dc1b602082015290565b60006105ae6105a7610f21565b8484610f25565b5060015b92915050565b6105c0610f21565b6000546001600160a01b03908116911614610610576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600f8054911515600160c01b0260ff60c01b19909216919091179055565b600c546001600160a01b031681565b60045490565b6000610650848484611011565b6106c08461065c610f21565b6106bb85604051806060016040528060288152602001611e23602891396001600160a01b038a1660009081526008602052604081209061069a610f21565b6001600160a01b031681526020810191909152604001600020549190611329565b610f25565b5060019392505050565b600990565b60075481565b600d546001600160a01b031681565b600f546001600160a01b031681565b6106fb610f21565b6000546001600160a01b0390811691161461074b576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b47610755816113c0565b50565b600f54600160b81b900460ff1681565b6001600160a01b0381166000908152600260205260408120546105b290611449565b610792610f21565b6000546001600160a01b039081169116146107e2576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600f54600160a01b900460ff1681565b610844610f21565b6000546001600160a01b03908116911614610894576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600f8054911515600160c81b0260ff60c81b19909216919091179055565b6000546001600160a01b031690565b604080518082019091526005815264065726332360dc1b602082015290565b6108e8610f21565b6000546001600160a01b03908116911614610938576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600061094330610768565b9050610755816114a9565b60006105ae61095b610f21565b8484611011565b61096a610f21565b6000546001600160a01b039081169116146109ba576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b60008111610a0f576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610a2f6064610a298360045461167890919063ffffffff16565b906116d1565b601081905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b610a9c610f21565b6000546001600160a01b03908116911614610aec576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117918290556004549091610b309130916001600160a01b031690610f25565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6957600080fd5b505afa158015610b7d573d6000803e3d6000fd5b505050506040513d6020811015610b9357600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610be357600080fd5b505afa158015610bf7573d6000803e3d6000fd5b505050506040513d6020811015610c0d57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610c5f57600080fd5b505af1158015610c73573d6000803e3d6000fd5b505050506040513d6020811015610c8957600080fd5b5051600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610cbb81610768565b600080610cc66108b2565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610d3157600080fd5b505af1158015610d45573d6000803e3d6000fd5b50505050506040513d6060811015610d5c57600080fd5b5050600f805460ff60c81b1960ff60c01b1960ff60a81b1960ff60b81b19909316600160b81b1792909216600160a81b1791909116600160c01b1716600160c81b1790819055670de0b6b3a7640000601055600e546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610e0557600080fd5b505af1158015610e19573d6000803e3d6000fd5b505050506040513d6020811015610e2f57600080fd5b505050565b610e3c610f21565b6000546001600160a01b03908116911614610e8c576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b600f54600160a81b900460ff16610ea257600080fd5b600f8054911515600160a01b0260ff60a01b19909216919091179055565b610ec8610f21565b6000546001600160a01b03908116911614610f18576040805162461bcd60e51b81526020600482018190526024820152600080516020611e4b833981519152604482015290519081900360640190fd5b61075581611713565b3390565b6001600160a01b038316610f6a5760405162461bcd60e51b8152600401808060200182810382526024815260200180611eb96024913960400191505060405180910390fd5b6001600160a01b038216610faf5760405162461bcd60e51b8152600401808060200182810382526022815260200180611de06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260086020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166110565760405162461bcd60e51b8152600401808060200182810382526025815260200180611e946025913960400191505060405180910390fd5b6001600160a01b03821661109b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611d936023913960400191505060405180910390fd5b600081116110da5760405162461bcd60e51b8152600401808060200182810382526029815260200180611e6b6029913960400191505060405180910390fd5b6110e26108b2565b6001600160a01b0316836001600160a01b03161415801561111c57506111066108b2565b6001600160a01b0316826001600160a01b031614155b156112b757600f546001600160a01b03848116911614801561114c5750600e546001600160a01b03838116911614155b801561117157506001600160a01b03821660009081526009602052604090205460ff16155b156111ce57600f54600160a01b900460ff1661118c57600080fd5b600f54600160c81b900460ff16156111ad576010548111156111ad57600080fd5b6009601255600260115560016013554780156111cc576111cc47611713565b505b60006111d930610768565b600f54909150600160b01b900460ff161580156112045750600f546001600160a01b03858116911614155b80156112195750600f54600160b81b900460ff165b156112b557600f54600160a01b900460ff1661123457600080fd5b600f54600160c81b900460ff161561128957600f5461126f90606490610a2990600390611269906001600160a01b0316610768565b90611678565b821115801561128057506010548211155b61128957600080fd5b47611293826114a9565b4760006112a082846118cc565b905080156112b1576112b1816113c0565b5050505b505b6001600160a01b03831660009081526009602052604090205460019060ff16806112f957506001600160a01b03831660009081526009602052604090205460ff165b8061130e5750600f54600160c01b900460ff16155b15611317575060005b6113238484848461190e565b50505050565b600081848411156113b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561137d578181015183820152602001611365565b50505050905090810190601f1680156113aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600a546001600160a01b03166108fc6113da8360096116d1565b6040518115909202916000818181858888f19350505050158015611402573d6000803e3d6000fd5b50600b546001600160a01b03166108fc61141d8360036116d1565b6040518115909202916000818181858888f19350505050158015611445573d6000803e3d6000fd5b5050565b600060055482111561148c5760405162461bcd60e51b815260040180806020018281038252602a815260200180611db6602a913960400191505060405180910390fd5b600061149661193f565b90506114a283826116d1565b9392505050565b600f805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114eb57fe5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561153f57600080fd5b505afa158015611553573d6000803e3d6000fd5b505050506040513d602081101561156957600080fd5b505181518290600190811061157a57fe5b6001600160a01b039283166020918202929092010152600e546115a09130911684610f25565b600e5460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561162657818101518382015260200161160e565b505050509050019650505050505050600060405180830381600087803b15801561164f57600080fd5b505af1158015611663573d6000803e3d6000fd5b5050600f805460ff60b01b1916905550505050565b600082611687575060006105b2565b8282028284828161169457fe5b04146114a25760405162461bcd60e51b8152600401808060200182810382526021815260200180611e026021913960400191505060405180910390fd5b60006114a283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611962565b6040805160028082526060820183526000926020830190803683375050600e54604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b15801561177857600080fd5b505afa15801561178c573d6000803e3d6000fd5b505050506040513d60208110156117a257600080fd5b5051815182906000906117b157fe5b6001600160a01b039283166020918202929092010152600c548251911690829060019081106117dc57fe5b6001600160a01b039283166020918202929092010152600e546118029130911684610f25565b600e54600d5460405163b6f9de9560e01b8152600481018581526001600160a01b03928316604483018190524260648401819052608060248501908152875160848601528751959096169563b6f9de9595899586958a9594939092909160a401906020808801910280838360005b83811015611888578181015183820152602001611870565b50505050905001955050505050506000604051808303818588803b1580156118af57600080fd5b505af11580156118c3573d6000803e3d6000fd5b50505050505050565b60006114a283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611329565b8061191b5761191b6119c7565b6119268484846119ff565b8061132357611323600260115560096012556001601355565b600080600061194c611b19565b909250905061195b82826116d1565b9250505090565b600081836119b15760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561137d578181015183820152602001611365565b5060008385816119bd57fe5b0495945050505050565b6011541580156119d75750601254155b80156119e35750601354155b156119ed576119fd565b6000601181905560128190556013555b565b600080611a0b83611b50565b91509150600080600080600080611a228888611bc9565b955095509550955095509550611a6686600260008e6001600160a01b03166001600160a01b03168152602001908152602001600020546118cc90919063ffffffff16565b6001600160a01b03808d1660009081526002602052604080822093909355908c1681522054611a959086611c28565b6001600160a01b038b16600090815260026020526040902055611ab781611c82565b611ac18483611ccc565b896001600160a01b03168b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505050505050505050565b6005546004546000918291611b2e82826116d1565b821015611b4657600554600454935093505050611b4c565b90925090505b9091565b6000808281611b5d61193f565b90506000611b7b6064610a296013548961167890919063ffffffff16565b90506000611b898284611678565b600454909150611b9990836118cc565b600455600554611ba990826118cc565b600555600754611bb99083611c28565b6007555091935090915050915091565b6000806000806000806000806000611be78b6011546012548d611cf0565b9250925092506000611bf761193f565b90506000806000611c0a8f878787611d42565b919e509c509a50959850939650919450505050509295509295509295565b6000828201838110156114a2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611c8c61193f565b90506000611c9a8383611678565b30600090815260026020526040902054909150611cb79082611c28565b30600090815260026020526040902055505050565b600554611cd990836118cc565b600555600654611ce99082611c28565b6006555050565b6000808080611d046064610a298a8a611678565b90506000611d176064610a298b8a611678565b90506000611d3187611d2b84818e886118cc565b906118cc565b9a9299509097509095505050505050565b6000808080611d518886611678565b90506000611d5f8887611678565b90506000611d6d8888611678565b90506000611d7f82611d2b86866118cc565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220907746e3d4e6364ff1cff21e1e013281702dbe7d7daf81467b4b32355fc91fca64736f6c63430007060033 | {"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"}]}} | 1,513 |
0x24230cac1a176a2bf6d3270e49f505a21f17d991 | pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 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: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
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: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
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;
}
}
// File: contracts/Energon.sol
//Owner 0xa355cf3BEA0ECC6735F7Cd5eAEa405E0130F81BF
contract Energon is MintableToken {
string public name = "Energon Token";
string public symbol = "ENRG";
uint8 public decimals = 18;
uint256 public maxSupply = 1000000000 * 10 ** uint256(decimals); //Maxim Supply is 1 Billion tokens
modifier canMint() {
require(!mintingFinished);
require(totalSupply_< maxSupply);
_;
}
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100f557806306fdde031461011e578063095ea7b3146101a857806318160ddd146101cc57806323b872dd146101f3578063313ce5671461021d57806340c10f1914610248578063661884631461026c57806370a08231146102905780637d64bcb4146102b15780638da5cb5b146102c657806395d89b41146102f7578063a9059cbb1461030c578063d5abeb0114610330578063d73dd62314610345578063dd62ed3e14610369578063f2fde38b14610390575b600080fd5b34801561010157600080fd5b5061010a6103b3565b604080519115158252519081900360200190f35b34801561012a57600080fd5b506101336103d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016d578181015183820152602001610155565b50505050905090810190601f16801561019a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b457600080fd5b5061010a600160a060020a0360043516602435610462565b3480156101d857600080fd5b506101e16104c8565b60408051918252519081900360200190f35b3480156101ff57600080fd5b5061010a600160a060020a03600435811690602435166044356104ce565b34801561022957600080fd5b50610232610645565b6040805160ff9092168252519081900360200190f35b34801561025457600080fd5b5061010a600160a060020a036004351660243561064e565b34801561027857600080fd5b5061010a600160a060020a0360043516602435610779565b34801561029c57600080fd5b506101e1600160a060020a0360043516610869565b3480156102bd57600080fd5b5061010a610884565b3480156102d257600080fd5b506102db61093a565b60408051600160a060020a039092168252519081900360200190f35b34801561030357600080fd5b50610133610949565b34801561031857600080fd5b5061010a600160a060020a03600435166024356109a4565b34801561033c57600080fd5b506101e1610a85565b34801561035157600080fd5b5061010a600160a060020a0360043516602435610a8b565b34801561037557600080fd5b506101e1600160a060020a0360043581169060243516610b24565b34801561039c57600080fd5b506103b1600160a060020a0360043516610b4f565b005b60035474010000000000000000000000000000000000000000900460ff1681565b6004805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561045a5780601f1061042f5761010080835404028352916020019161045a565b820191906000526020600020905b81548152906001019060200180831161043d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a03831615156104e557600080fd5b600160a060020a03841660009081526020819052604090205482111561050a57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561053a57600080fd5b600160a060020a038416600090815260208190526040902054610563908363ffffffff610be416565b600160a060020a038086166000908152602081905260408082209390935590851681522054610598908363ffffffff610bf616565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546105da908363ffffffff610be416565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60065460ff1681565b600354600090600160a060020a0316331461066857600080fd5b60035474010000000000000000000000000000000000000000900460ff161561069057600080fd5b600754600154106106a057600080fd5b6001546106b3908363ffffffff610bf616565b600155600160a060020a0383166000908152602081905260409020546106df908363ffffffff610bf616565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156107ce57336000908152600260209081526040808320600160a060020a0388168452909152812055610803565b6107de818463ffffffff610be416565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600090600160a060020a0316331461089e57600080fd5b60035474010000000000000000000000000000000000000000900460ff16156108c657600080fd5b600754600154106108d657600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561045a5780601f1061042f5761010080835404028352916020019161045a565b6000600160a060020a03831615156109bb57600080fd5b336000908152602081905260409020548211156109d757600080fd5b336000908152602081905260409020546109f7908363ffffffff610be416565b3360009081526020819052604080822092909255600160a060020a03851681522054610a29908363ffffffff610bf616565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60075481565b336000908152600260209081526040808320600160a060020a0386168452909152812054610abf908363ffffffff610bf616565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610b6657600080fd5b600160a060020a0381161515610b7b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610bf057fe5b50900390565b81810182811015610c0357fe5b929150505600a165627a7a72305820247ba41dc1efb218e1bd028ddee7b06278faa39ab5e0c260fb62ea94935b192b0029 | {"success": true, "error": null, "results": {}} | 1,514 |
0x85ff3b686fd483e1b5a5726a87eb55847ee0f601 | /**
*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 Pool3 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 = 500000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "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;
}
} | 0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636654ffdf11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b80639d76ea58116100de5780639d76ea58146103ac578063a89c8c5e146103b4578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636654ffdf146103665780636a395ccb1461036e5780637b0a47ee146103a4576101cf565b8063455ab53c11610171578063538a85a11161014b578063538a85a1146102f5578063583d42fd146103125780635ef057be146103385780636270cd1814610340576101cf565b8063455ab53c146102c85780634641257d146102d05780634908e386146102d8576101cf565b80632ec14e85116101ad5780632ec14e851461025c578063308feec31461028057806337c5785a1461028857806338443177146102ab576101cf565b8063069ca4d0146101d45780631c885bae146102055780631e94723f14610224575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b6102226004803603602081101561021b57600080fd5b50356104d9565b005b61024a6004803603602081101561023a57600080fd5b50356001600160a01b03166107e4565b60408051918252519081900360200190f35b610264610897565b604080516001600160a01b039092168252519081900360200190f35b61024a6108a6565b6101f16004803603604081101561029e57600080fd5b50803590602001356108b8565b6101f1600480360360208110156102c157600080fd5b50356108dc565b6101f16108fd565b610222610906565b6101f1600480360360208110156102ee57600080fd5b5035610911565b6102226004803603602081101561030b57600080fd5b5035610932565b61024a6004803603602081101561032857600080fd5b50356001600160a01b0316610c27565b61024a610c39565b61024a6004803603602081101561035657600080fd5b50356001600160a01b0316610c3f565b61024a610c51565b6102226004803603606081101561038457600080fd5b506001600160a01b03813581169160208101359091169060400135610c57565b61024a610d31565b610264610d37565b6101f1600480360360408110156103ca57600080fd5b506001600160a01b0381358116916020013516610d46565b61024a610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61024a6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61024a610e25565b61024a610e2b565b61024a610e31565b6102226004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61024a600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610264610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b336000908152600d602052604090205481111561053d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e602052604090205461055b904290610f97565b116105975760405162461bcd60e51b815260040180806020018281038252603b815260200180611304603b913960400191505060405180910390fd5b6105a033610fae565b60006105c36127106105bd6006548561114290919063ffffffff16565b90611169565b905060006105d18383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d602081101561065757600080fd5b50516106aa576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156106fe57600080fd5b505af1158015610712573d6000803e3d6000fd5b505050506040513d602081101561072857600080fd5b505161077b576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546107959084610f97565b336000818152600d60205260409020919091556107b490600b9061117e565b80156107cd5750336000908152600d6020526040902054155b156107df576107dd600b33611193565b505b505050565b60006107f1600b8361117e565b6107fd57506000610892565b6001600160a01b0382166000908152600d602052604090205461082257506000610892565b6001600160a01b0382166000908152600f6020526040812054610846904290610f97565b6001600160a01b0384166000908152600d6020526040812054600454600354939450909261088c91612710916105bd919082908890610886908990611142565b90611142565b93505050505b919050565b6002546001600160a01b031681565b60006108b2600b6111a8565b90505b90565b600080546001600160a01b031633146108d057600080fd5b60059290925560065590565b600080546001600160a01b031633146108f457600080fd5b60099190915590565b600a5460ff1681565b61090f33610fae565b565b600080546001600160a01b0316331461092957600080fd5b60039190915590565b600a5460ff16151560011461098e576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b600081116109e3576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a3d57600080fd5b505af1158015610a51573d6000803e3d6000fd5b505050506040513d6020811015610a6757600080fd5b5051610aba576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610ac333610fae565b6000610ae06127106105bd6005548561114290919063ffffffff16565b90506000610aee8383610f97565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610b4a57600080fd5b505af1158015610b5e573d6000803e3d6000fd5b505050506040513d6020811015610b7457600080fd5b5051610bc7576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610be190826111b3565b336000818152600d6020526040902091909155610c0090600b9061117e565b6107df57610c0f600b336111c2565b50336000908152600e60205260409020429055505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b03163314610c6e57600080fd5b6001546001600160a01b0384811691161415610ca957610c8c610e31565b811115610c9857600080fd5b600854610ca590826111b3565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d0057600080fd5b505af1158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610d5e57600080fd5b6001600160a01b03831615801590610d7e57506001600160a01b03821615155b610db95760405162461bcd60e51b815260040180806020018281038252602a815260200180611372602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006108b5565b6000610e5f600854600954610f9790919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133f6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b600082821115610fa357fe5b508082035b92915050565b6000610fb9826107e4565b90508015611125576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561101757600080fd5b505af115801561102b573d6000803e3d6000fd5b505050506040513d602081101561104157600080fd5b5051611094576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152601060205260409020546110b790826111b3565b6001600160a01b0383166000908152601060205260409020556008546110dd90826111b3565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b600082820283158061115c57508284828161115957fe5b04145b61116257fe5b9392505050565b60008082848161117557fe5b04949350505050565b6000611162836001600160a01b0384166111d7565b6000611162836001600160a01b0384166111ef565b6000610fa8826112b5565b60008282018381101561116257fe5b6000611162836001600160a01b0384166112b9565b60009081526001919091016020526040902054151590565b600081815260018301602052604081205480156112ab578354600019808301919081019060009087908390811061122257fe5b906000526020600020015490508087600001848154811061123f57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061126f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610fa8565b6000915050610fa8565b5490565b60006112c583836111d7565b6112fb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fa8565b506000610fa856fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a264697066735822122011f9e3629fb59db68584773c05f7c5fe9d6edd60f46ec629bc7c998f0d52b50764736f6c634300060c0033 | {"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"}]}} | 1,515 |
0xabF56234a7084f37FCe0689E6c01ea639911841F | // 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;
}
}
//
/**
* @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 VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,516 |
0x9823e0070773b249e981065e5ed76190bf6c843e | 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 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 SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract CopaMarket is Ownable, Pausable {
using SafeMath for uint256;
CopaCore private copaCore;
uint256 private lockedEth;
uint256 public cut;
uint256 public tradingFee;
bool private secureFees;
struct Buy {
uint256 cardId;
uint256 count;
uint256 ethAmount;
bool open;
}
mapping(address => Buy[]) private buyers;
struct Sell {
uint256 cardId;
uint256 count;
uint256 ethAmount;
bool open;
}
mapping(address => Sell[]) private sellers;
struct Trade {
uint256[] offeredCardIds;
uint256[] offeredCardCounts;
uint256[] requestedCardIds;
uint256[] requestedCardCounts;
bool open;
}
mapping(address => Trade[]) private traders;
event NewBuy(address indexed buyer, uint256 indexed id, uint256 cardId, uint256 count, uint256 ethAmount);
event CardSold(address indexed buyer, uint256 indexed id, address indexed seller, uint256 cardId, uint256 count, uint256 ethAmount);
event CancelBuy(address indexed buyer, uint256 indexed id, uint256 cardId, uint256 count, uint256 ethAmount);
event NewSell(address indexed seller, uint256 indexed id, uint256 cardId, uint256 count, uint256 ethAmount);
event CardBought(address indexed seller, uint256 indexed id, address indexed buyer, uint256 cardId, uint256 count, uint256 ethAmount);
event CancelSell(address indexed seller, uint256 indexed id, uint256 cardId, uint256 count, uint256 ethAmount);
event NewTrade(address indexed seller, uint256 indexed id, uint256[] offeredCardIds, uint256[] offeredCardCounts, uint256[] requestedCardIds, uint256[] requestedCardCounts);
event CardsTraded(address indexed seller, uint256 indexed id, address indexed buyer, uint256[] offeredCardIds, uint256[] offeredCardCounts, uint256[] requestedCardIds, uint256[] requestedCardCounts);
event CancelTrade(address indexed seller, uint256 indexed id, uint256[] offeredCardIds, uint256[] offeredCardCounts, uint256[] requestedCardIds, uint256[] requestedCardCounts);
constructor(address _copaCoreAddress, uint256 _cut, uint256 _tradingFee, bool _secureFees) public {
copaCore = CopaCore(_copaCoreAddress);
cut = _cut;
tradingFee = _tradingFee;
secureFees = _secureFees;
lockedEth = 0;
}
function getCopaCoreAddress() view external onlyOwner returns (address) {
return address(copaCore);
}
function setCopaCoreAddress(address _copaCoreAddress) external onlyOwner {
copaCore = CopaCore(_copaCoreAddress);
}
function setCut(uint256 _cut) external onlyOwner {
require(_cut > 0);
require(_cut < 10000);
cut = _cut;
}
function setTradingFee(uint256 _tradingFee) external onlyOwner {
require(_tradingFee > 0);
tradingFee = _tradingFee;
}
function getSecureFees() view external onlyOwner returns (bool) {
return secureFees;
}
function setSecureFees(bool _secureFees) external onlyOwner {
secureFees = _secureFees;
}
function getLockedEth() view external onlyOwner returns (uint256) {
return lockedEth;
}
function getEthBalance() view external returns (uint256) {
return address(this).balance;
}
function withdrawEthBalanceSave() external onlyOwner {
uint256 _ethBalance = address(this).balance;
owner.transfer(_ethBalance - lockedEth);
}
function withdrawEthBalance() external onlyOwner {
uint256 _ethBalance = address(this).balance;
owner.transfer(_ethBalance);
}
function getBuy(uint256 _id, address _address) view external returns (uint256, uint256, uint256, bool){
return (buyers[_address][_id].cardId, buyers[_address][_id].count, buyers[_address][_id].ethAmount, buyers[_address][_id].open);
}
function getSell(uint256 _id, address _address) view external returns (uint256, uint256, uint256, bool){
return (sellers[_address][_id].cardId, sellers[_address][_id].count, sellers[_address][_id].ethAmount, sellers[_address][_id].open);
}
function getTrade(uint256 _id, address _address) view external returns (uint256[], uint256[], uint256[], uint256[], bool){
return (traders[_address][_id].offeredCardIds, traders[_address][_id].offeredCardCounts, traders[_address][_id].requestedCardIds, traders[_address][_id].requestedCardCounts, traders[_address][_id].open);
}
function addToBuyList(uint256 _cardId, uint256 _count) external payable whenNotPaused returns (bool) {
address _buyer = msg.sender;
uint256 _ethAmount = msg.value;
require(_ethAmount > 0);
require(_count > 0);
uint256 _id = buyers[_buyer].length;
buyers[_buyer].push(Buy(_cardId, _count, _ethAmount, true));
lockedEth += _ethAmount;
emit NewBuy(_buyer, _id, _cardId, _count, _ethAmount);
return true;
}
function sellCard(address _buyer, uint256 _id, uint256 _cardId, uint256 _count, uint256 _ethAmount) external whenNotPaused returns (bool) {
address _seller = msg.sender;
uint256 _cut = 10000 - cut;
uint256 _ethAmountAfterCut = (_ethAmount * _cut) / 10000;
uint256 _fee = _ethAmount - _ethAmountAfterCut;
require(buyers[_buyer][_id].open == true);
require(buyers[_buyer][_id].cardId == _cardId);
require(buyers[_buyer][_id].count == _count);
require(buyers[_buyer][_id].ethAmount == _ethAmount);
buyers[_buyer][_id].open = false;
lockedEth -= _ethAmount;
copaCore.transferFrom(_seller, _buyer, _cardId, _count);
_seller.transfer(_ethAmountAfterCut);
if (secureFees) {
owner.transfer(_fee);
}
emit CardSold(_buyer, _id, _seller, _cardId, _count, _ethAmount);
return true;
}
function cancelBuy(uint256 _id, uint256 _cardId, uint256 _count, uint256 _ethAmount) external whenNotPaused returns (bool) {
address _buyer = msg.sender;
require(buyers[_buyer][_id].open == true);
require(buyers[_buyer][_id].cardId == _cardId);
require(buyers[_buyer][_id].count == _count);
require(buyers[_buyer][_id].ethAmount == _ethAmount);
lockedEth -= _ethAmount;
buyers[_buyer][_id].open = false;
_buyer.transfer(_ethAmount);
emit CancelBuy(_buyer, _id, _cardId, _count, _ethAmount);
return true;
}
function addToSellList(uint256 _cardId, uint256 _count, uint256 _ethAmount) external whenNotPaused returns (bool) {
address _seller = msg.sender;
require(_ethAmount > 0);
require(_count > 0);
uint256 _id = sellers[_seller].length;
sellers[_seller].push(Sell(_cardId, _count, _ethAmount, true));
copaCore.transferFrom(_seller, address(this), _cardId, _count);
emit NewSell(_seller, _id, _cardId, _count, _ethAmount);
return true;
}
function buyCard(address _seller, uint256 _id, uint256 _cardId, uint256 _count) external payable whenNotPaused returns (bool) {
address _buyer = msg.sender;
uint256 _ethAmount = msg.value;
uint256 _cut = 10000 - cut;
uint256 _ethAmountAfterCut = (_ethAmount * _cut) / 10000;
uint256 _fee = _ethAmount - _ethAmountAfterCut;
require(sellers[_seller][_id].open == true);
require(sellers[_seller][_id].cardId == _cardId);
require(sellers[_seller][_id].count == _count);
require(sellers[_seller][_id].ethAmount <= _ethAmount);
sellers[_seller][_id].open = false;
copaCore.transfer(_buyer, _cardId, _count);
_seller.transfer(_ethAmountAfterCut);
if (secureFees) {
owner.transfer(_fee);
}
emit CardBought(_seller, _id, _buyer, _cardId, _count, _ethAmount);
return true;
}
function cancelSell(uint256 _id, uint256 _cardId, uint256 _count, uint256 _ethAmount) external whenNotPaused returns (bool) {
address _seller = msg.sender;
require(sellers[_seller][_id].open == true);
require(sellers[_seller][_id].cardId == _cardId);
require(sellers[_seller][_id].count == _count);
require(sellers[_seller][_id].ethAmount == _ethAmount);
sellers[_seller][_id].open = false;
copaCore.transfer(_seller, _cardId, _count);
emit CancelSell(_seller, _id, _cardId, _count, _ethAmount);
return true;
}
function addToTradeList(uint256[] _offeredCardIds, uint256[] _offeredCardCounts, uint256[] _requestedCardIds, uint256[] _requestedCardCounts) external whenNotPaused returns (bool) {
address _seller = msg.sender;
require(_offeredCardIds.length > 0);
require(_offeredCardCounts.length > 0);
require(_requestedCardIds.length > 0);
require(_requestedCardCounts.length > 0);
uint256 _id = traders[_seller].length;
traders[_seller].push(Trade(_offeredCardIds, _offeredCardCounts, _requestedCardIds, _requestedCardCounts, true));
for (uint256 i = 0; i < _offeredCardIds.length; i++) {
copaCore.transferFrom(_seller, address(this), _offeredCardIds[i], _offeredCardCounts[i]);
}
emit NewTrade(_seller, _id, _offeredCardIds, _offeredCardCounts, _requestedCardIds, _requestedCardCounts);
return true;
}
function tradeCards(address _seller, uint256 _id) external payable whenNotPaused returns (bool) {
address _buyer = msg.sender;
uint256 _ethAmount = msg.value;
uint256[] memory _offeredCardIds = traders[_seller][_id].offeredCardIds;
uint256[] memory _offeredCardCounts = traders[_seller][_id].offeredCardCounts;
uint256[] memory _requestedCardIds = traders[_seller][_id].requestedCardIds;
uint256[] memory _requestedCardCounts = traders[_seller][_id].requestedCardCounts;
require(traders[_seller][_id].open == true);
require(_ethAmount >= tradingFee);
traders[_seller][_id].open = false;
for (uint256 i = 0; i < _offeredCardIds.length; i++) {
copaCore.transfer(_buyer, _offeredCardIds[i], _offeredCardCounts[i]);
}
for (uint256 j = 0; j < _requestedCardIds.length; j++) {
copaCore.transferFrom(_buyer, _seller, _requestedCardIds[j], _requestedCardCounts[j]);
}
if (secureFees) {
owner.transfer(_ethAmount);
}
emit CardsTraded(_seller, _id, _buyer, _offeredCardIds, _offeredCardCounts, _requestedCardIds, _requestedCardCounts);
return true;
}
function cancelTrade(uint256 _id) external whenNotPaused returns (bool) {
address _seller = msg.sender;
uint256[] memory _offeredCardIds = traders[_seller][_id].offeredCardIds;
uint256[] memory _offeredCardCounts = traders[_seller][_id].offeredCardCounts;
uint256[] memory _requestedCardIds = traders[_seller][_id].requestedCardIds;
uint256[] memory _requestedCardCounts = traders[_seller][_id].requestedCardCounts;
require(traders[_seller][_id].open == true);
traders[_seller][_id].open = false;
for (uint256 i = 0; i < _offeredCardIds.length; i++) {
copaCore.transfer(_seller, _offeredCardIds[i], _offeredCardCounts[i]);
}
emit CancelTrade(_seller, _id, _offeredCardIds, _offeredCardCounts, _requestedCardIds, _requestedCardCounts);
return true;
}
}
contract CopaCore is Ownable, Pausable {
using SafeMath for uint256;
CopaMarket private copaMarket;
uint256 public packSize;
uint256 public packPrice;
uint256 public totalCardCount;
mapping(address => uint256[1200]) public balances;
struct PackBuy {
uint256 packSize;
uint256 packPrice;
uint256[] cardIds;
}
mapping(address => PackBuy[]) private packBuys;
event Transfer(address indexed from, address indexed to, uint256 indexed cardId, uint256 count);
event TransferManual(address indexed from, address indexed to, uint256[] cardIds, uint256[] counts);
event BuyPack(uint256 indexed id, address indexed buyer, uint256 packSize, uint256 packPrice, uint256[] cardIds);
event BuyPacks(uint256 indexed id, address indexed buyer, uint256 packSize, uint256 packPrice, uint256 count);
constructor(uint256 _packSize, uint256 _packPrice, uint256 _totalCardCount) public {
packSize = _packSize;
packPrice = _packPrice;
totalCardCount = _totalCardCount;
}
function getCopaMarketAddress() view external onlyOwner returns (address) {
return address(copaMarket);
}
function setCopaMarketAddress(address _copaMarketAddress) external onlyOwner {
copaMarket = CopaMarket(_copaMarketAddress);
}
modifier onlyCopaMarket() {
require(msg.sender == address(copaMarket));
_;
}
function setPackSize(uint256 _packSize) external onlyOwner {
require(_packSize > 0);
packSize = _packSize;
}
function setPrice(uint256 _packPrice) external onlyOwner {
require(_packPrice > 0);
packPrice = _packPrice;
}
function setTotalCardCount(uint256 _totalCardCount) external onlyOwner {
require(_totalCardCount > 0);
totalCardCount = _totalCardCount;
}
function getEthBalance() view external returns (uint256) {
return address(this).balance;
}
function withdrawEthBalance() external onlyOwner {
uint256 _ethBalance = address(this).balance;
owner.transfer(_ethBalance);
}
function balanceOf(address _owner, uint256 _cardId) view external returns (uint256) {
return balances[_owner][_cardId];
}
function balancesOf(address _owner) view external returns (uint256[1200]) {
return balances[_owner];
}
function getPackBuy(address _address, uint256 _id) view external returns (uint256, uint256, uint256[]){
return (packBuys[_address][_id].packSize, packBuys[_address][_id].packPrice, packBuys[_address][_id].cardIds);
}
function transfer(address _to, uint256 _cardId, uint256 _count) external whenNotPaused returns (bool) {
address _from = msg.sender;
require(_to != address(0));
require(_count > 0);
require(_count <= balances[_from][_cardId]);
balances[_from][_cardId] = balances[_from][_cardId].sub(_count);
balances[_to][_cardId] = balances[_to][_cardId].add(_count);
emit Transfer(_from, _to, _cardId, _count);
return true;
}
function transferMultiple(address _to, uint256[] _cardIds, uint256[] _counts) external whenNotPaused returns (bool) {
address _from = msg.sender;
require(_to != address(0));
for (uint256 i = 0; i < _cardIds.length; i++) {
uint256 _cardId = _cardIds[i];
uint256 _count = _counts[i];
require(_count > 0);
require(_count <= balances[_from][_cardId]);
balances[_from][_cardId] = balances[_from][_cardId].sub(_count);
balances[_to][_cardId] = balances[_to][_cardId].add(_count);
emit Transfer(_from, _to, _cardId, _count);
}
emit TransferManual(_from, _to, _cardIds, _counts);
return true;
}
function transferFrom(address _from, address _to, uint256 _cardId, uint256 _count) external onlyCopaMarket returns (bool) {
require(_to != address(0));
require(_count > 0);
require(_count <= balances[_from][_cardId]);
balances[_from][_cardId] = balances[_from][_cardId].sub(_count);
balances[_to][_cardId] = balances[_to][_cardId].add(_count);
emit Transfer(_from, _to, _cardId, _count);
return true;
}
function buyPack(uint256 _count) external payable whenNotPaused returns (bool) {
address _buyer = msg.sender;
uint256 _ethAmount = msg.value;
uint256 _totalPrice = packPrice * _count;
require(_count > 0);
require(_ethAmount > 0);
require(_ethAmount >= _totalPrice);
for (uint256 i = 0; i < _count; i++) {
uint256[] memory _cardsList = new uint256[](packSize);
for (uint256 j = 0; j < packSize; j++) {
uint256 _cardId = dice(totalCardCount);
balances[_buyer][_cardId] = balances[_buyer][_cardId].add(1);
_cardsList[j] = _cardId;
emit Transfer(0x0, _buyer, _cardId, 1);
}
uint256 _id = packBuys[_buyer].length;
packBuys[_buyer].push(PackBuy(packSize, packPrice, _cardsList));
emit BuyPack(_id, _buyer, packSize, packPrice, _cardsList);
}
emit BuyPacks(_id, _buyer, packSize, packPrice, _count);
return true;
}
function getPack(uint256 _count) external onlyOwner whenNotPaused returns (bool) {
require(_count > 0);
for (uint256 i = 0; i < _count; i++) {
uint256[] memory _cardsList = new uint256[](packSize);
for (uint256 j = 0; j < packSize; j++) {
uint256 _cardId = dice(totalCardCount);
balances[owner][_cardId] = balances[owner][_cardId].add(1);
_cardsList[j] = _cardId;
emit Transfer(0x0, owner, _cardId, 1);
}
uint256 _id = packBuys[owner].length;
packBuys[owner].push(PackBuy(packSize, 0, _cardsList));
emit BuyPack(_id, owner, packSize, 0, _cardsList);
}
emit BuyPacks(_id, owner, packSize, 0, _count);
return true;
}
uint256 seed = 0;
function maxDice() private returns (uint256 diceNumber) {
seed = uint256(keccak256(keccak256(blockhash(block.number - 1), seed), now));
return seed;
}
function dice(uint256 upper) private returns (uint256 diceNumber) {
return maxDice() % upper;
}
} | 0x608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306c45c2a1461018557806309ec6cc71461022057806329d6ec9514610265578063346cf356146102c857806339d4e21a146103205780633a31df8d146103795780633bc867f5146104fe5780633f4ba83a14610529578063497ec9ca146105405780634a3f5294146105ba5780634b97e6cc14610634578063542cad3d1461064b57806356f433521461068e5780635c975abb146106b95780636c4b3197146106e857806370ed0ada14610717578063715018a614610742578063727cdf87146107595780638456cb5914610786578063864aef451461079d5780638da5cb5b14610809578063a528fec414610860578063b0d54bcf1461088f578063bd76bf19146108bc578063cace467e146108fe578063e56e56b214610961578063e6fd604c146109e4578063e8ddf15a14610a0f578063f2fde38b14610a26578063f8542f5e14610a69575b600080fd5b34801561019157600080fd5b50610206600480360381019080803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390505050610ac0565b604051808215151515815260200191505060405180910390f35b34801561022c57600080fd5b5061024b60048036038101908080359060200190929190505050610fca565b604051808215151515815260200191505060405180910390f35b34801561027157600080fd5b506102ae6004803603810190808035906020019092919080359060200190929190803590602001909291908035906020019092919050505061166a565b604051808215151515815260200191505060405180910390f35b610306600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611983565b604051808215151515815260200191505060405180910390f35b34801561032c57600080fd5b5061035f600480360381019080803590602001909291908035906020019092919080359060200190929190505050612259565b604051808215151515815260200191505060405180910390f35b34801561038557600080fd5b506103c460048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612558565b60405180806020018060200180602001806020018615151515815260200185810385528a818151815260200191508051906020019060200280838360005b8381101561041d578082015181840152602081019050610402565b50505050905001858103845289818151815260200191508051906020019060200280838360005b8381101561045f578082015181840152602081019050610444565b50505050905001858103835288818151815260200191508051906020019060200280838360005b838110156104a1578082015181840152602081019050610486565b50505050905001858103825287818151815260200191508051906020019060200280838360005b838110156104e35780820151818401526020810190506104c8565b50505050905001995050505050505050505060405180910390f35b34801561050a57600080fd5b5061051361289b565b6040518082815260200191505060405180910390f35b34801561053557600080fd5b5061053e612900565b005b34801561054c57600080fd5b5061058b60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129be565b604051808581526020018481526020018381526020018215151515815260200194505050505060405180910390f35b3480156105c657600080fd5b5061060560048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b5a565b604051808581526020018481526020018381526020018215151515815260200194505050505060405180910390f35b34801561064057600080fd5b50610649612cf6565b005b34801561065757600080fd5b5061068c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ddc565b005b34801561069a57600080fd5b506106a3612e7b565b6040518082815260200191505060405180910390f35b3480156106c557600080fd5b506106ce612e81565b604051808215151515815260200191505060405180910390f35b3480156106f457600080fd5b506106fd612e94565b604051808215151515815260200191505060405180910390f35b34801561072357600080fd5b5061072c612f06565b6040518082815260200191505060405180910390f35b34801561074e57600080fd5b50610757612f25565b005b34801561076557600080fd5b5061078460048036038101908080359060200190929190505050613027565b005b34801561079257600080fd5b5061079b6130ab565b005b6107ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919050505061316b565b604051808215151515815260200191505060405180910390f35b34801561081557600080fd5b5061081e613640565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561086c57600080fd5b5061088d600480360381019080803515159060200190929190505050613665565b005b34801561089b57600080fd5b506108ba600480360381019080803590602001909291905050506136dd565b005b6108e46004803603810190808035906020019092919080359060200190929190505050613751565b604051808215151515815260200191505060405180910390f35b34801561090a57600080fd5b5061094760048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050613928565b604051808215151515815260200191505060405180910390f35b34801561096d57600080fd5b506109ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050613cf3565b604051808215151515815260200191505060405180910390f35b3480156109f057600080fd5b506109f9614206565b6040518082815260200191505060405180910390f35b348015610a1b57600080fd5b50610a2461420c565b005b348015610a3257600080fd5b50610a67600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506142ee565b005b348015610a7557600080fd5b50610a7e614443565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600080600060149054906101000a900460ff16151515610ae257600080fd5b33925060008c8c9050111515610af757600080fd5b60008a8a9050111515610b0957600080fd5b600088889050111515610b1b57600080fd5b600086869050111515610b2d57600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509150600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060a0604051908101604052808e8e8080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505081526020018c8c8080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505081526020018a8a808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508152602001888880806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050815260200160011515815250908060018154018082558091505090600182039060005260206000209060050201600090919290919091506000820151816000019080519060200190610cdf9291906144c8565b506020820151816001019080519060200190610cfc9291906144c8565b506040820151816002019080519060200190610d199291906144c8565b506060820151816003019080519060200190610d369291906144c8565b5060808201518160040160006101000a81548160ff021916908315150217905550505050600090505b8b8b9050811015610edc57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe99049a84308f8f868181101515610db857fe5b905060200201358e8e878181101515610dcd57fe5b905060200201356040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050602060405180830381600087803b158015610e9357600080fd5b505af1158015610ea7573d6000803e3d6000fd5b505050506040513d6020811015610ebd57600080fd5b8101908080519060200190929190505050508080600101915050610d5f565b818373ffffffffffffffffffffffffffffffffffffffff167f3388a3a643e5304b88ad9e9369991f4e3d6fc9d0a93b29e083c6dcb0935225e78e8e8e8e8e8e8e8e604051808060200180602001806020018060200185810385528d8d82818152602001925060200280828437820191505085810384528b8b82818152602001925060200280828437820191505085810383528989828181526020019250602002808284378201915050858103825287878281815260200192506020028082843782019150509c5050505050505050505050505060405180910390a36001935050505098975050505050505050565b60008060608060608060008060149054906101000a900460ff16151515610ff057600080fd5b339550600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208881548110151561103f57fe5b906000526020600020906005020160000180548060200260200160405190810160405280929190818152602001828054801561109a57602002820191906000526020600020905b815481526020019060010190808311611086575b50505050509450600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020888154811015156110ed57fe5b906000526020600020906005020160010180548060200260200160405190810160405280929190818152602001828054801561114857602002820191906000526020600020905b815481526020019060010190808311611134575b50505050509350600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208881548110151561119b57fe5b90600052602060002090600502016002018054806020026020016040519081016040528092919081815260200182805480156111f657602002820191906000526020600020905b8154815260200190600101908083116111e2575b50505050509250600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208881548110151561124957fe5b90600052602060002090600502016003018054806020026020016040519081016040528092919081815260200182805480156112a457602002820191906000526020600020905b815481526020019060010190808311611290575b5050505050915060011515600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020898154811015156112fb57fe5b906000526020600020906005020160040160009054906101000a900460ff16151514151561132857600080fd5b6000600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208981548110151561137657fe5b906000526020600020906005020160040160006101000a81548160ff021916908315150217905550600090505b84518110156114f057600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095bcdb68787848151811015156113f957fe5b90602001906020020151878581518110151561141157fe5b906020019060200201516040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1580156114a757600080fd5b505af11580156114bb573d6000803e3d6000fd5b505050506040513d60208110156114d157600080fd5b81019080805190602001909291905050505080806001019150506113a3565b878673ffffffffffffffffffffffffffffffffffffffff167f989a88ae56988bc6678bab32d432b9882d3c14266eb9b6d880570edb0b498310878787876040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561157c578082015181840152602081019050611561565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156115be5780820151818401526020810190506115a3565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156116005780820151818401526020810190506115e5565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015611642578082015181840152602081019050611627565b505050509050019850505050505050505060405180910390a360019650505050505050919050565b600080600060149054906101000a900460ff1615151561168957600080fd5b33905060011515600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811015156116dc57fe5b906000526020600020906004020160030160009054906101000a900460ff16151514151561170957600080fd5b84600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208781548110151561175657fe5b90600052602060002090600402016000015414151561177457600080fd5b83600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811015156117c157fe5b9060005260206000209060040201600101541415156117df57600080fd5b82600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208781548110151561182c57fe5b90600052602060002090600402016002015414151561184a57600080fd5b826002600082825403925050819055506000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811015156118a857fe5b906000526020600020906004020160030160006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015611916573d6000803e3d6000fd5b50858173ffffffffffffffffffffffffffffffffffffffff167fffe3b33b7dc354245af0b81031906db97393ca00e8b141366c72a07fbe4ffadb87878760405180848152602001838152602001828152602001935050505060405180910390a36001915050949350505050565b6000806000606080606080600080600060149054906101000a900460ff161515156119ad57600080fd5b339750349650600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a8154811015156119ff57fe5b9060005260206000209060050201600001805480602002602001604051908101604052809291908181526020018280548015611a5a57602002820191906000526020600020905b815481526020019060010190808311611a46575b50505050509550600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515611aad57fe5b9060005260206000209060050201600101805480602002602001604051908101604052809291908181526020018280548015611b0857602002820191906000526020600020905b815481526020019060010190808311611af4575b50505050509450600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515611b5b57fe5b9060005260206000209060050201600201805480602002602001604051908101604052809291908181526020018280548015611bb657602002820191906000526020600020905b815481526020019060010190808311611ba2575b50505050509350600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515611c0957fe5b9060005260206000209060050201600301805480602002602001604051908101604052809291908181526020018280548015611c6457602002820191906000526020600020905b815481526020019060010190808311611c50575b5050505050925060011515600860008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208b815481101515611cbb57fe5b906000526020600020906005020160040160009054906101000a900460ff161515141515611ce857600080fd5b6004548710151515611cf957600080fd5b6000600860008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208b815481101515611d4757fe5b906000526020600020906005020160040160006101000a81548160ff021916908315150217905550600091505b8551821015611ec157600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095bcdb6898885815181101515611dca57fe5b906020019060200201518886815181101515611de257fe5b906020019060200201516040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b158015611e7857600080fd5b505af1158015611e8c573d6000803e3d6000fd5b505050506040513d6020811015611ea257600080fd5b8101908080519060200190929190505050508180600101925050611d74565b600090505b835181101561204757600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe99049a898d8785815181101515611f1d57fe5b906020019060200201518786815181101515611f3557fe5b906020019060200201516040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050602060405180830381600087803b158015611ffe57600080fd5b505af1158015612012573d6000803e3d6000fd5b505050506040513d602081101561202857600080fd5b8101908080519060200190929190505050508080600101915050611ec6565b600560009054906101000a900460ff16156120c5576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc889081150290604051600060405180830381858888f193505050501580156120c3573d6000803e3d6000fd5b505b8773ffffffffffffffffffffffffffffffffffffffff168a8c73ffffffffffffffffffffffffffffffffffffffff167fa10341a22d816355afcbc27e7705a056e2f462c117d4f856405c1fc00a258fc2898989896040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561216857808201518184015260208101905061214d565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156121aa57808201518184015260208101905061218f565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156121ec5780820151818401526020810190506121d1565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561222e578082015181840152602081019050612213565b505050509050019850505050505050505060405180910390a460019850505050505050505092915050565b60008060008060149054906101000a900460ff1615151561227957600080fd5b33915060008411151561228b57600080fd5b60008511151561229a57600080fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020608060405190810160405280888152602001878152602001868152602001600115158152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000155602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe99049a833089896040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050602060405180830381600087803b1580156124b057600080fd5b505af11580156124c4573d6000803e3d6000fd5b505050506040513d60208110156124da57600080fd5b810190808051906020019092919050505050808273ffffffffffffffffffffffffffffffffffffffff167f6e57519591a83c10d3c5f8e6036efde209528dc1e6744a87c655b152cff0dc9d88888860405180848152602001838152602001828152602001935050505060405180910390a36001925050509392505050565b6060806060806000600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811015156125ac57fe5b9060005260206000209060050201600001600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208881548110151561260957fe5b9060005260206000209060050201600101600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208981548110151561266657fe5b9060005260206000209060050201600201600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a8154811015156126c357fe5b9060005260206000209060050201600301600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208b81548110151561272057fe5b906000526020600020906005020160040160009054906101000a900460ff168480548060200260200160405190810160405280929190818152602001828054801561278a57602002820191906000526020600020905b815481526020019060010190808311612776575b50505050509450838054806020026020016040519081016040528092919081815260200182805480156127dc57602002820191906000526020600020905b8154815260200190600101908083116127c8575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561282e57602002820191906000526020600020905b81548152602001906001019080831161281a575b505050505092508180548060200260200160405190810160405280929190818152602001828054801561288057602002820191906000526020600020905b81548152602001906001019080831161286c575b50505050509150945094509450945094509295509295909350565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128f857600080fd5b600254905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561295b57600080fd5b600060149054906101000a900460ff16151561297657600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600080600080600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481101515612a1057fe5b906000526020600020906004020160000154600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515612a6e57fe5b906000526020600020906004020160010154600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002088815481101515612acc57fe5b906000526020600020906004020160020154600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002089815481101515612b2a57fe5b906000526020600020906004020160030160009054906101000a900460ff16935093509350935092959194509250565b600080600080600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481101515612bac57fe5b906000526020600020906004020160000154600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515612c0a57fe5b906000526020600020906004020160010154600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002088815481101515612c6857fe5b906000526020600020906004020160020154600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002089815481101515612cc657fe5b906000526020600020906004020160030160009054906101000a900460ff16935093509350935092959194509250565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d5357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60025483039081150290604051600060405180830381858888f19350505050158015612dd8573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e3757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600060149054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612ef157600080fd5b600560009054906101000a900460ff16905090565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612f8057600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561308257600080fd5b60008111151561309157600080fd5b612710811015156130a157600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561310657600080fd5b600060149054906101000a900460ff1615151561312257600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600080600080600080600060149054906101000a900460ff1615151561319057600080fd5b3394503493506003546127100392506127108385028115156131ae57fe5b049150818403905060011515600760008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a81548110151561320657fe5b906000526020600020906004020160030160009054906101000a900460ff16151514151561323357600080fd5b87600760008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a81548110151561328057fe5b90600052602060002090600402016000015414151561329e57600080fd5b86600760008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a8154811015156132eb57fe5b90600052602060002090600402016001015414151561330957600080fd5b83600760008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a81548110151561335657fe5b9060005260206000209060040201600201541115151561337557600080fd5b6000600760008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a8154811015156133c357fe5b906000526020600020906004020160030160006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095bcdb6868a8a6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1580156134b857600080fd5b505af11580156134cc573d6000803e3d6000fd5b505050506040513d60208110156134e257600080fd5b8101908080519060200190929190505050508973ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561353a573d6000803e3d6000fd5b50600560009054906101000a900460ff16156135b9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156135b7573d6000803e3d6000fd5b505b8473ffffffffffffffffffffffffffffffffffffffff16898b73ffffffffffffffffffffffffffffffffffffffff167fc6e8b35a11767e6f41c7903cfbd8e1fe8f9f1f391b1ba2ba46a499a7fbb51d8a8b8b8960405180848152602001838152602001828152602001935050505060405180910390a4600195505050505050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156136c057600080fd5b80600560006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561373857600080fd5b60008111151561374757600080fd5b8060048190555050565b600080600080600060149054906101000a900460ff1615151561377357600080fd5b33925034915060008211151561378857600080fd5b60008511151561379757600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020608060405190810160405280888152602001878152602001848152602001600115158152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000155602082015181600101556040820151816002015560608201518160030160006101000a81548160ff02191690831515021790555050505081600260008282540192505081905550808373ffffffffffffffffffffffffffffffffffffffff167f09fc021557199dcb6265a76d94f6f51b775388b193a66090a4cc65192612a59d88888660405180848152602001838152602001828152602001935050505060405180910390a36001935050505092915050565b600080600060149054906101000a900460ff1615151561394757600080fd5b33905060011515600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208781548110151561399a57fe5b906000526020600020906004020160030160009054906101000a900460ff1615151415156139c757600080fd5b84600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515613a1457fe5b906000526020600020906004020160000154141515613a3257600080fd5b83600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515613a7f57fe5b906000526020600020906004020160010154141515613a9d57600080fd5b82600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515613aea57fe5b906000526020600020906004020160020154141515613b0857600080fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002087815481101515613b5657fe5b906000526020600020906004020160030160006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095bcdb68287876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b158015613c4b57600080fd5b505af1158015613c5f573d6000803e3d6000fd5b505050506040513d6020811015613c7557600080fd5b810190808051906020019092919050505050858173ffffffffffffffffffffffffffffffffffffffff167fa217225403b24f4ed4d6817ce4bd1d91d71349ea0332bade817be4c6718e99ca87878760405180848152602001838152602001828152602001935050505060405180910390a36001915050949350505050565b60008060008060008060149054906101000a900460ff16151515613d1657600080fd5b339350600354612710039250612710838702811515613d3157fe5b049150818603905060011515600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515613d8957fe5b906000526020600020906004020160030160009054906101000a900460ff161515141515613db657600080fd5b87600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515613e0357fe5b906000526020600020906004020160000154141515613e2157600080fd5b86600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515613e6e57fe5b906000526020600020906004020160010154141515613e8c57600080fd5b85600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515613ed957fe5b906000526020600020906004020160020154141515613ef757600080fd5b6000600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a815481101515613f4557fe5b906000526020600020906004020160030160006101000a81548160ff02191690831515021790555085600260008282540392505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe99049a858c8b8b6040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050602060405180830381600087803b15801561407e57600080fd5b505af1158015614092573d6000803e3d6000fd5b505050506040513d60208110156140a857600080fd5b8101908080519060200190929190505050508373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015614100573d6000803e3d6000fd5b50600560009054906101000a900460ff161561417f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561417d573d6000803e3d6000fd5b505b8373ffffffffffffffffffffffffffffffffffffffff16898b73ffffffffffffffffffffffffffffffffffffffff167fa5b268a6934cb4d4a00092d1c4688685d70acc386fea547a48d84a664a0500748b8b8b60405180848152602001838152602001828152602001935050505060405180910390a4600194505050505095945050505050565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561426957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156142ea573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561434957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561438557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156144a057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b828054828255906000526020600020908101928215614504579160200282015b828111156145035782518255916020019190600101906144e8565b5b5090506145119190614515565b5090565b61453791905b8082111561453357600081600090555060010161451b565b5090565b905600a165627a7a7230582035b9cc908d56a36bcbfd6040e3602abaca735da18b1e3e0bb3c73ce82ecc608c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,517 |
0xe6bd7b9d6ed5284b045cba2baf57c8e601b5b1c5 | // Telegram: https://t.me/predatorraptor
// Website: https://predatorraptor.com/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PredatorRaptor is Context, IERC20, Ownable {
using SafeMath for uint256;
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 time;
uint256 private _tax;
uint256 private constant _tTotal = 1 * 10**12 * 10**9;
uint256 private fee1=90;
uint256 private fee2=90;
uint256 private liqfee=20;
uint256 private feeMax=100;
string private constant _name = "Predator Raptor";
string private constant _symbol = "PRAP";
uint256 private _maxTxAmount = _tTotal.mul(2).div(100);
uint256 private minBalance = _tTotal.div(1000);
uint8 private constant _decimals = 9;
address payable private _feeAddrWallet1;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () payable {
_feeAddrWallet1 = payable(msg.sender);
_tOwned[address(this)] = _tTotal.div(2);
_tOwned[0x000000000000000000000000000000000000dEaD] = _tTotal.div(2);
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0),address(this),_tTotal.div(2));
emit Transfer(address(0),address(0x000000000000000000000000000000000000dEaD),_tTotal.div(2));
}
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 _tOwned[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 changeFees(uint8 _fee1,uint8 _fee2,uint8 _liq) external {
require(_msgSender() == _feeAddrWallet1);
require(_fee1 <= feeMax && _fee2 <= feeMax && liqfee <= feeMax,"Cannot set fees above maximum");
fee1 = _fee1;
fee2 = _fee2;
liqfee = _liq;
}
function changeMinBalance(uint256 newMin) external {
require(_msgSender() == _feeAddrWallet1);
minBalance = newMin;
}
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");
_tax = fee1.add(liqfee);
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && (block.timestamp < time)){
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_tax = fee2.add(liqfee);
}
if (!inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from]) {
require(block.timestamp > time,"Sells prohibited for the first 5 minutes");
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > minBalance){
swapAndLiquify(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
}
_transferStandard(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 swapAndLiquify(uint256 tokenAmount) private {
uint256 half = liqfee.div(2);
uint256 part = fee2.add(half);
uint256 sum = fee2.add(liqfee);
uint256 swapTotal = tokenAmount.mul(part).div(sum);
swapTokensForEth(swapTotal);
addLiquidity(tokenAmount.sub(swapTotal),address(this).balance.mul(half).div(part),_feeAddrWallet1);
}
function addLiquidity(uint256 tokenAmount,uint256 ethAmount,address target) private lockTheSwap{
_approve(address(this),address(uniswapV2Router),tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(address(this),tokenAmount,0,0,target,block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
addLiquidity(balanceOf(address(this)),address(this).balance,owner());
swapEnabled = true;
tradingOpen = true;
time = block.timestamp + (5 minutes);
}
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 _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 transferAmount,uint256 tfee) = _getTValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(transferAmount);
_tOwned[address(this)] = _tOwned[address(this)].add(tfee);
emit Transfer(sender, recipient, transferAmount);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapAndLiquify(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256) {
uint256 tFee = tAmount.mul(_tax).div(1000);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function recoverTokens(address tokenAddress) external {
require(_msgSender() == _feeAddrWallet1);
IERC20 recoveryToken = IERC20(tokenAddress);
recoveryToken.transfer(_feeAddrWallet1,recoveryToken.balanceOf(address(this)));
}
} | 0x6080604052600436106101185760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610384578063b515566a146103c1578063c3c8cd80146103ea578063c9567bf914610401578063dd62ed3e146104185761011f565b806370a08231146102b1578063715018a6146102ee5780637e37e9bb146103055780638da5cb5b1461032e57806395d89b41146103595761011f565b806323b872dd116100e757806323b872dd146101e0578063273123b71461021d578063313ce567146102465780634ea18fab146102715780636fc3eaec1461029a5761011f565b806306fdde0314610124578063095ea7b31461014f57806316114acd1461018c57806318160ddd146101b55761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b60405161014691906128fe565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906123ef565b610492565b60405161018391906128e3565b60405180910390f35b34801561019857600080fd5b506101b360048036038101906101ae9190612302565b6104b0565b005b3480156101c157600080fd5b506101ca610652565b6040516101d79190612a80565b60405180910390f35b3480156101ec57600080fd5b506102076004803603810190610202919061239c565b610663565b60405161021491906128e3565b60405180910390f35b34801561022957600080fd5b50610244600480360381019061023f9190612302565b61073c565b005b34801561025257600080fd5b5061025b61082c565b6040516102689190612af5565b60405180910390f35b34801561027d57600080fd5b50610298600480360381019061029391906124a5565b610835565b005b3480156102a657600080fd5b506102af6108a0565b005b3480156102bd57600080fd5b506102d860048036038101906102d39190612302565b610912565b6040516102e59190612a80565b60405180910390f35b3480156102fa57600080fd5b5061030361095b565b005b34801561031157600080fd5b5061032c60048036038101906103279190612552565b610aae565b005b34801561033a57600080fd5b50610343610b9b565b604051610350919061283e565b60405180910390f35b34801561036557600080fd5b5061036e610bc4565b60405161037b91906128fe565b60405180910390f35b34801561039057600080fd5b506103ab60048036038101906103a691906123ef565b610c01565b6040516103b891906128e3565b60405180910390f35b3480156103cd57600080fd5b506103e860048036038101906103e3919061242f565b610c1f565b005b3480156103f657600080fd5b506103ff610d49565b005b34801561040d57600080fd5b50610416610dc3565b005b34801561042457600080fd5b5061043f600480360381019061043a919061235c565b610f0e565b60405161044c9190612a80565b60405180910390f35b60606040518060400160405280600f81526020017f5072656461746f7220526170746f720000000000000000000000000000000000815250905090565b60006104a661049f61105a565b8484611062565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104f161105a565b73ffffffffffffffffffffffffffffffffffffffff161461051157600080fd5b60008190508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161058e919061283e565b60206040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de91906124d2565b6040518363ffffffff1660e01b81526004016105fb929190612859565b602060405180830381600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d9190612478565b505050565b6000683635c9adc5dea00000905090565b600061067084848461122d565b6107318461067c61105a565b61072c8560405180606001604052806028815260200161322060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106e261105a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e69092919063ffffffff16565b611062565b600190509392505050565b61074461105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c8906129c0565b60405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661087661105a565b73ffffffffffffffffffffffffffffffffffffffff161461089657600080fd5b80600e8190555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e161105a565b73ffffffffffffffffffffffffffffffffffffffff161461090157600080fd5b600047905061090f8161194a565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61096361105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e7906129c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aef61105a565b73ffffffffffffffffffffffffffffffffffffffff1614610b0f57600080fd5b600c548360ff1611158015610b295750600c548260ff1611155b8015610b395750600c54600b5411155b610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612a60565b60405180910390fd5b8260ff166009819055508160ff16600a819055508060ff16600b81905550505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5052415000000000000000000000000000000000000000000000000000000000815250905090565b6000610c15610c0e61105a565b848461122d565b6001905092915050565b610c2761105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cab906129c0565b60405180910390fd5b60005b8151811015610d4557600160056000848481518110610cd957610cd8612e73565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610d3d90612dcc565b915050610cb7565b5050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d8a61105a565b73ffffffffffffffffffffffffffffffffffffffff1614610daa57600080fd5b6000610db530610912565b9050610dc0816119b6565b50565b610dcb61105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4f906129c0565b60405180910390fd5b601160149054906101000a900460ff1615610ea8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9f90612a40565b60405180910390fd5b610ec2610eb430610912565b47610ebd610b9b565b611aa0565b6001601160166101000a81548160ff0219169083151502179055506001601160146101000a81548160ff02191690831515021790555061012c42610f069190612bb6565b600781905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080831415610fa8576000905061100a565b60008284610fb69190612c3d565b9050828482610fc59190612c0c565b14611005576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffc906129a0565b60405180910390fd5b809150505b92915050565b600061105283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611bc4565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990612a20565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611142576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113990612960565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112209190612a80565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561129d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129490612a00565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561130d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130490612940565b60405180910390fd5b60008111611350576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611347906129e0565b60405180910390fd5b611367600b54600954611c2790919063ffffffff16565b600881905550611375610b9b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113e357506113b3610b9b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118d657600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561148c5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61149557600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115405750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115965750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115a3575060075442105b1561165357600d548111156115b757600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061160257600080fd5b601e4261160f9190612bb6565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156116fe5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117545750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561177757611770600b54600a54611c2790919063ffffffff16565b6008819055505b601160159054906101000a900460ff161580156117e25750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117fa5750601160169054906101000a900460ff165b80156118505750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156118d5576007544211611899576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189090612920565b60405180910390fd5b60006118a430610912565b9050600e548111156118d3576118b9816119b6565b600047905060008111156118d1576118d04761194a565b5b505b505b5b6118e1838383611c85565b505050565b600083831115829061192e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192591906128fe565b60405180910390fd5b506000838561193d9190612c97565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119b2573d6000803e3d6000fd5b5050565b60006119ce6002600b5461101090919063ffffffff16565b905060006119e782600a54611c2790919063ffffffff16565b90506000611a02600b54600a54611c2790919063ffffffff16565b90506000611a2b82611a1d8588610f9590919063ffffffff16565b61101090919063ffffffff16565b9050611a3681611ec0565b611a99611a4c828761214890919063ffffffff16565b611a7185611a638847610f9590919063ffffffff16565b61101090919063ffffffff16565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611aa0565b5050505050565b6001601160156101000a81548160ff021916908315150217905550611ae830601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685611062565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087426040518863ffffffff1660e01b8152600401611b4f96959493929190612882565b6060604051808303818588803b158015611b6857600080fd5b505af1158015611b7c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611ba191906124ff565b5050506000601160156101000a81548160ff021916908315150217905550505050565b60008083118290611c0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0291906128fe565b60405180910390fd5b5060008385611c1a9190612c0c565b9050809150509392505050565b6000808284611c369190612bb6565b905083811015611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7290612980565b60405180910390fd5b8091505092915050565b600080611c9183612192565b91509150611ce783600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214890919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e1181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611eb19190612a80565b60405180910390a35050505050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef857611ef7612ea2565b5b604051908082528060200260200182016040528015611f265781602001602082028036833780820191505090505b5090503081600081518110611f3e57611f3d612e73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fe057600080fd5b505afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612018919061232f565b8160018151811061202c5761202b612e73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061209330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611062565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120f7959493929190612a9b565b600060405180830381600087803b15801561211157600080fd5b505af1158015612125573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600061218a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118e6565b905092915050565b60008060006121c06103e86121b260085487610f9590919063ffffffff16565b61101090919063ffffffff16565b905060006121d7828661214890919063ffffffff16565b90508082935093505050915091565b60006121f96121f484612b35565b612b10565b9050808382526020820190508285602086028201111561221c5761221b612ed6565b5b60005b8581101561224c57816122328882612256565b84526020840193506020830192505060018101905061221f565b5050509392505050565b600081359050612265816131c3565b92915050565b60008151905061227a816131c3565b92915050565b600082601f83011261229557612294612ed1565b5b81356122a58482602086016121e6565b91505092915050565b6000815190506122bd816131da565b92915050565b6000813590506122d2816131f1565b92915050565b6000815190506122e7816131f1565b92915050565b6000813590506122fc81613208565b92915050565b60006020828403121561231857612317612ee0565b5b600061232684828501612256565b91505092915050565b60006020828403121561234557612344612ee0565b5b60006123538482850161226b565b91505092915050565b6000806040838503121561237357612372612ee0565b5b600061238185828601612256565b925050602061239285828601612256565b9150509250929050565b6000806000606084860312156123b5576123b4612ee0565b5b60006123c386828701612256565b93505060206123d486828701612256565b92505060406123e5868287016122c3565b9150509250925092565b6000806040838503121561240657612405612ee0565b5b600061241485828601612256565b9250506020612425858286016122c3565b9150509250929050565b60006020828403121561244557612444612ee0565b5b600082013567ffffffffffffffff81111561246357612462612edb565b5b61246f84828501612280565b91505092915050565b60006020828403121561248e5761248d612ee0565b5b600061249c848285016122ae565b91505092915050565b6000602082840312156124bb576124ba612ee0565b5b60006124c9848285016122c3565b91505092915050565b6000602082840312156124e8576124e7612ee0565b5b60006124f6848285016122d8565b91505092915050565b60008060006060848603121561251857612517612ee0565b5b6000612526868287016122d8565b9350506020612537868287016122d8565b9250506040612548868287016122d8565b9150509250925092565b60008060006060848603121561256b5761256a612ee0565b5b6000612579868287016122ed565b935050602061258a868287016122ed565b925050604061259b868287016122ed565b9150509250925092565b60006125b183836125cc565b60208301905092915050565b6125c681612d20565b82525050565b6125d581612ccb565b82525050565b6125e481612ccb565b82525050565b60006125f582612b71565b6125ff8185612b94565b935061260a83612b61565b8060005b8381101561263b57815161262288826125a5565b975061262d83612b87565b92505060018101905061260e565b5085935050505092915050565b61265181612cdd565b82525050565b61266081612d32565b82525050565b600061267182612b7c565b61267b8185612ba5565b935061268b818560208601612d68565b61269481612ee5565b840191505092915050565b60006126ac602883612ba5565b91506126b782612ef6565b604082019050919050565b60006126cf602383612ba5565b91506126da82612f45565b604082019050919050565b60006126f2602283612ba5565b91506126fd82612f94565b604082019050919050565b6000612715601b83612ba5565b915061272082612fe3565b602082019050919050565b6000612738602183612ba5565b91506127438261300c565b604082019050919050565b600061275b602083612ba5565b91506127668261305b565b602082019050919050565b600061277e602983612ba5565b915061278982613084565b604082019050919050565b60006127a1602583612ba5565b91506127ac826130d3565b604082019050919050565b60006127c4602483612ba5565b91506127cf82613122565b604082019050919050565b60006127e7601783612ba5565b91506127f282613171565b602082019050919050565b600061280a601d83612ba5565b91506128158261319a565b602082019050919050565b61282981612d09565b82525050565b61283881612d13565b82525050565b600060208201905061285360008301846125db565b92915050565b600060408201905061286e60008301856125bd565b61287b6020830184612820565b9392505050565b600060c08201905061289760008301896125db565b6128a46020830188612820565b6128b16040830187612657565b6128be6060830186612657565b6128cb60808301856125db565b6128d860a0830184612820565b979650505050505050565b60006020820190506128f86000830184612648565b92915050565b600060208201905081810360008301526129188184612666565b905092915050565b600060208201905081810360008301526129398161269f565b9050919050565b60006020820190508181036000830152612959816126c2565b9050919050565b60006020820190508181036000830152612979816126e5565b9050919050565b6000602082019050818103600083015261299981612708565b9050919050565b600060208201905081810360008301526129b98161272b565b9050919050565b600060208201905081810360008301526129d98161274e565b9050919050565b600060208201905081810360008301526129f981612771565b9050919050565b60006020820190508181036000830152612a1981612794565b9050919050565b60006020820190508181036000830152612a39816127b7565b9050919050565b60006020820190508181036000830152612a59816127da565b9050919050565b60006020820190508181036000830152612a79816127fd565b9050919050565b6000602082019050612a956000830184612820565b92915050565b600060a082019050612ab06000830188612820565b612abd6020830187612657565b8181036040830152612acf81866125ea565b9050612ade60608301856125db565b612aeb6080830184612820565b9695505050505050565b6000602082019050612b0a600083018461282f565b92915050565b6000612b1a612b2b565b9050612b268282612d9b565b919050565b6000604051905090565b600067ffffffffffffffff821115612b5057612b4f612ea2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612bc182612d09565b9150612bcc83612d09565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612c0157612c00612e15565b5b828201905092915050565b6000612c1782612d09565b9150612c2283612d09565b925082612c3257612c31612e44565b5b828204905092915050565b6000612c4882612d09565b9150612c5383612d09565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c8c57612c8b612e15565b5b828202905092915050565b6000612ca282612d09565b9150612cad83612d09565b925082821015612cc057612cbf612e15565b5b828203905092915050565b6000612cd682612ce9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d2b82612d44565b9050919050565b6000612d3d82612d09565b9050919050565b6000612d4f82612d56565b9050919050565b6000612d6182612ce9565b9050919050565b60005b83811015612d86578082015181840152602081019050612d6b565b83811115612d95576000848401525b50505050565b612da482612ee5565b810181811067ffffffffffffffff82111715612dc357612dc2612ea2565b5b80604052505050565b6000612dd782612d09565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e0a57612e09612e15565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f53656c6c732070726f6869626974656420666f7220746865206669727374203560008201527f206d696e75746573000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f43616e6e6f742073657420666565732061626f7665206d6178696d756d000000600082015250565b6131cc81612ccb565b81146131d757600080fd5b50565b6131e381612cdd565b81146131ee57600080fd5b50565b6131fa81612d09565b811461320557600080fd5b50565b61321181612d13565b811461321c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220adec845f6b3ea275db86cb3ca9a72454542f22a408ccf281f2d79022a2e54a1764736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,518 |
0x96516267a9a5cdf2920b08bdf28ec8dcb36af7a9 | /**
/* ,,*/////////*,, .**/////////**,
/* ,*//***/////////**, .*//////////**//**,
/* .,******//////////*,, *///////////********
/* *,*******/////////**,.. ,*///////////******,,
/* ,**,***/////////**, .............,,///////////***,,,*
/* .,**************,,. ...................,,,,,,,,,,,,,,,*************,,,*
/* ,,,,,,,,,. .,,..............,,,,,,,,,,,,,,,,,****,,,,,,,,,,,. .,,,,,*
/* /*,.... .........,.,,,,,,,,,,,,,,,************,,,*,,,.. ,**
/* //*,,,,,,,.....,,,,,,,,,,,,,,,,,****************,,,*,,,,,,**/
/* *///.....,,,,,,,,,,,,,,,,,,,,**************,**///*.
/* ,,,,,,,,,,,,,,,,,,,,,,,********************
/* ,,,,,,,,,,,,,,,,,,,,,,,,,,,,***************
/* ,,,,.,,..... ......,,,********.
/* ,........ ....,,,,,******
/* ........... .. ......,,,,,,,,,***
/* *................../****////,,,,,,,,,,,,,,,*,*
/* .....,,,,,,,,,,,,,,,***************************
/* ,,,,,,,,,,***,,,*********/////******************
/* *** *************////////////////////***......**
/* /* .****///////////////////////////***,.....**
/* .**..///////////////////////////*//*/*,....,*
/* *//**************////******************
/* **********************************
/* ************************
BE@R BRICK FANS CLUB
T.me/BearBrickToken
www.BearBrickFansClub.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 BearBrick is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Be@rBrickFansClub T.me/BearBrickToken";
string private constant _symbol = "Be@rBrick";
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 4;
uint256 private _teamFee = 4;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 4;
_teamFee = 4;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 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 = 25000000 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e56565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061295d565b610441565b6040516101789190612e3b565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190612ff8565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061290a565b61046f565b6040516101e09190612e3b565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612870565b610548565b005b34801561021e57600080fd5b50610227610638565b604051610234919061306d565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129e6565b610641565b005b34801561027257600080fd5b5061027b6106f3565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612870565b610765565b6040516102b19190612ff8565b60405180910390f35b3480156102c657600080fd5b506102cf6107b6565b005b3480156102dd57600080fd5b506102e6610909565b6040516102f39190612d6d565b60405180910390f35b34801561030857600080fd5b50610311610932565b60405161031e9190612e56565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061295d565b61096f565b60405161035b9190612e3b565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061299d565b61098d565b005b34801561039957600080fd5b506103a2610ab7565b005b3480156103b057600080fd5b506103b9610b31565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b61108b565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128ca565b6111d3565b6040516104189190612ff8565b60405180910390f35b606060405180606001604052806025815260200161377460259139905090565b600061045561044e61125a565b8484611262565b6001905092915050565b6000670de0b6b3a7640000905090565b600061047c84848461142d565b61053d8461048861125a565b6105388560405180606001604052806028815260200161379960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ee61125a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bec9092919063ffffffff16565b611262565b600190509392505050565b61055061125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d490612f38565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064961125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cd90612f38565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073461125a565b73ffffffffffffffffffffffffffffffffffffffff161461075457600080fd5b600047905061076281611c50565b50565b60006107af600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4b565b9050919050565b6107be61125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290612f38565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f42654072427269636b0000000000000000000000000000000000000000000000815250905090565b600061098361097c61125a565b848461142d565b6001905092915050565b61099561125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1990612f38565b60405180910390fd5b60005b8151811015610ab3576001600a6000848481518110610a4757610a466133b5565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aab9061330e565b915050610a25565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610af861125a565b73ffffffffffffffffffffffffffffffffffffffff1614610b1857600080fd5b6000610b2330610765565b9050610b2e81611db9565b50565b610b3961125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbd90612f38565b60405180910390fd5b600f60149054906101000a900460ff1615610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612fb8565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ca530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611262565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ceb57600080fd5b505afa158015610cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d23919061289d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8557600080fd5b505afa158015610d99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbd919061289d565b6040518363ffffffff1660e01b8152600401610dda929190612d88565b602060405180830381600087803b158015610df457600080fd5b505af1158015610e08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2c919061289d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eb530610765565b600080610ec0610909565b426040518863ffffffff1660e01b8152600401610ee296959493929190612dda565b6060604051808303818588803b158015610efb57600080fd5b505af1158015610f0f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f349190612a6d565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506658d15e176280006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611035929190612db1565b602060405180830381600087803b15801561104f57600080fd5b505af1158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110879190612a13565b5050565b61109361125a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611120576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111790612f38565b60405180910390fd5b60008111611163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115a90612ef8565b60405180910390fd5b611191606461118383670de0b6b3a764000061204190919063ffffffff16565b6120bc90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111c89190612ff8565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c990612f98565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133990612eb8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114209190612ff8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561149d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149490612f78565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150490612e78565b60405180910390fd5b60008111611550576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154790612f58565b60405180910390fd5b611558610909565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115c65750611596610909565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b2957600f60179054906101000a900460ff16156117f9573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116a25750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156116fc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156117f857600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661174261125a565b73ffffffffffffffffffffffffffffffffffffffff1614806117b85750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117a061125a565b73ffffffffffffffffffffffffffffffffffffffff16145b6117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ee90612fd8565b60405180910390fd5b5b5b60105481111561180857600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118ac5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118b557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119605750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119b65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ce5750600f60179054906101000a900460ff165b15611a6f5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1e57600080fd5b600a42611a2b919061312e565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a7a30610765565b9050600f60159054906101000a900460ff16158015611ae75750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611aff5750600f60169054906101000a900460ff165b15611b2757611b0d81611db9565b60004790506000811115611b2557611b2447611c50565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bd05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bda57600090505b611be684848484612106565b50505050565b6000838311158290611c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2b9190612e56565b60405180910390fd5b5060008385611c43919061320f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ca06002846120bc90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ccb573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d1c6002846120bc90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d47573d6000803e3d6000fd5b5050565b6000600654821115611d92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8990612e98565b60405180910390fd5b6000611d9c612133565b9050611db181846120bc90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611df157611df06133e4565b5b604051908082528060200260200182016040528015611e1f5781602001602082028036833780820191505090505b5090503081600081518110611e3757611e366133b5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ed957600080fd5b505afa158015611eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f11919061289d565b81600181518110611f2557611f246133b5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f8c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611262565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ff0959493929190613013565b600060405180830381600087803b15801561200a57600080fd5b505af115801561201e573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561205457600090506120b6565b6000828461206291906131b5565b90508284826120719190613184565b146120b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a890612f18565b60405180910390fd5b809150505b92915050565b60006120fe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061215e565b905092915050565b80612114576121136121c1565b5b61211f8484846121f2565b8061212d5761212c6123bd565b5b50505050565b60008060006121406123cf565b9150915061215781836120bc90919063ffffffff16565b9250505090565b600080831182906121a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219c9190612e56565b60405180910390fd5b50600083856121b49190613184565b9050809150509392505050565b60006008541480156121d557506000600954145b156121df576121f0565b600060088190555060006009819055505b565b6000806000806000806122048761242e565b95509550955095509550955061226286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122f785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123438161253e565b61234d84836125fb565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123aa9190612ff8565b60405180910390a3505050505050505050565b60046008819055506004600981905550565b600080600060065490506000670de0b6b3a76400009050612403670de0b6b3a76400006006546120bc90919063ffffffff16565b82101561242157600654670de0b6b3a764000093509350505061242a565b81819350935050505b9091565b600080600080600080600080600061244b8a600854600954612635565b925092509250600061245b612133565b9050600080600061246e8e8787876126cb565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124d883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bec565b905092915050565b60008082846124ef919061312e565b905083811015612534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252b90612ed8565b60405180910390fd5b8091505092915050565b6000612548612133565b9050600061255f828461204190919063ffffffff16565b90506125b381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126108260065461249690919063ffffffff16565b60068190555061262b816007546124e090919063ffffffff16565b6007819055505050565b6000806000806126616064612653888a61204190919063ffffffff16565b6120bc90919063ffffffff16565b9050600061268b606461267d888b61204190919063ffffffff16565b6120bc90919063ffffffff16565b905060006126b4826126a6858c61249690919063ffffffff16565b61249690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126e4858961204190919063ffffffff16565b905060006126fb868961204190919063ffffffff16565b90506000612712878961204190919063ffffffff16565b9050600061273b8261272d858761249690919063ffffffff16565b61249690919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612767612762846130ad565b613088565b9050808382526020820190508285602086028201111561278a57612789613418565b5b60005b858110156127ba57816127a088826127c4565b84526020840193506020830192505060018101905061278d565b5050509392505050565b6000813590506127d38161372e565b92915050565b6000815190506127e88161372e565b92915050565b600082601f83011261280357612802613413565b5b8135612813848260208601612754565b91505092915050565b60008135905061282b81613745565b92915050565b60008151905061284081613745565b92915050565b6000813590506128558161375c565b92915050565b60008151905061286a8161375c565b92915050565b60006020828403121561288657612885613422565b5b6000612894848285016127c4565b91505092915050565b6000602082840312156128b3576128b2613422565b5b60006128c1848285016127d9565b91505092915050565b600080604083850312156128e1576128e0613422565b5b60006128ef858286016127c4565b9250506020612900858286016127c4565b9150509250929050565b60008060006060848603121561292357612922613422565b5b6000612931868287016127c4565b9350506020612942868287016127c4565b925050604061295386828701612846565b9150509250925092565b6000806040838503121561297457612973613422565b5b6000612982858286016127c4565b925050602061299385828601612846565b9150509250929050565b6000602082840312156129b3576129b2613422565b5b600082013567ffffffffffffffff8111156129d1576129d061341d565b5b6129dd848285016127ee565b91505092915050565b6000602082840312156129fc576129fb613422565b5b6000612a0a8482850161281c565b91505092915050565b600060208284031215612a2957612a28613422565b5b6000612a3784828501612831565b91505092915050565b600060208284031215612a5657612a55613422565b5b6000612a6484828501612846565b91505092915050565b600080600060608486031215612a8657612a85613422565b5b6000612a948682870161285b565b9350506020612aa58682870161285b565b9250506040612ab68682870161285b565b9150509250925092565b6000612acc8383612ad8565b60208301905092915050565b612ae181613243565b82525050565b612af081613243565b82525050565b6000612b01826130e9565b612b0b818561310c565b9350612b16836130d9565b8060005b83811015612b47578151612b2e8882612ac0565b9750612b39836130ff565b925050600181019050612b1a565b5085935050505092915050565b612b5d81613255565b82525050565b612b6c81613298565b82525050565b6000612b7d826130f4565b612b87818561311d565b9350612b978185602086016132aa565b612ba081613427565b840191505092915050565b6000612bb860238361311d565b9150612bc382613438565b604082019050919050565b6000612bdb602a8361311d565b9150612be682613487565b604082019050919050565b6000612bfe60228361311d565b9150612c09826134d6565b604082019050919050565b6000612c21601b8361311d565b9150612c2c82613525565b602082019050919050565b6000612c44601d8361311d565b9150612c4f8261354e565b602082019050919050565b6000612c6760218361311d565b9150612c7282613577565b604082019050919050565b6000612c8a60208361311d565b9150612c95826135c6565b602082019050919050565b6000612cad60298361311d565b9150612cb8826135ef565b604082019050919050565b6000612cd060258361311d565b9150612cdb8261363e565b604082019050919050565b6000612cf360248361311d565b9150612cfe8261368d565b604082019050919050565b6000612d1660178361311d565b9150612d21826136dc565b602082019050919050565b6000612d3960118361311d565b9150612d4482613705565b602082019050919050565b612d5881613281565b82525050565b612d678161328b565b82525050565b6000602082019050612d826000830184612ae7565b92915050565b6000604082019050612d9d6000830185612ae7565b612daa6020830184612ae7565b9392505050565b6000604082019050612dc66000830185612ae7565b612dd36020830184612d4f565b9392505050565b600060c082019050612def6000830189612ae7565b612dfc6020830188612d4f565b612e096040830187612b63565b612e166060830186612b63565b612e236080830185612ae7565b612e3060a0830184612d4f565b979650505050505050565b6000602082019050612e506000830184612b54565b92915050565b60006020820190508181036000830152612e708184612b72565b905092915050565b60006020820190508181036000830152612e9181612bab565b9050919050565b60006020820190508181036000830152612eb181612bce565b9050919050565b60006020820190508181036000830152612ed181612bf1565b9050919050565b60006020820190508181036000830152612ef181612c14565b9050919050565b60006020820190508181036000830152612f1181612c37565b9050919050565b60006020820190508181036000830152612f3181612c5a565b9050919050565b60006020820190508181036000830152612f5181612c7d565b9050919050565b60006020820190508181036000830152612f7181612ca0565b9050919050565b60006020820190508181036000830152612f9181612cc3565b9050919050565b60006020820190508181036000830152612fb181612ce6565b9050919050565b60006020820190508181036000830152612fd181612d09565b9050919050565b60006020820190508181036000830152612ff181612d2c565b9050919050565b600060208201905061300d6000830184612d4f565b92915050565b600060a0820190506130286000830188612d4f565b6130356020830187612b63565b81810360408301526130478186612af6565b90506130566060830185612ae7565b6130636080830184612d4f565b9695505050505050565b60006020820190506130826000830184612d5e565b92915050565b60006130926130a3565b905061309e82826132dd565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c8576130c76133e4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313982613281565b915061314483613281565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317957613178613357565b5b828201905092915050565b600061318f82613281565b915061319a83613281565b9250826131aa576131a9613386565b5b828204905092915050565b60006131c082613281565b91506131cb83613281565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320457613203613357565b5b828202905092915050565b600061321a82613281565b915061322583613281565b92508282101561323857613237613357565b5b828203905092915050565b600061324e82613261565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132a382613281565b9050919050565b60005b838110156132c85780820151818401526020810190506132ad565b838111156132d7576000848401525b50505050565b6132e682613427565b810181811067ffffffffffffffff82111715613305576133046133e4565b5b80604052505050565b600061331982613281565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334c5761334b613357565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61373781613243565b811461374257600080fd5b50565b61374e81613255565b811461375957600080fd5b50565b61376581613281565b811461377057600080fd5b5056fe42654072427269636b46616e73436c756220542e6d652f42656172427269636b546f6b656e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205c7e68be50a9df0bad633d7f07df58dbc5edfd38adcc529cbff517c73f0ce49764736f6c63430008070033 | {"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"}]}} | 1,519 |
0xe73f0398e64be73982b7ee20a7d2a234b68f9321 | pragma solidity 0.4.24;
// ----------------------------------------------------------------------------
// ConsenSys/Gnosis MultiSig for 'UCOT' from:
// https://github.com/ConsenSys/MultiSigWallet/commit/359c4efb482d97f6a0c0dbea8cd4b95add13bcc4
//
// Deployed by Radek Ostrowski / http://startonchain.com
// Third-Party Software Disclaimer: Contract is deployed “as is”, without warranty of any kind,
// either expressed or implied and such software is to be used at your own risk.
// ----------------------------------------------------------------------------
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a72305820622ff41c37f944bdaf7bf106ba4a2cea4a5a00526cd6e4f868d45ecb31a2a5400029 | {"success": true, "error": null, "results": {}} | 1,520 |
0x6610d1a5c5b90515fa53f62a07f4490ccfaad88d | /**
*Submitted for verification at Etherscan.io on 2021-05-21
*/
pragma solidity ^0.5.4;
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
);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
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);
}
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);
}
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);
}
}
contract KMX is ERC20 {
string public constant name = "Korea Mainnet X";
string public constant symbol = "KMX";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 4000000000 * (10**uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function dropToken(address[] memory _receivers, uint256[] memory _values) public onlyOwner {
require(_receivers.length != 0);
require(_receivers.length == _values.length);
for (uint256 i = 0; i < _receivers.length; i++) {
transfer(_receivers[i], _values[i]);
emit Transfer(msg.sender, _receivers[i], _values[i]);
}
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(address _to, uint256 _value)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public whenNotPaused returns (bool) {
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return super.balanceOf(_holder).add(lockedBalance);
}
function balanceOfLocked(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime > now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return lockedBalance;
}
function balanceOfTotal(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder]
.length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx)
public
view
returns (uint256, uint256)
{
return (
lockInfo[_holder][_idx].releaseTime,
lockInfo[_holder][_idx].balance
);
}
function lock(
address _holder,
uint256 _amount,
uint256 _releaseTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(_releaseTime, _amount));
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(
address _holder,
uint256 _amount,
uint256 _afterTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(now + _afterTime, _amount));
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length -
1];
}
lockInfo[_holder].length--;
}
function transferWithLock(
address _to,
uint256 _value,
uint256 _releaseTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(_releaseTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(
address _to,
uint256 _value,
uint256 _afterTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(now + _afterTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
} | 0x608060405234801561001057600080fd5b50600436106102115760003560e01c80638a57af6b11610125578063d18e81b3116100ad578063df0345861161007c578063df0345861461078c578063e2ab691d146107b2578063e5839836146107e4578063e960bb481461080a578063f2fde38b1461083057610211565b8063d18e81b3146106fe578063d29dad8314610706578063dd62ed3e1461072c578063de6baccb1461075a57610211565b806395d89b41116100f457806395d89b411461054b5780639dc29fac14610553578063a457c2d71461057f578063a9059cbb146105ab578063c77828d0146105d757610211565b80638a57af6b1461049d5780638d1fdf2f146104cf5780638da5cb5b146104f5578063927a4a7b1461051957610211565b80633f4ba83a116101a85780635c975abb116101775780635c975abb1461043357806370a082311461043b578063715018a6146104615780637eee288d146104695780638456cb591461049557610211565b80633f4ba83a1461039257806340c10f191461039c57806345c8b1a6146103c857806346cf1bb5146103ee57610211565b806323b872dd116101e457806323b872dd1461030a578063313ce56714610340578063378dc3dc1461035e578063395093511461036657610211565b806304859ceb1461021657806306fdde0314610245578063095ea7b3146102c257806318160ddd14610302575b600080fd5b6102336004803603602081101561022c57600080fd5b5035610856565b60408051918252519081900360200190f35b61024d61085b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028757818101518382015260200161026f565b50505050905090810190601f1680156102b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102ee600480360360408110156102d857600080fd5b506001600160a01b038135169060200135610886565b604080519115158252519081900360200190f35b610233610902565b6102ee6004803603606081101561032057600080fd5b506001600160a01b03813581169160208101359091169060400135610909565b6103486109e7565b6040805160ff9092168252519081900360200190f35b6102336109ec565b6102ee6004803603604081101561037c57600080fd5b506001600160a01b0381351690602001356109fc565b61039a610aaa565b005b6102ee600480360360408110156103b257600080fd5b506001600160a01b038135169060200135610b7c565b61039a600480360360208110156103de57600080fd5b50356001600160a01b0316610c1c565b61041a6004803603604081101561040457600080fd5b506001600160a01b038135169060200135610cbf565b6040805192835260208301919091528051918290030190f35b6102ee610d38565b6102336004803603602081101561045157600080fd5b50356001600160a01b0316610d48565b61039a610e21565b61039a6004803603604081101561047f57600080fd5b506001600160a01b038135169060200135610eb6565b61039a611152565b61039a600480360360608110156104b357600080fd5b506001600160a01b03813516906020810135906040013561122c565b61039a600480360360208110156104e557600080fd5b50356001600160a01b031661137f565b6104fd611425565b604080516001600160a01b039092168252519081900360200190f35b6102ee6004803603606081101561052f57600080fd5b506001600160a01b038135169060208101359060400135611434565b61024d61161b565b61039a6004803603604081101561056957600080fd5b506001600160a01b03813516906020013561163a565b6102ee6004803603604081101561059557600080fd5b506001600160a01b038135169060200135611727565b6102ee600480360360408110156105c157600080fd5b506001600160a01b038135169060200135611770565b61039a600480360360408110156105ed57600080fd5b81019060208101813564010000000081111561060857600080fd5b82018360208201111561061a57600080fd5b8035906020019184602083028401116401000000008311171561063c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611839945050505050565b610233611941565b6102336004803603602081101561071c57600080fd5b50356001600160a01b0316611945565b6102336004803603604081101561074257600080fd5b506001600160a01b038135811691602001351661199d565b6102ee6004803603606081101561077057600080fd5b506001600160a01b0381351690602081013590604001356119c8565b610233600480360360208110156107a257600080fd5b50356001600160a01b0316611bac565b61039a600480360360608110156107c857600080fd5b506001600160a01b038135169060208101359060400135611bc7565b6102ee600480360360208110156107fa57600080fd5b50356001600160a01b0316611d13565b6102336004803603602081101561082057600080fd5b50356001600160a01b0316611d31565b61039a6004803603602081101561084657600080fd5b50356001600160a01b0316611dd0565b420190565b6040518060400160405280600f81526020016e096dee4cac2409ac2d2dcdccae840b608b1b81525081565b60006001600160a01b03831661089b57600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6002545b90565b600354600090600160a01b900460ff161561095d576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156109cb576040805162461bcd60e51b815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6109d484611e27565b6109df84848461204a565b949350505050565b601281565b6b0cecb8f27f4200f3a000000081565b60006001600160a01b038316610a1157600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a45908363ffffffff61211316565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6003546001600160a01b03163314610af5576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16610b44576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420706175736564206e6f7760901b604482015290519081900360640190fd5b6003805460ff60a01b191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546000906001600160a01b03163314610bca576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b610bd48383612125565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b6003546001600160a01b03163314610c67576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b0382166000908152600560205260408120805482919084908110610ce657fe5b600091825260208083206002909202909101546001600160a01b038716835260059091526040909120805485908110610d1b57fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b038416600090815260056020526040902054811015610e00576001600160a01b0384166000908152600560205260409020805442919083908110610d9457fe5b90600052602060002090600202016000015411610df8576001600160a01b03841660009081526005602052604090208054610df5919083908110610dd457fe5b9060005260206000209060020201600101548361211390919063ffffffff16565b91505b600101610d4d565b50610e1a81610e0e856121bb565b9063ffffffff61211316565b9392505050565b6003546001600160a01b03163314610e6c576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6003546040516001600160a01b03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600380546001600160a01b0319169055565b6003546001600160a01b03163314610f01576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610f64576040805162461bcd60e51b81526020600482015260146024820152732737903637b1b59034b73337b936b0ba34b7b71760611b604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610fc6919083908110610f8d57fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61211316565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061101a57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b038216600090815260056020526040812080548390811061106557fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611124576001600160a01b0382166000908152600560205260409020805460001981019081106110c757fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061110557fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b038216600090815260056020526040902080549061114d9060001983016123f6565b505050565b6003546001600160a01b0316331461119d576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16156111ee576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6003805460ff60a01b1916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314611277576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b81611281846121bb565b10156112cc576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b0383166000908152602081905260409020546112f5908363ffffffff6121d616565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186524287018082528184018981528354600181810186559487529585902092516002909602909201948555905193909101929092558351868152908101919091528251919260008051602061245f83398151915292918290030190a2505050565b6003546001600160a01b031633146113ca576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b6003546000906001600160a01b03163314611482576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0384166114cd576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b6003546114e2906001600160a01b03166121bb565b83111561152b576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611556908463ffffffff6121d616565b600380546001600160a01b03908116600090815260208181526040808320959095558883168083526005825285832086518088018852428a0181528084018b8152825460018181018555938752958590209151600290960290910194855551930192909255925484518881529451919492169260008051602061243f833981519152928290030190a360408051848152428401602082015281516001600160a01b0387169260008051602061245f833981519152928290030190a25060019392505050565b604051806040016040528060038152602001620969ab60eb1b81525081565b6003546001600160a01b03163314611685576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b61168e826121bb565b8111156116da576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6116e482826121eb565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60006001600160a01b03831661173c57600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a45908363ffffffff6121d616565b3360009081526004602052604081205460ff16156117d5576040805162461bcd60e51b815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff1615611826576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b61182f33611e27565b610e1a8383612280565b6003546001600160a01b03163314611884576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b815161188f57600080fd5b805182511461189d57600080fd5b60005b825181101561114d576118d98382815181106118b857fe5b60200260200101518383815181106118cc57fe5b6020026020010151611770565b508281815181106118e657fe5b60200260200101516001600160a01b0316336001600160a01b031660008051602061243f83398151915284848151811061191c57fe5b60200260200101516040518082815260200191505060405180910390a36001016118a0565b4290565b600080805b6001600160a01b038416600090815260056020526040902054811015610e00576001600160a01b03841660009081526005602052604090208054611993919083908110610dd457fe5b915060010161194a565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b03163314611a16576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038416611a61576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b600354611a76906001600160a01b03166121bb565b831115611abf576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611aea908463ffffffff6121d616565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b8152825460018181018555938752958590209151600290960290910194855551930192909255925484518881529451919492169260008051602061243f833981519152928290030190a3604080518481526020810184905281516001600160a01b0387169260008051602061245f833981519152928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b03163314611c12576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b81611c1c846121bb565b1015611c67576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611c90908363ffffffff6121d616565b6001600160a01b03841660008181526020818152604080832094909455600581528382208451808601865286815280830188815282546001818101855593865294849020915160029095029091019384555192019190915582518581529081018490528251919260008051602061245f83398151915292918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b600080805b6001600160a01b038416600090815260056020526040902054811015611dc9576001600160a01b0384166000908152600560205260409020805442919083908110611d7d57fe5b9060005260206000209060020201600001541115611dc1576001600160a01b03841660009081526005602052604090208054611dbe919083908110610dd457fe5b91505b600101611d36565b5092915050565b6003546001600160a01b03163314611e1b576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b611e2481612296565b50565b60005b6001600160a01b038216600090815260056020526040902054811015612046576001600160a01b0382166000908152600560205260409020805442919083908110611e7157fe5b9060005260206000209060020201600001541161203e576001600160a01b03821660009081526005602052604090208054611eb1919083908110610f8d57fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110611f0557fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110611f5057fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114612013576001600160a01b038216600090815260056020526040902080546000198101908110611fb257fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611ff057fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b038216600090815260056020526040902080549061203c9060001983016123f6565b505b600101611e2a565b5050565b6001600160a01b038316600090815260016020908152604080832033845290915281205461207e908363ffffffff6121d616565b6001600160a01b03851660009081526001602090815260408083203384529091529020556120ad84848461233d565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082820183811015610e1a57600080fd5b6001600160a01b03821661213857600080fd5b60025461214b908263ffffffff61211316565b6002556001600160a01b038216600090815260208190526040902054612177908263ffffffff61211316565b6001600160a01b03831660008181526020818152604080832094909455835185815293519293919260008051602061243f8339815191529281900390910190a35050565b6001600160a01b031660009081526020819052604090205490565b6000828211156121e557600080fd5b50900390565b6001600160a01b0382166121fe57600080fd5b600254612211908263ffffffff6121d616565b6002556001600160a01b03821660009081526020819052604090205461223d908263ffffffff6121d616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351919360008051602061243f833981519152929081900390910190a35050565b600061228d33848461233d565b50600192915050565b6001600160a01b0381166122e1576040805162461bcd60e51b815260206004820152600d60248201526c20b63932b0b23c9037bbb732b960991b604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03821661235057600080fd5b6001600160a01b038316600090815260208190526040902054612379908263ffffffff6121d616565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546123ae908263ffffffff61211316565b6001600160a01b0380841660008181526020818152604091829020949094558051858152905191939287169260008051602061243f83398151915292918290030190a3505050565b81548183558181111561114d5760008381526020902061114d916109069160029182028101918502015b8082111561243a5760008082556001820155600201612420565b509056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557ba265627a7a72315820c671b842eec8d76a9e7c14552f948a8e40f0215150bcfa125aa053ebf586e32464736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,521 |
0xb51fd313a0b399d617723f9a6224e46ccdcea75d | pragma solidity 0.5.10;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract SmartYields {
using SafeMath for uint256;
uint256[] public REFERRAL_PERCENTS = [50, 40, 30];
uint256[] public BONUS_PERCENTS = [100, 150, 200, 250, 300];
uint256 constant public TOTAL_REF = 120;
uint256 constant public PROJECT_FEE = 100;
uint256 constant public HOLD_BONUS = 10;
uint256 constant public PERCENTS_DIVIDER = 1000;
uint256 constant public TIME_STEP = 1 days;
uint256 public totalInvested;
uint256 public totalBonus;
uint256 public INVEST_MIN_AMOUNT = 0.2 ether;
uint256 public BONUS_MIN_AMOUNT = 0.2 ether;
bool public bonusStatus = false;
struct Plan {
uint256 time;
uint256 percent;
}
Plan[] internal plans;
struct Deposit {
uint8 plan;
uint256 amount;
uint256 start;
}
struct User {
Deposit[] deposits;
uint256 checkpoint;
address referrer;
uint256[3] levels;
uint256 bonus;
uint256 totalBonus;
uint256 withdrawn;
}
mapping (address => User) internal users;
mapping (address => mapping(uint256 => uint256)) internal userDepositBonus;
uint256 public startDate;
address payable public ceoWallet;
event Newbie(address user);
event NewDeposit(address indexed user, uint8 plan, uint256 amount, uint256 time);
event Withdrawn(address indexed user, uint256 amount);
event RefBonus(address indexed referrer, address indexed referral, uint256 indexed level, uint256 amount);
event FeePayed(address indexed user, uint256 totalAmount);
constructor(address payable ceoAddr, uint256 start) public {
require(!isContract(ceoAddr) );
ceoWallet = ceoAddr;
if(start>0){
startDate = start;
}
else{
startDate = block.timestamp;
}
plans.push(Plan(40, 50)); // 200%
plans.push(Plan(60, 40)); // 240%
plans.push(Plan(100, 30)); // 300%
}
function invest(address referrer, uint8 plan) public payable {
require(block.timestamp > startDate, "contract does not launch yet");
require(msg.value >= INVEST_MIN_AMOUNT,"error min");
require(plan < 4, "Invalid plan");
uint256 pFee = msg.value.mul(PROJECT_FEE).div(PERCENTS_DIVIDER);
ceoWallet.transfer(pFee);
emit FeePayed(msg.sender, pFee);
User storage user = users[msg.sender];
if (user.referrer == address(0)) {
if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
user.referrer = referrer;
}
else{
user.referrer = ceoWallet;
}
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
users[upline].levels[i] = users[upline].levels[i].add(1);
upline = users[upline].referrer;
} else break;
}
}
if (user.referrer != address(0)) {
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
uint256 amount = msg.value.mul(REFERRAL_PERCENTS[i]).div(PERCENTS_DIVIDER);
users[upline].bonus = users[upline].bonus.add(amount);
users[upline].totalBonus = users[upline].totalBonus.add(amount);
emit RefBonus(upline, msg.sender, i, amount);
upline = users[upline].referrer;
} else break;
}
}
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newbie(msg.sender);
}
user.deposits.push(Deposit(plan, msg.value, block.timestamp));
totalInvested = totalInvested.add(msg.value);
emit NewDeposit(msg.sender, plan, msg.value, block.timestamp);
//bonus
if(bonusStatus){
if(user.deposits.length >= 2 && user.deposits.length <=5){
uint256 firstAmount = user.deposits[0].amount;
if(firstAmount >= BONUS_MIN_AMOUNT ){
uint256 preAmount = user.deposits[user.deposits.length -2].amount;
if(user.deposits.length == 2){
if(preAmount == msg.value){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[0];
}
else if( msg.value > preAmount ){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[1];
}
}
else if(user.deposits.length == 3){
if(preAmount == msg.value){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[0];
}
else if( msg.value > preAmount ){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[2];
}
}
else if(user.deposits.length == 4){
if(preAmount == msg.value){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[0];
}
else if( msg.value > preAmount){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[3];
}
}
else if(user.deposits.length == 5){
if(preAmount == msg.value){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[0];
}
else if( msg.value > preAmount){
userDepositBonus[msg.sender][user.deposits.length-1] = BONUS_PERCENTS[4];
}
}
totalBonus = totalBonus.add(userDepositBonus[msg.sender][user.deposits.length-1].mul(msg.value).div(PERCENTS_DIVIDER));
}
}
}
}
function withdraw() public {
User storage user = users[msg.sender];
uint256 totalAmount = getUserDividends(msg.sender);
uint256 referralBonus = getUserReferralBonus(msg.sender);
if (referralBonus > 0) {
user.bonus = 0;
totalAmount = totalAmount.add(referralBonus);
}
require(totalAmount > 0, "User has no dividends");
uint256 contractBalance = address(this).balance;
if (contractBalance < totalAmount) {
user.bonus = totalAmount.sub(contractBalance);
totalAmount = contractBalance;
}
user.checkpoint = block.timestamp;
user.withdrawn = user.withdrawn.add(totalAmount);
msg.sender.transfer(totalAmount);
emit Withdrawn(msg.sender, totalAmount);
}
function getContractBalance() public view returns (uint256) {
return address(this).balance;
}
function getPlanInfo(uint8 plan) public view returns(uint256 time, uint256 percent) {
time = plans[plan].time;
percent = plans[plan].percent;
}
function getUserDividends(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
uint256 totalAmount;
for (uint256 i = 0; i < user.deposits.length; i++) {
uint256 finish = user.deposits[i].start.add(plans[user.deposits[i].plan].time.mul(TIME_STEP));
if (user.checkpoint < finish) {
uint256 share = user.deposits[i].amount.mul(plans[user.deposits[i].plan].percent).div(PERCENTS_DIVIDER);
uint256 from = user.deposits[i].start > user.checkpoint ? user.deposits[i].start : user.checkpoint;
uint256 to = finish < block.timestamp ? finish : block.timestamp;
if (from < to) {
totalAmount = totalAmount.add(share.mul(to.sub(from)).div(TIME_STEP));
uint256 holdDays = (to.sub(from)).div(TIME_STEP);
if(holdDays > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(HOLD_BONUS.mul(holdDays)).div(PERCENTS_DIVIDER));
}
}
//end of plan
if(finish <= block.timestamp){
if(userDepositBonus[msg.sender][i] > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(userDepositBonus[msg.sender][i]).div(PERCENTS_DIVIDER));
}
}
}
}
return totalAmount;
}
function getUserHoldBonus(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
if(user.checkpoint > 0){
uint256 holdBonus = 0;
if (user.checkpoint < block.timestamp) {
uint256 holdDays = (block.timestamp.sub(user.checkpoint)).div(TIME_STEP);
if(holdDays > 0){
holdBonus = holdDays.mul(HOLD_BONUS);
}
}
return holdBonus;
}
else{
return 0;
}
}
function getUserTotalWithdrawn(address userAddress) public view returns (uint256) {
return users[userAddress].withdrawn;
}
function getUserCheckpoint(address userAddress) public view returns(uint256) {
return users[userAddress].checkpoint;
}
function getUserReferrer(address userAddress) public view returns(address) {
return users[userAddress].referrer;
}
function getUserDownlineCount(address userAddress) public view returns(uint256[3] memory referrals) {
return (users[userAddress].levels);
}
function getUserTotalReferrals(address userAddress) public view returns(uint256) {
return users[userAddress].levels[0]+users[userAddress].levels[1]+users[userAddress].levels[2];
}
function getUserReferralBonus(address userAddress) public view returns(uint256) {
return users[userAddress].bonus;
}
function getUserReferralTotalBonus(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus;
}
function getUserReferralWithdrawn(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus.sub(users[userAddress].bonus);
}
function getUserAvailable(address userAddress) public view returns(uint256) {
return getUserReferralBonus(userAddress).add(getUserDividends(userAddress));
}
function getUserAmountOfDeposits(address userAddress) public view returns(uint256) {
return users[userAddress].deposits.length;
}
function getUserTotalDeposits(address userAddress) public view returns(uint256 amount) {
for (uint256 i = 0; i < users[userAddress].deposits.length; i++) {
amount = amount.add(users[userAddress].deposits[i].amount);
}
}
function getUserDepositInfo(address userAddress, uint256 index) public view returns(uint8 plan, uint256 percent, uint256 amount, uint256 start, uint256 finish) {
User storage user = users[userAddress];
plan = user.deposits[index].plan;
percent = plans[plan].percent;
amount = user.deposits[index].amount;
start = user.deposits[index].start;
finish = user.deposits[index].start.add(plans[user.deposits[index].plan].time.mul(TIME_STEP));
}
function getSiteInfo() public view returns(uint256 _totalInvested, uint256 _totalRef, uint256 _totalBonus) {
return(totalInvested, totalInvested.mul(TOTAL_REF).div(PERCENTS_DIVIDER),totalBonus);
}
function getUserInfo(address userAddress) public view returns(uint256 totalDeposit, uint256 totalWithdrawn, uint256 totalReferrals) {
return(getUserTotalDeposits(userAddress), getUserTotalWithdrawn(userAddress), getUserTotalReferrals(userAddress));
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
//config
function setMinMax(uint256 minAmount, uint256 minBonus) external {
require(msg.sender == ceoWallet, "only owner");
INVEST_MIN_AMOUNT = minAmount;
BONUS_MIN_AMOUNT = minBonus;
}
function setBonusStatus(bool status) external {
require(msg.sender == ceoWallet, "only owner");
bonusStatus = status;
}
function withdrawTokens(address tokenAddr, address to) external {
require(msg.sender == ceoWallet, "only owner");
IERC20 token = IERC20(tokenAddr);
token.transfer(to,token.balanceOf(address(this)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
} | 0x60806040526004361061021a5760003560e01c80636386c1c711610123578063aecaa634116100ab578063d7ffca911161006f578063d7ffca91146107a5578063e262113e146107d8578063e85abe09146107ed578063fb4cb32b14610820578063fbfcb279146108535761021a565b8063aecaa634146106a3578063b668ac4b146106e9578063c0806b03146106fe578063c43a180814610766578063cd23b441146107905761021a565b8063a0aafaa7116100f2578063a0aafaa7146105c4578063a522ad25146105f0578063a681f9501461062b578063a8aeb6c21461065b578063a8dd07dc1461068e5761021a565b80636386c1c7146105165780636bb18556146105495780636f9fb98a1461057c5780637e3abeea146105915761021a565b80633ccfd60b116101a65780634bc4e085116101755780634bc4e085146104605780634ce87053146104755780635216aeec146104a8578063581c5ae6146104bd578063600d20ce146104ec5761021a565b80633ccfd60b146103ce57806348c37203146103e557806348d44bd1146104185780634a64e8671461042d5761021a565b8063153ab9df116101ed578063153ab9df146102f957806329420b741461032c57806332bc298c1461035557806336144c9a1461036a578063389cabee146103b95761021a565b806301c234a81461021f57806303a93c0c14610246578063040a772e146102b15780630b97bc86146102e4575b600080fd5b34801561022b57600080fd5b50610234610886565b60408051918252519081900360200190f35b34801561025257600080fd5b506102796004803603602081101561026957600080fd5b50356001600160a01b031661088c565b6040518082606080838360005b8381101561029e578181015183820152602001610286565b5050505090500191505060405180910390f35b3480156102bd57600080fd5b50610234600480360360208110156102d457600080fd5b50356001600160a01b03166108e3565b3480156102f057600080fd5b50610234610bb1565b34801561030557600080fd5b506102346004803603602081101561031c57600080fd5b50356001600160a01b0316610bb7565b34801561033857600080fd5b50610341610be0565b604080519115158252519081900360200190f35b34801561036157600080fd5b50610234610be9565b34801561037657600080fd5b5061039d6004803603602081101561038d57600080fd5b50356001600160a01b0316610bf0565b604080516001600160a01b039092168252519081900360200190f35b3480156103c557600080fd5b5061039d610c11565b3480156103da57600080fd5b506103e3610c20565b005b3480156103f157600080fd5b506102346004803603602081101561040857600080fd5b50356001600160a01b0316610d62565b34801561042457600080fd5b50610234610d80565b34801561043957600080fd5b506102346004803603602081101561045057600080fd5b50356001600160a01b0316610d85565b34801561046c57600080fd5b50610234610e0d565b34801561048157600080fd5b5061048a610e12565b60408051938452602084019290925282820152519081900360600190f35b3480156104b457600080fd5b50610234610e41565b6103e3600480360360408110156104d357600080fd5b5080356001600160a01b0316906020013560ff16610e47565b3480156104f857600080fd5b506102346004803603602081101561050f57600080fd5b50356115a2565b34801561052257600080fd5b5061048a6004803603602081101561053957600080fd5b50356001600160a01b03166115c0565b34801561055557600080fd5b506102346004803603602081101561056c57600080fd5b50356001600160a01b03166115ed565b34801561058857600080fd5b5061023461161f565b34801561059d57600080fd5b50610234600480360360208110156105b457600080fd5b50356001600160a01b0316611624565b3480156105d057600080fd5b506103e3600480360360208110156105e757600080fd5b5035151561169c565b3480156105fc57600080fd5b506103e36004803603604081101561061357600080fd5b506001600160a01b03813581169160200135166116fb565b34801561063757600080fd5b506103e36004803603604081101561064e57600080fd5b508035906020013561183e565b34801561066757600080fd5b506102346004803603602081101561067e57600080fd5b50356001600160a01b0316611895565b34801561069a57600080fd5b506102346118b0565b3480156106af57600080fd5b506106d0600480360360208110156106c657600080fd5b503560ff166118b6565b6040805192835260208301919091528051918290030190f35b3480156106f557600080fd5b50610234611906565b34801561070a57600080fd5b506107376004803603604081101561072157600080fd5b506001600160a01b03813516906020013561190b565b6040805160ff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b34801561077257600080fd5b506102346004803603602081101561078957600080fd5b50356119f1565b34801561079c57600080fd5b506102346119fe565b3480156107b157600080fd5b50610234600480360360208110156107c857600080fd5b50356001600160a01b0316611a04565b3480156107e457600080fd5b50610234611a22565b3480156107f957600080fd5b506102346004803603602081101561081057600080fd5b50356001600160a01b0316611a28565b34801561082c57600080fd5b506102346004803603602081101561084357600080fd5b50356001600160a01b0316611a46565b34801561085f57600080fd5b506102346004803603602081101561087657600080fd5b50356001600160a01b0316611a65565b6103e881565b610894611c14565b6001600160a01b0382166000908152600860205260409081902081516060810192839052916003918201919082845b8154815260200190600101908083116108c357505050505090505b919050565b6001600160a01b038116600090815260086020526040812081805b8254811015610ba957600061099161096262015180600787600001868154811061092457fe5b6000918252602090912060039091020154815460ff90911690811061094557fe5b60009182526020909120600290910201549063ffffffff611a9316565b85600001848154811061097157fe5b906000526020600020906003020160020154611af390919063ffffffff16565b90508084600101541015610ba0576000610a296103e8610a1d60078860000187815481106109bb57fe5b6000918252602090912060039091020154815460ff9091169081106109dc57fe5b9060005260206000209060020201600101548860000187815481106109fd57fe5b906000526020600020906003020160010154611a9390919063ffffffff16565b9063ffffffff611b4d16565b905060008560010154866000018581548110610a4157fe5b90600052602060002090600302016002015411610a62578560010154610a84565b856000018481548110610a7157fe5b9060005260206000209060030201600201545b90506000428410610a955742610a97565b835b905080821015610b3957610ad8610acb62015180610a1d610abe858763ffffffff611bb716565b879063ffffffff611a9316565b879063ffffffff611af316565b95506000610af362015180610a1d848663ffffffff611bb716565b90508015610b3757610b34610b276103e8610a1d610b18600a8663ffffffff611a9316565b8c6000018b815481106109fd57fe5b889063ffffffff611af316565b96505b505b428411610b9c5733600090815260096020908152604080832088845290915290205415610b9c573360009081526009602090815260408083208884529091529020548754610b9991610acb916103e891610a1d918c908b9081106109fd57fe5b95505b5050505b506001016108fe565b509392505050565b600a5481565b6000610bda610bc5836108e3565b610bce84611a28565b9063ffffffff611af316565b92915050565b60065460ff1681565b6201518081565b6001600160a01b039081166000908152600860205260409020600201541690565b600b546001600160a01b031681565b33600081815260086020526040812091610c39906108e3565b90506000610c4633611a28565b90508015610c685760006006840155610c65828263ffffffff611af316565b91505b60008211610cb5576040805162461bcd60e51b81526020600482015260156024820152745573657220686173206e6f206469766964656e647360581b604482015290519081900360640190fd5b303182811015610cd857610ccf838263ffffffff611bb716565b60068501559150815b4260018501556008840154610cf3908463ffffffff611af316565b6008850155604051339084156108fc029085906000818181858888f19350505050158015610d25573d6000803e3d6000fd5b5060408051848152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250505050565b6001600160a01b031660009081526008602052604090206007015490565b606481565b6001600160a01b0381166000908152600860205260408120600181015415610dfd576001810154600090421115610df4576000610dd662015180610a1d856001015442611bb790919063ffffffff16565b90508015610df257610def81600a63ffffffff611a9316565b91505b505b91506108de9050565b60009150506108de565b50919050565b607881565b60025460009081908190610e336103e8610a1d83607863ffffffff611a9316565b600354925092509250909192565b60025481565b600a544211610e9d576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420646f6573206e6f74206c61756e63682079657400000000604482015290519081900360640190fd5b600454341015610ee0576040805162461bcd60e51b815260206004820152600960248201526832b93937b91036b4b760b91b604482015290519081900360640190fd5b60048160ff1610610f27576040805162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b210383630b760a11b604482015290519081900360640190fd5b6000610f406103e8610a1d34606463ffffffff611a9316565b600b546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050158015610f7b573d6000803e3d6000fd5b5060408051828152905133917f2899dc8c12def1caa9accb64257cf2fd9f960f21bb27a560a757eae3c2ec43c1919081900360200190a233600090815260086020526040902060028101546001600160a01b031661111e576001600160a01b0384166000908152600860205260409020541580159061100357506001600160a01b0384163314155b1561102a576002810180546001600160a01b0319166001600160a01b03861617905561104f565b600b546002820180546001600160a01b0319166001600160a01b039092169190911790555b60028101546001600160a01b031660005b600381101561111b576001600160a01b0382161561110e576110be600160086000856001600160a01b03166001600160a01b0316815260200190815260200160002060030183600381106110b057fe5b01549063ffffffff611af316565b6001600160a01b0383166000908152600860205260409020600390810190839081106110e657fe5b01556001600160a01b0391821660009081526008602052604090206002015490911690611113565b61111b565b600101611060565b50505b60028101546001600160a01b0316156112805760028101546001600160a01b031660005b600381101561127d576001600160a01b0382161561127057600061118c6103e8610a1d6000858154811061117257fe5b906000526020600020015434611a9390919063ffffffff16565b6001600160a01b0384166000908152600860205260409020600601549091506111bb908263ffffffff611af316565b6001600160a01b03841660009081526008602052604090206006810191909155600701546111ef908263ffffffff611af316565b6001600160a01b038416600081815260086020908152604091829020600701939093558051848152905185933393927fd41f7e766eebcc7ff42b11ac8691bdf864db4afc0c55e71d629d54edce460d98929081900390910190a4506001600160a01b0391821660009081526008602052604090206002015490911690611275565b61127d565b600101611142565b50505b80546112c0574260018201556040805133815290517f9fd565cd14c3c391679eb0cad12a14dcf7534e9d3462bcb9b67a098a9bbbc24a9181900360200190a15b6040805160608101825260ff85811682523460208084018281524295850195865286546001808201895560008981529390932095516003909102909501805460ff1916959094169490941783559251928201929092559151600292830155905461132991611af3565b6002556040805160ff851681523460208201524281830152905133917f5998f12fe9332603ffeda0abbc2ea68418dfad46909149aa0f4fcbd1d8f7c620919081900360600190a260065460ff161561159c57805460021180159061138f57508054600510155b1561159c576000816000016000815481106113a657fe5b9060005260206000209060030201600101549050600554811061159a578154600090839060011981019081106113d857fe5b600091825260209091206001600390920201015483549091506002141561147f573481141561143c57600160008154811061140f57fe5b6000918252602080832090910154338352600982526040808420875460001901855290925291205561147a565b8034111561147a576001808154811061145157fe5b600091825260208083209091015433835260098252604080842087546000190185529092529120555b61154a565b8254600314156114b5573481141561149f57600160008154811061140f57fe5b8034111561147a57600160028154811061145157fe5b8254600414156114eb57348114156114d557600160008154811061140f57fe5b8034111561147a57600160038154811061145157fe5b82546005141561154a573481141561150b57600160008154811061145157fe5b8034111561154a57600160048154811061152157fe5b600091825260208083209091015433835260098252604080842087546000190185529092529120555b336000908152600960209081526040808320865460001901845290915290205461159590611586906103e890610a1d903463ffffffff611a9316565b6003549063ffffffff611af316565b600355505b505b50505050565b600081815481106115af57fe5b600091825260209091200154905081565b60008060006115ce84611624565b6115d785611a46565b6115e086611a65565b9250925092509193909250565b6001600160a01b03811660009081526008602052604081206006810154600790910154610bda9163ffffffff611bb716565b303190565b6000805b6001600160a01b038316600090815260086020526040902054811015610e07576001600160a01b0383166000908152600860205260409020805461169291908390811061167157fe5b90600052602060002090600302016001015483611af390919063ffffffff16565b9150600101611628565b600b546001600160a01b031633146116e8576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b600b546001600160a01b03163314611747576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905183916001600160a01b0383169163a9059cbb91859184916370a08231916024808301926020929190829003018186803b15801561179957600080fd5b505afa1580156117ad573d6000803e3d6000fd5b505050506040513d60208110156117c357600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561181457600080fd5b505af1158015611828573d6000803e3d6000fd5b505050506040513d602081101561159a57600080fd5b600b546001600160a01b0316331461188a576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b600491909155600555565b6001600160a01b031660009081526008602052604090205490565b60035481565b60008060078360ff16815481106118c957fe5b906000526020600020906002020160000154915060078360ff16815481106118ed57fe5b9060005260206000209060020201600101549050915091565b600a81565b6001600160a01b03821660009081526008602052604081208054829182918291829181908890811061193957fe5b60009182526020909120600390910201546007805460ff9092169750908790811061196057fe5b906000526020600020906002020160010154945080600001878154811061198357fe5b90600052602060002090600302016001015493508060000187815481106119a657fe5b90600052602060002090600302016002015492506119e46119d5620151806007846000018b8154811061092457fe5b82600001898154811061097157fe5b9150509295509295909350565b600181815481106115af57fe5b60055481565b6001600160a01b031660009081526008602052604090206001015490565b60045481565b6001600160a01b031660009081526008602052604090206006015490565b6001600160a01b03166000908152600860208190526040909120015490565b6001600160a01b03166000908152600860205260409020600581015460048201546003909201549091010190565b600082611aa257506000610bda565b82820282848281611aaf57fe5b0414611aec5760405162461bcd60e51b8152600401808060200182810382526021815260200180611c336021913960400191505060405180910390fd5b9392505050565b600082820183811015611aec576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808211611ba3576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b6000828481611bae57fe5b04949350505050565b600082821115611c0e576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6040518060600160405280600390602082028038833950919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72305820a112fbe8ee08e39fa695e42dd363b119893e0d77b650e0c4f08c526b824ed76764736f6c634300050a0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,522 |
0x592aD4f444fAa8155Cfd946c3C4BeD1B6ba76853 | /**
*Submitted for verification at Etherscan.io on 2021-02-24
*/
pragma solidity 0.5.17;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
function sqrt(uint256 x) internal pure returns (uint256) {
uint256 z = add(x >> 1, 1);
uint256 y = x;
while (z < y)
{
y = z;
z = ((add((x / z), z)) / 2);
}
return y;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 internal _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
contract ERC20Mintable is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function _mint(address to, uint256 amount) internal {
_balances[to] = _balances[to].add(amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal {
_balances[from] = _balances[from].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(from, address(0), amount);
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for 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 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 blackholeswap is ERC20Mintable {
using SafeMath for *;
using SafeERC20 for IERC20;
/***********************************|
| Variables && Events |
|__________________________________*/
IERC20 constant token0 = ERC20(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); //sUSD
IERC20 constant token1 = ERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); //DAI
event Purchases(address indexed buyer, address indexed sell_token, uint256 inputs, address indexed buy_token, uint256 outputs);
event AddLiquidity(address indexed provider, uint256 share, uint256 token0Amount, uint256 token1Amount);
event RemoveLiquidity(address indexed provider, uint256 share, uint256 token0Amount, uint256 token1Amount);
/***********************************|
| Constsructor |
|__________________________________*/
constructor() public {
symbol = "BHS sUSD/DAI";
name = "BlackHoleSwap sUSD/DAI";
decimals = 18;
admin = msg.sender;
vault = msg.sender;
}
/***********************************|
| Governmence & Params |
|__________________________________*/
uint256 public fee = 0.99985e18; // 1 - swap fee (numerator, in 1e18 format)
uint256 public protocolFee = 5;
uint256 public constant A = 0.75e18;
uint256 constant BASE = 1e18;
address private admin;
address private vault;
uint256 public kLast;
function setAdmin(address _admin) external {
require(msg.sender == admin);
admin = _admin;
}
function setParams(uint256 _fee, uint256 _protocolFee) external {
require(msg.sender == admin);
require(_fee < 1e18 && _fee >= 0.99e18); //0 < fee <= 1%
require(_protocolFee > 0); //protocolFee <= 50% fee
uint256 token0Reserve = getToken0Balance();
uint256 token1Reserve = getToken1Balance();
if(_totalSupply > 0) _mintFee(k(token0Reserve, token1Reserve));
fee = _fee;
protocolFee = _protocolFee;
kLast = k(token0Reserve, token1Reserve);
}
function setVault(address _vault) external {
require(msg.sender == admin);
vault = _vault;
}
/***********************************|
| Getter Functions |
|__________________________________*/
function getToken0Balance() public view returns (uint256) {
return token0.balanceOf(address(this));
}
function getToken1Balance() public view returns (uint256) {
return token1.balanceOf(address(this));
}
function k(uint256 x, uint256 y) internal pure returns (uint256 _k) {
uint256 u = x.add(y.mul(A).div(BASE));
uint256 v = y.add(x.mul(A).div(BASE));
_k = u.mul(v);
}
function f(uint256 _x, uint256 x, uint256 y) internal pure returns (uint256 _y) {
uint256 c = k(x, y).mul(BASE).div(A).sub(_x.mul(_x), "INSUFFICIENT_LIQUIDITY");
uint256 cst = A.add(uint256(1e36).div(A));
uint256 _b = _x.mul(cst).div(BASE);
uint256 D = _b.mul(_b).add(c.mul(4)); // b^2 - 4c
_y = D.sqrt().sub(_b).div(2);
}
// Calculate output given exact input
function getOutExactIn(uint256 input, uint256 x, uint256 y) public view returns (uint256 output) {
uint256 _x = x.add(input.mul(fee).div(BASE));
uint256 _y = f(_x, x, y);
output = y.sub(_y);
}
// Calculate input given exact output
function getInExactOut(uint256 output, uint256 x, uint256 y) public view returns (uint256 input) {
uint256 _y = y.sub(output);
uint256 _x = f(_y, y, x);
input = _x.sub(x).mul(BASE).div(fee);
}
/***********************************|
| Exchange Functions |
|__________________________________*/
function _mintFee(uint256 _k) private {
uint _kLast = kLast; // gas savings
if (_kLast != 0) {
uint rootK = _k.sqrt();
uint rootKLast = _kLast.sqrt();
if (rootK > rootKLast) {
uint numerator = _totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(protocolFee).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(vault, liquidity);
}
}
}
function token0In(uint256 input, uint256 min_output, uint256 deadline) external returns (uint256 output) {
require(block.timestamp <= deadline, "EXPIRED");
uint256 fromReserve = getToken0Balance();
uint256 toReserve = getToken1Balance();
output = getOutExactIn(input, fromReserve, toReserve);
require(output >= min_output, "SLIPPAGE_DETECTED");
doTransferIn(token0, msg.sender, input);
doTransferOut(token1, msg.sender, output);
emit Purchases(msg.sender, address(token0), input, address(token1), output);
}
function token1In(uint256 input, uint256 min_output, uint256 deadline) external returns (uint256 output) {
require(block.timestamp <= deadline, "EXPIRED");
uint256 fromReserve = getToken1Balance();
uint256 toReserve = getToken0Balance();
output = getOutExactIn(input, fromReserve, toReserve);
require(output >= min_output, "SLIPPAGE_DETECTED");
doTransferIn(token1, msg.sender, input);
doTransferOut(token0, msg.sender, output);
emit Purchases(msg.sender, address(token1), input, address(token0), output);
}
function token0Out(uint256 max_input, uint256 output, uint256 deadline) external returns (uint256 input) {
require(block.timestamp <= deadline, "EXPIRED");
uint256 fromReserve = getToken0Balance();
uint256 toReserve = getToken1Balance();
input = getInExactOut(output, fromReserve, toReserve);
require(input <= max_input, "SLIPPAGE_DETECTED");
doTransferIn(token1, msg.sender, input);
doTransferOut(token0, msg.sender, output);
emit Purchases(msg.sender, address(token1), input, address(token0), output);
}
function token1Out(uint256 max_input, uint256 output, uint256 deadline) external returns (uint256 input) {
require(block.timestamp <= deadline, "EXPIRED");
uint256 fromReserve = getToken1Balance();
uint256 toReserve = getToken0Balance();
input = getInExactOut(output, fromReserve, toReserve);
require(input <= max_input, "SLIPPAGE_DETECTED");
doTransferIn(token0, msg.sender, input);
doTransferOut(token1, msg.sender, output);
emit Purchases(msg.sender, address(token1), input, address(token0), output);
}
function doTransferIn(IERC20 token, address from, uint256 amount) internal {
token.safeTransferFrom(from, address(this), amount);
}
function doTransferOut(IERC20 token, address to, uint256 amount) internal {
token.safeTransfer(to, amount);
}
/***********************************|
| Liquidity Functions |
|__________________________________*/
function addLiquidity(uint256 share, uint256 token0_max, uint256 token1_max) external returns (uint256 token0_in, uint256 token1_in) {
require(share >= 1e15, 'INVALID_ARGUMENT'); // 0.001
if (_totalSupply > 0) {
uint256 token0Reserve = getToken0Balance();
uint256 token1Reserve = getToken1Balance();
_mintFee(k(token0Reserve, token1Reserve));
token0_in = share.mul(token0Reserve).div(_totalSupply);
token1_in = share.mul(token1Reserve).div(_totalSupply);
require(token0_in <= token0_max && token1_in <= token1_max, "SLIPPAGE_DETECTED");
_mint(msg.sender, share);
kLast = k(token0Reserve.add(token0_in), token1Reserve.add(token1_in));
}
else {
token0_in = share.div(2);
token1_in = share.div(2);
_mint(msg.sender, share);
kLast = k(token0_in, token1_in);
}
doTransferIn(token0, msg.sender, token0_in);
doTransferIn(token1, msg.sender, token1_in);
emit AddLiquidity(msg.sender, share, token0_in, token1_in);
}
function addLiquidityImbalanced(uint256 token0_in, uint256 token1_in, uint256 share_min) external returns (uint256 share) {
require(_totalSupply > 0, "INSUFFICIENT_LIQUIDITY");
uint256 token0Reserve = getToken0Balance();
uint256 token1Reserve = getToken1Balance();
uint256 kBefore = k(token0Reserve, token1Reserve);
// charge fee for imbalanced deposit
uint256 kAfter = k(token0Reserve.add(token0_in.mul(fee).div(BASE)), token1Reserve.add(token1_in.mul(fee).div(BASE)));
_mintFee(kBefore);
// ( sqrt(_k) * totalSupply / sqrt(k) - totalSupply )
share = kAfter.sqrt().mul(_totalSupply).div(kBefore.sqrt()).sub(_totalSupply);
require(share >= share_min, "SLIPPAGE_DETECTED");
_mint(msg.sender, share);
kLast = kAfter;
doTransferIn(token0, msg.sender, token0_in);
doTransferIn(token1, msg.sender, token1_in);
emit AddLiquidity(msg.sender, share, token0_in, token1_in);
}
function removeLiquidity(uint256 share, uint256 token0_min, uint256 token1_min) external returns (uint256 token0_out, uint256 token1_out) {
require(share > 0, 'INVALID_ARGUMENT');
uint256 token0Reserve = getToken0Balance();
uint256 token1Reserve = getToken1Balance();
_mintFee(k(token0Reserve, token1Reserve));
token0_out = share.mul(token0Reserve).div(_totalSupply);
token1_out = share.mul(token1Reserve).div(_totalSupply);
require(token0_out >= token0_min && token1_out >= token1_min, "SLIPPAGE_DETECTED");
_burn(msg.sender, share);
kLast = k(token0Reserve.sub(token0_out), token1Reserve.sub(token1_out));
doTransferOut(token0, msg.sender, token0_out);
doTransferOut(token1, msg.sender, token1_out);
emit RemoveLiquidity(msg.sender, share, token0_out, token1_out);
}
} | 0x608060405234801561001057600080fd5b50600436106101b95760003560e01c8063857620e1116100f9578063c2d9ecfa11610097578063dd62ed3e11610071578063dd62ed3e14610583578063ddca3f43146105be578063f1f9a75f146105c6578063f446c1d0146105ef576101b9565b8063c2d9ecfa14610529578063ca77b2d314610531578063d80debc51461055a576101b9565b8063a9059cbb116100d3578063a9059cbb1461049c578063b0e21e8a146104d5578063c0324c77146104dd578063c1bec32c14610500576101b9565b8063857620e11461044257806395d89b411461046b578063a6ca63ac14610473576101b9565b8063422f104311610166578063704b6c0211610140578063704b6c02146103ab57806370a08231146103de5780637464fc3d146104115780637d8016bd14610419576101b9565b8063422f10431461032c5780635153786b1461036e5780636817031b14610376576101b9565b806323b872dd1161019757806323b872dd146102a2578063313ce567146102e5578063394ec97f14610303576101b9565b806306fdde03146101be578063095ea7b31461023b57806318160ddd14610288575b600080fd5b6101c66105f7565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102005781810151838201526020016101e8565b50505050905090810190601f16801561022d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102746004803603604081101561025157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106a3565b604080519115158252519081900360200190f35b610290610717565b60408051918252519081900360200190f35b610274600480360360608110156102b857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561071d565b6102ed6107a4565b6040805160ff9092168252519081900360200190f35b6102906004803603606081101561031957600080fd5b50803590602081013590604001356107ad565b6103556004803603606081101561034257600080fd5b5080359060208101359060400135610962565b6040805192835260208301919091528051918290030190f35b610290610bcb565b6103a96004803603602081101561038c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c6a565b005b6103a9600480360360208110156103c157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cd5565b610290600480360360208110156103f457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d40565b610290610d68565b6102906004803603606081101561042f57600080fd5b5080359060208101359060400135610d6e565b6103556004803603606081101561045857600080fd5b5080359060208101359060400135610f23565b6101c6611123565b6102906004803603606081101561048957600080fd5b508035906020810135906040013561119c565b610274600480360360408110156104b257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356111fa565b610290611210565b6103a9600480360360408110156104f357600080fd5b5080359060200135611216565b6102906004803603606081101561051657600080fd5b50803590602081013590604001356112ba565b61029061130f565b6102906004803603606081101561054757600080fd5b508035906020810135906040013561137d565b6102906004803603606081101561057057600080fd5b50803590602081013590604001356114c0565b6102906004803603604081101561059957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166116f6565b61029061172e565b610290600480360360608110156105dc57600080fd5b5080359060208101359060400135611734565b6102906118e9565b6003805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561069b5780601f106106705761010080835404028352916020019161069b565b820191906000526020600020905b81548152906001019060200180831161067e57829003601f168201915b505050505081565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60025490565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020908152604080832033845290915281205461075e908363ffffffff6118f516565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260016020908152604080832033845290915290205561079a84848461190a565b5060019392505050565b60055460ff1681565b60008142111561081e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4558504952454400000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000610828610bcb565b9050600061083461130f565b90506108418683836112ba565b9250848310156108b257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b6108d1736b175474e89094c44da98b954eedeac495271d0f3388611a09565b6108f07357ab1ec28d129707052df4df418d58a2d46d5f513385611a36565b604080518781526020810185905281517357ab1ec28d129707052df4df418d58a2d46d5f5192736b175474e89094c44da98b954eedeac495271d0f9233927f981c435297345a1ac10e12ee208ec3dc700f2d854c0e88dc8683fa4ae0fb28d3929181900390910190a450509392505050565b60008066038d7ea4c680008510156109db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f494e56414c49445f415247554d454e5400000000000000000000000000000000604482015290519081900360640190fd5b60025415610b045760006109ed61130f565b905060006109f9610bcb565b9050610a0d610a088383611a5d565b611acd565b600254610a3090610a24898563ffffffff611b8916565b9063ffffffff611bb716565b600254909450610a4a90610a24898463ffffffff611b8916565b9250858411158015610a5c5750848311155b610ac757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b610ad13388611bd9565b610af9610ae4838663ffffffff611c9d16565b610af4838663ffffffff611c9d16565b611a5d565b600a5550610b429050565b610b1585600263ffffffff611bb716565b9150610b2885600263ffffffff611bb716565b9050610b343386611bd9565b610b3e8282611a5d565b600a555b610b617357ab1ec28d129707052df4df418d58a2d46d5f513384611a09565b610b80736b175474e89094c44da98b954eedeac495271d0f3383611a09565b6040805186815260208101849052808201839052905133917fbeb3885786d637a474cbc287c0a44587231633a077f0bd30354d5a4b18996fce919081900360600190a2935093915050565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600091736b175474e89094c44da98b954eedeac495271d0f916370a0823191602480820192602092909190829003018186803b158015610c3957600080fd5b505afa158015610c4d573d6000803e3d6000fd5b505050506040513d6020811015610c6357600080fd5b5051905090565b60085473ffffffffffffffffffffffffffffffffffffffff163314610c8e57600080fd5b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60085473ffffffffffffffffffffffffffffffffffffffff163314610cf957600080fd5b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b600a5481565b600081421115610ddf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4558504952454400000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000610de9610bcb565b90506000610df561130f565b9050610e0285838361119c565b925085831115610e7357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b610e927357ab1ec28d129707052df4df418d58a2d46d5f513385611a09565b610eb1736b175474e89094c44da98b954eedeac495271d0f3387611a36565b604080518481526020810187905281517357ab1ec28d129707052df4df418d58a2d46d5f5192736b175474e89094c44da98b954eedeac495271d0f9233927f981c435297345a1ac10e12ee208ec3dc700f2d854c0e88dc8683fa4ae0fb28d3929181900390910190a450509392505050565b60008060008511610f9557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f494e56414c49445f415247554d454e5400000000000000000000000000000000604482015290519081900360640190fd5b6000610f9f61130f565b90506000610fab610bcb565b9050610fba610a088383611a5d565b600254610fd190610a24898563ffffffff611b8916565b600254909450610feb90610a24898463ffffffff611b8916565b9250858410158015610ffd5750848310155b61106857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b6110723388611caf565b611095611085838663ffffffff6118f516565b610af4838663ffffffff6118f516565b600a556110b77357ab1ec28d129707052df4df418d58a2d46d5f513386611a36565b6110d6736b175474e89094c44da98b954eedeac495271d0f3385611a36565b6040805188815260208101869052808201859052905133917f59c3a0b60c6ab7deb62e1440c9e72441db6db7dfe514dba8cb18e60c0d896efa919081900360600190a25050935093915050565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561069b5780601f106106705761010080835404028352916020019161069b565b6000806111af838663ffffffff6118f516565b905060006111be828587611d73565b6006549091506111f090610a24670de0b6b3a76400006111e4858a63ffffffff6118f516565b9063ffffffff611b8916565b9695505050505050565b600061120733848461190a565b50600192915050565b60075481565b60085473ffffffffffffffffffffffffffffffffffffffff16331461123a57600080fd5b670de0b6b3a7640000821080156112595750670dbd2fc137a300008210155b61126257600080fd5b6000811161126f57600080fd5b600061127961130f565b90506000611285610bcb565b6002549091501561129d5761129d610a088383611a5d565b600684905560078390556112b18282611a5d565b600a5550505050565b6000806112ee6112e1670de0b6b3a7640000610a2460065489611b8990919063ffffffff16565b859063ffffffff611c9d16565b905060006112fd828686611d73565b90506111f0848263ffffffff6118f516565b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516000917357ab1ec28d129707052df4df418d58a2d46d5f51916370a0823191602480820192602092909190829003018186803b158015610c3957600080fd5b6000814211156113ee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4558504952454400000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006113f861130f565b90506000611404610bcb565b905061141185838361119c565b92508583111561148257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b6114a1736b175474e89094c44da98b954eedeac495271d0f3385611a09565b610eb17357ab1ec28d129707052df4df418d58a2d46d5f513387611a36565b6000806002541161153257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e53554646494349454e545f4c495155494449545900000000000000000000604482015290519081900360640190fd5b600061153c61130f565b90506000611548610bcb565b905060006115568383611a5d565b905060006115b261158e611581670de0b6b3a7640000610a246006548d611b8990919063ffffffff16565b869063ffffffff611c9d16565b610af4611581670de0b6b3a7640000610a246006548d611b8990919063ffffffff16565b90506115bd82611acd565b6115ea6002546115de6115cf85611e99565b610a246002546111e487611e99565b9063ffffffff6118f516565b94508585101561165b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b6116653386611bd9565b600a8190556116897357ab1ec28d129707052df4df418d58a2d46d5f51338a611a09565b6116a8736b175474e89094c44da98b954eedeac495271d0f3389611a09565b60408051868152602081018a9052808201899052905133917fbeb3885786d637a474cbc287c0a44587231633a077f0bd30354d5a4b18996fce919081900360600190a2505050509392505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60065481565b6000814211156117a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600760248201527f4558504952454400000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006117af61130f565b905060006117bb610bcb565b90506117c88683836112ba565b92508483101561183957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f534c4950504147455f4445544543544544000000000000000000000000000000604482015290519081900360640190fd5b6118587357ab1ec28d129707052df4df418d58a2d46d5f513388611a09565b611877736b175474e89094c44da98b954eedeac495271d0f3385611a36565b60408051878152602081018590528151736b175474e89094c44da98b954eedeac495271d0f927357ab1ec28d129707052df4df418d58a2d46d5f519233927f981c435297345a1ac10e12ee208ec3dc700f2d854c0e88dc8683fa4ae0fb28d3929181900390910190a450509392505050565b670a688906bd8b000081565b60008282111561190457600080fd5b50900390565b73ffffffffffffffffffffffffffffffffffffffff821661192a57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054611960908263ffffffff6118f516565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526020819052604080822093909355908416815220546119a2908263ffffffff611c9d16565b73ffffffffffffffffffffffffffffffffffffffff8084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b611a3173ffffffffffffffffffffffffffffffffffffffff841683308463ffffffff611edd16565b505050565b611a3173ffffffffffffffffffffffffffffffffffffffff8416838363ffffffff611f7216565b600080611a876112e1670de0b6b3a7640000610a2486670a688906bd8b000063ffffffff611b8916565b90506000611ab26112e1670de0b6b3a7640000610a2488670a688906bd8b000063ffffffff611b8916565b9050611ac4828263ffffffff611b8916565b95945050505050565b600a548015611b85576000611ae183611e99565b90506000611aee83611e99565b905080821115611b82576000611b1c611b0d848463ffffffff6118f516565b6002549063ffffffff611b8916565b90506000611b4583611b3960075487611b8990919063ffffffff16565b9063ffffffff611c9d16565b90506000818381611b5257fe5b0490508015611b7e57600954611b7e9073ffffffffffffffffffffffffffffffffffffffff1682611bd9565b5050505b50505b5050565b600082611b9857506000610711565b82820282848281611ba557fe5b0414611bb057600080fd5b9392505050565b6000808211611bc557600080fd5b6000828481611bd057fe5b04949350505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054611c0f908263ffffffff611c9d16565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902055600254611c48908263ffffffff611c9d16565b60025560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082820183811015611bb057600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054611ce5908263ffffffff6118f516565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902055600254611d1e908263ffffffff6118f516565b60025560408051828152905160009173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600080611dee611d89868063ffffffff611b8916565b6040518060400160405280601681526020017f494e53554646494349454e545f4c495155494449545900000000000000000000815250611de1670a688906bd8b0000610a24670de0b6b3a76400006111e48b8b611a5d565b919063ffffffff611fff16565b90506000611e31611e1c6ec097ce7bc90715b34b9f1000000000670a688906bd8b000063ffffffff611bb716565b670a688906bd8b00009063ffffffff611c9d16565b90506000611e51670de0b6b3a7640000610a24898563ffffffff611b8916565b90506000611e79611e6985600463ffffffff611b8916565b611b39848063ffffffff611b8916565b9050611e8d6002610a24846115de85611e99565b98975050505050505050565b600080611eab600184901c6001611c9d565b9050825b80821015611bb05750806002611ece828681611ec757fe5b0484611c9d565b81611ed557fe5b049150611eaf565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611b829085906120b0565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611a319084906120b0565b600081848411156120a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561206d578181015183820152602001612055565b50505050905090810190601f16801561209a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6120cf8273ffffffffffffffffffffffffffffffffffffffff166122ee565b61213a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106121a357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612166565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612205576040519150601f19603f3d011682016040523d82523d6000602084013e61220a565b606091505b50915091508161227b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611b825780806020019051602081101561229757600080fd5b5051611b82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061232b602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906123225750808214155b94935050505056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a7231582037532a43b41e4ff7eebe22cd71ddbc56307ced11e66f50a899a87e3de0abe13864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,523 |
0xa7d4b8104f2b0411d54a23d36a49cd21f8c5e21f | pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'Keizer Token'
//
// NAME : Keizer Token
// Symbol : KZT
// Total supply: 2,000,000,000
// Decimals : 18
//
// Enjoy.
//
// (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract ERC20Basic {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract Keizer is StandardToken {
string public constant name = "Keizer Token";
string public constant symbol = "KZT";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 2 * 10**9 * (10**uint256(decimals));
uint256 public weiRaised;
uint256 public tokenAllocated;
address public owner;
bool public saleToken = true;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function Keizer() public {
totalSupply = INITIAL_SUPPLY;
owner = msg.sender;
//owner = msg.sender; // for testing
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
require(saleToken == true);
address wallet = owner;
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
TokenPurchase(_investor, weiAmount, tokens);
wallet.transfer(weiAmount);
return tokens;
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = getTotalAmountOfTokens(_weiAmount);
if (addTokens > balances[owner]) {
TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
/**
* If the user sends 0.0001 ether, he receives 750
* If he sends 0.001 ether, he receives 2,000 +20%
* If he sends 0.01 ether, he receives 20,000 +35%
* If he sends 0.05 ether, he receives 100,000 +50%
* If he sends 0.1 ether he receives 200,000 +75%
* If he sends 1 ether, he receives 2,000,000 +100%
*/
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) {
uint256 amountOfTokens = 0;
if(_weiAmount == 0.0001 ether){
amountOfTokens = 750 * (10**uint256(decimals));
}
if( _weiAmount == 0.001 ether){
amountOfTokens = 2400 * (10**uint256(decimals));
}
if( _weiAmount == 0.002 ether){
amountOfTokens = 4800 * (10**uint256(decimals));
}
if( _weiAmount == 0.003 ether){
amountOfTokens = 7200 * (10**uint256(decimals));
}
if( _weiAmount == 0.004 ether){
amountOfTokens = 9600 * 10**2 * (10**uint256(decimals));
}
if( _weiAmount == 0.005 ether){
amountOfTokens = 12000 * (10**uint256(decimals));
}
if( _weiAmount == 0.006 ether){
amountOfTokens = 14400 * (10**uint256(decimals));
}
if( _weiAmount == 0.007 ether){
amountOfTokens = 16800 * (10**uint256(decimals));
}
if( _weiAmount == 0.008 ether){
amountOfTokens = 19200 * (10**uint256(decimals));
}
if( _weiAmount == 0.009 ether){
amountOfTokens = 21600 * (10**uint256(decimals));
}
if( _weiAmount == 0.01 ether){
amountOfTokens = 27 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.02 ether){
amountOfTokens = 54 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.03 ether){
amountOfTokens = 81 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.04 ether){
amountOfTokens = 108 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.05 ether){
amountOfTokens = 150 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.06 ether){
amountOfTokens = 180 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.07 ether){
amountOfTokens = 210 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.08 ether){
amountOfTokens = 240 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.09 ether){
amountOfTokens = 270 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.1 ether){
amountOfTokens = 350 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.2 ether){
amountOfTokens = 700 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.3 ether){
amountOfTokens = 1050 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.4 ether){
amountOfTokens = 1400 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.5 ether){
amountOfTokens = 1750 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.6 ether){
amountOfTokens = 2100 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.7 ether){
amountOfTokens = 2450 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.8 ether){
amountOfTokens = 2800 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.9 ether){
amountOfTokens = 3150 * 10**2 * (10**uint256(decimals));
}
if( _weiAmount == 1 ether){
amountOfTokens = 4000 * 10**3 * (10**uint256(decimals));
}
return amountOfTokens;
}
function mint(address _to, uint256 _amount, address _owner) internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[_owner]);
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
Transfer(_owner, _to, _amount);
return true;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function startSale() public onlyOwner {
saleToken = true;
}
function stopSale() public onlyOwner {
saleToken = false;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokens() public onlyOwner {
owner.transfer(this.balance);
uint256 balance = balanceOf(this);
transfer(owner, balance);
Transfer(this, owner, balance);
}
} | 0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610149578063095ea7b3146101d357806318160ddd1461020b57806323b872dd146102325780632ff2e9dc1461025c578063313ce567146102715780634042b66f1461029c57806348c54b9d146102b157806366188463146102c857806370a08231146102ec57806378f7aeee1461030d5780638da5cb5b1461032257806395d89b4114610353578063a6f9dae114610368578063a9059cbb14610389578063b66a0e5d146103ad578063bef97c87146103c2578063d73dd623146103d7578063dd62ed3e146103fb578063e36b0b3714610422578063e985e36714610437578063ec8ac4d81461044c578063f41e60c514610460578063fc38ce191461047a575b61014633610492565b50005b34801561015557600080fd5b5061015e6105c8565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610198578181015183820152602001610180565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b506101f7600160a060020a03600435166024356105ff565b604080519115158252519081900360200190f35b34801561021757600080fd5b50610220610665565b60408051918252519081900360200190f35b34801561023e57600080fd5b506101f7600160a060020a036004358116906024351660443561066b565b34801561026857600080fd5b506102206107f0565b34801561027d57600080fd5b50610286610800565b6040805160ff9092168252519081900360200190f35b3480156102a857600080fd5b50610220610805565b3480156102bd57600080fd5b506102c661080b565b005b3480156102d457600080fd5b506101f7600160a060020a03600435166024356108b9565b3480156102f857600080fd5b50610220600160a060020a03600435166109a9565b34801561031957600080fd5b506102206109c4565b34801561032e57600080fd5b506103376109ca565b60408051600160a060020a039092168252519081900360200190f35b34801561035f57600080fd5b5061015e6109d9565b34801561037457600080fd5b506101f7600160a060020a0360043516610a10565b34801561039557600080fd5b506101f7600160a060020a0360043516602435610aab565b3480156103b957600080fd5b506102c6610b9a565b3480156103ce57600080fd5b506101f7610be8565b3480156103e357600080fd5b506101f7600160a060020a0360043516602435610bf1565b34801561040757600080fd5b50610220600160a060020a0360043581169060243516610c8a565b34801561042e57600080fd5b506102c6610cc5565b34801561044357600080fd5b506101f7610cfc565b610220600160a060020a0360043516610492565b34801561046c57600080fd5b506102c66004351515610d1d565b34801561048657600080fd5b50610220600435610d47565b6000808080600160a060020a03851615156104ac57600080fd5b60085474010000000000000000000000000000000000000000900460ff1615156001146104d857600080fd5b600854600160a060020a031692503491506104f282610d47565b905080151561050057600080fd5b600654610513908363ffffffff610dc816565b600655600754610529908263ffffffff610dc816565b6007556008546105459086908390600160a060020a0316610dde565b5060408051838152602081018390528151600160a060020a038816927fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f928290030190a2604051600160a060020a0384169083156108fc029084906000818181858888f193505050501580156105bf573d6000803e3d6000fd5b50949350505050565b60408051808201909152600c81527f4b65697a657220546f6b656e0000000000000000000000000000000000000000602082015281565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600060033660641461067957fe5b600160a060020a038416151561068e57600080fd5b600160a060020a0385166000908152600460205260409020548311156106b357600080fd5b600160a060020a03851660009081526005602090815260408083203384529091529020548311156106e357600080fd5b60035460ff1615156106f457600080fd5b600160a060020a03851660009081526004602052604090205461071d908463ffffffff610ec916565b600160a060020a038087166000908152600460205260408082209390935590861681522054610752908463ffffffff610dc816565b600160a060020a038086166000908152600460209081526040808320949094559188168152600582528281203382529091522054610796908463ffffffff610ec916565b600160a060020a038087166000818152600560209081526040808320338452825291829020949094558051878152905192881693919260008051602061121f833981519152929181900390910190a3506001949350505050565b6b06765c793fa10079d000000081565b601281565b60065481565b600854600090600160a060020a0316331461082557600080fd5b600854604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561085f573d6000803e3d6000fd5b50610869306109a9565b60085490915061088290600160a060020a031682610aab565b50600854604080518381529051600160a060020a0390921691309160008051602061121f833981519152919081900360200190a350565b336000908152600560209081526040808320600160a060020a03861684529091528120548083111561090e57336000908152600560209081526040808320600160a060020a0388168452909152812055610943565b61091e818463ffffffff610ec916565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526004602052604090205490565b60075481565b600854600160a060020a031681565b60408051808201909152600381527f4b5a540000000000000000000000000000000000000000000000000000000000602082015281565b600854600090600160a060020a03163314610a2a57600080fd5b600160a060020a0382161515610a3f57600080fd5b600854604051600160a060020a038085169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a35060088054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b6000600236604414610ab957fe5b600160a060020a0384161515610ace57600080fd5b33600090815260046020526040902054831115610aea57600080fd5b60035460ff161515610afb57600080fd5b33600090815260046020526040902054610b1b908463ffffffff610ec916565b3360009081526004602052604080822092909255600160a060020a03861681522054610b4d908463ffffffff610dc816565b600160a060020a03851660008181526004602090815260409182902093909355805186815290519192339260008051602061121f8339815191529281900390910190a35060019392505050565b600854600160a060020a03163314610bb157600080fd5b6008805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b60035460ff1681565b336000908152600560209081526040808320600160a060020a0386168452909152812054610c25908363ffffffff610dc816565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6000600236604414610c9857fe5b5050600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600854600160a060020a03163314610cdc57600080fd5b6008805474ff000000000000000000000000000000000000000019169055565b60085474010000000000000000000000000000000000000000900460ff1681565b600854600160a060020a03163314610d3457600080fd5b6003805460ff1916911515919091179055565b600080610d5383610edb565b600854600160a060020a0316600090815260046020526040902054909150811115610dbe57600754604080519182526020820183905280517f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b629281900390910190a160009150610dc2565b8091505b50919050565b600082820183811015610dd757fe5b9392505050565b6000600160a060020a0384161515610df557600080fd5b600160a060020a038216600090815260046020526040902054831115610e1a57600080fd5b600160a060020a038416600090815260046020526040902054610e43908463ffffffff610dc816565b600160a060020a038086166000908152600460205260408082209390935590841681522054610e78908463ffffffff610ec916565b600160a060020a03808416600081815260046020908152604091829020949094558051878152905192881693919260008051602061121f833981519152929181900390910190a35060019392505050565b600082821115610ed557fe5b50900390565b600080655af3107a4000831415610ef857506828a857425466f800005b8266038d7ea4c680001415610f13575068821ab0d441498000005b8266071afd498d00001415610f2f57506901043561a882930000005b82660aa87bee5380001415610f4b575069018650127cc3dc8000005b82660e35fa931a00001415610f67575069cb49b44ba602d80000005b826611c37937e080001415610f83575069028a857425466f8000005b82661550f7dca700001415610f9f575069030ca024f987b90000005b826618de76816d80001415610fbb575069038ebad5cdc9028000005b82661c6bf5263400001415610fd75750690410d586a20a4c0000005b82661ff973cafa80001415610ff35750690492f037764b958000005b82662386f26fc10000141561100f57506905b7ac4553de7ae000005b8266470de4df820000141561102b5750690b6f588aa7bcf5c000005b82666a94d74f4300001415611047575069112704cffb9b70a000005b82668e1bc9bf040000141561106357506916deb1154f79eb8000005b8266b1a2bc2ec50000141561107f5750691fc3842bd1f071c000005b8266d529ae9e860000141561109b575069261dd1ce2f20888000005b8266f8b0a10e47000014156110b75750692c781f708c509f4000005b8267011c37937e08000014156110d457506932d26d12e980b60000005b8267013fbe85edc9000014156110f1575069392cbab546b0ccc000005b8267016345785d8a0000141561110e5750694a1d89bb94865ec000005b826702c68af0bb140000141561112b575069943b1377290cbd8000005b82670429d069189e00001415611148575069de589d32bd931c4000005b8267058d15e176280000141561116657506a01287626ee52197b0000005b826706f05b59d3b20000141561118457506a017293b0a9e69fd9c000005b82670853a0d2313c000014156111a257506a01bcb13a657b26388000005b826709b6e64a8ec6000014156111c057506a0206cec4210fac974000005b82670b1a2bc2ec50000014156111de57506a0250ec4ddca432f60000005b82670c7d713b49da000014156111fb57506942b42f28d278eee000005b82670de0b6b3a76400001415610dbe57506a034f086f3b33b684000000929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058207026273e670e38d8cc34dafaaf514b4fe61e1b23895f1b6e4abadb62bcce3ba40029 | {"success": true, "error": null, "results": {}} | 1,524 |
0x151dd8422a0e7cdd79e08c91a0a9e8400af132ac | /**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
/**
*Submitted for verification at Etherscan.io
*/
/*
Welcome to Miyagi Token
https://t.me/MrMiyagiPortal
*/
// 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 MrMiyagi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MrMiyagi";
string private constant _symbol = "MIYAGI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 20;
//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(0x851D21bE128b739bC1911cCB3eaBE10f0Db0606e);
address payable private _marketingAddress = payable(0x851D21bE128b739bC1911cCB3eaBE10f0Db0606e);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000 * 10**9;
uint256 public _maxWalletSize = 500000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000 * 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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setmaxTx(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;
}
}
} | 0x6080604052600436106101d05760003560e01c80638da5cb5b116100f7578063b0c2b56111610095578063dd62ed3e11610064578063dd62ed3e1461065c578063ea1644d514610699578063f2fde38b146106c2578063fc342279146106eb576101d7565b8063b0c2b561146105b6578063bfd79284146105df578063c3c8cd801461061c578063c492f04614610633576101d7565b806395d89b41116100d157806395d89b41146104fc57806398a5c31514610527578063a2a957bb14610550578063a9059cbb14610579576101d7565b80638da5cb5b1461047d5780638f70ccf7146104a85780638f9a55c0146104d1576101d7565b8063313ce5671161016f57806370a082311161013e57806370a08231146103c1578063715018a6146103fe5780637d1db4a5146104155780637f2feddc14610440576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636fc3eaec146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103bf610acd565b005b3480156103cd57600080fd5b506103e860048036038101906103e39190613063565b610b9e565b6040516103f59190612f94565b60405180910390f35b34801561040a57600080fd5b50610413610bef565b005b34801561042157600080fd5b5061042a610d42565b6040516104379190612f94565b60405180910390f35b34801561044c57600080fd5b5061046760048036038101906104629190613063565b610d48565b6040516104749190612f94565b60405180910390f35b34801561048957600080fd5b50610492610d60565b60405161049f9190613048565b60405180910390f35b3480156104b457600080fd5b506104cf60048036038101906104ca91906130bc565b610d89565b005b3480156104dd57600080fd5b506104e6610e3b565b6040516104f39190612f94565b60405180910390f35b34801561050857600080fd5b50610511610e41565b60405161051e9190612e3d565b60405180910390f35b34801561053357600080fd5b5061054e600480360381019061054991906130e9565b610e7e565b005b34801561055c57600080fd5b5061057760048036038101906105729190613116565b610f1d565b005b34801561058557600080fd5b506105a0600480360381019061059b9190612e95565b610fd4565b6040516105ad9190612ef0565b60405180910390f35b3480156105c257600080fd5b506105dd60048036038101906105d891906130e9565b610ff2565b005b3480156105eb57600080fd5b5061060660048036038101906106019190613063565b611091565b6040516106139190612ef0565b60405180910390f35b34801561062857600080fd5b506106316110b1565b005b34801561063f57600080fd5b5061065a600480360381019061065591906131d8565b61118a565b005b34801561066857600080fd5b50610683600480360381019061067e9190613238565b6112c4565b6040516106909190612f94565b60405180910390f35b3480156106a557600080fd5b506106c060048036038101906106bb91906130e9565b61134b565b005b3480156106ce57600080fd5b506106e960048036038101906106e49190613063565b6113ea565b005b3480156106f757600080fd5b50610712600480360381019061070d91906130bc565b6115ac565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600881526020017f4d724d6979616769000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000678ac7230489e80000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0e61165e565b73ffffffffffffffffffffffffffffffffffffffff161480610b845750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b6c61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610b8d57600080fd5b6000479050610b9b8161211a565b50565b6000610be8600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610bf761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7b906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9161165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e15906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f4d49594147490000000000000000000000000000000000000000000000000000815250905090565b610e8661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0a906132c4565b60405180910390fd5b8060188190555050565b610f2561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa9906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b6000610fe8610fe161165e565b8484611831565b6001905092915050565b610ffa61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107e906132c4565b60405180910390fd5b8060168190555050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110f261165e565b73ffffffffffffffffffffffffffffffffffffffff1614806111685750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661115061165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61117157600080fd5b600061117c30610b9e565b9050611187816121f4565b50565b61119261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461121f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611216906132c4565b60405180910390fd5b60005b838390508110156112be578160056000868685818110611245576112446132e4565b5b905060200201602081019061125a9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112b690613342565b915050611222565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61135361165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d7906132c4565b60405180910390fd5b8060178190555050565b6113f261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611476906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156114ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e6906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6115b461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611641576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611638906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610d60565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610b9e565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610b9e565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000678ac7230489e800009050612772678ac7230489e800006006546124d290919063ffffffff16565b82101561279057600654678ac7230489e80000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205f6b9a330f43e5376483e48ee14990c62c928dd20efbdb77776efbfc1cfbfc0464736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,525 |
0xab07c1f93c0e6af983a67fc2c028df39ddf1e473 | pragma solidity 0.4.20;
/*
* ===========================
* Welcome To Ramen Coin! The FIRST and ONLY Proof of Ramen Cryptocurrency!
* Our cryptocurrency not only provides an opportunity to earn from playing our dApp but we will use funds in the long run
* to help those who suffer from hunger and starvation in the world. By taking part in our dApp you are doing your part to help!
* |
* | /
* | /
* .~^(,&|/o.
* |`-------^|
* \ /
* `======='
*
* https://ramencoin.me
*
*
* /======== A Community Marketing Fund Project for RAMEN ========/
*
* -> Another Contract????
* In short, this is a contract to accept RAMEN token / ETH donations from community members
* as a way of gathering funds for regular marketing, contest and helping to fight hunger.
* [✓] Hands of Titanium! This contract never sells, it can't and just simply don't know how to sell!
* [✓] Community Goods: All rewards will be used for promotional costs / contest prizes and our initiative to fight hunger, when the accumulated rewards reaches a certain amount, we'll begin some campaigns.
* [✓] Transparency: How rewards will be used will be regularly updated and sometimes voted on by the community in website and/or discord announcement.
* [✓] Security: This is an honor system and the dev asks that you trust in the efforts as this is a serious and long term project.
*
*
*
*/
/**
* @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 PullPayment
* @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use asyncSend instead of send.
*/
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev withdraw accumulated balance, called by payee.
*/
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(this.balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
assert(payee.send(payment));
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}
/// @dev Interface to the RAMEN contract.
contract RAMENInterface {
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) public payable returns (uint256);
/// @dev Converts all of caller's dividends to tokens.
function reinvest() public;
/// @dev Alias of sell() and withdraw().
function exit() public;
/// @dev Withdraws all of the callers earnings.
function withdraw() public;
/// @dev Liquifies tokens to ethereum.
function sell(uint256 _amountOfTokens) public;
/**
* @dev Transfer tokens from the caller to a new holder.
* Remember, there's a 15% fee here as well.
*/
function transfer(address _toAddress, uint256 _amountOfTokens) public returns (bool);
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint256);
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256);
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256);
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint256);
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256);
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256);
/// @dev Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256);
/// @dev Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256);
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256);
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256);
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256);
/**
* @dev Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256);
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256);
/// @dev This is where all your gas goes.
function sqrt(uint256 x) internal pure returns (uint256 y);
}
/// @dev Core Contract
contract RAMENCommunityFund is Ownable, PullPayment {
/*=================================
= CONTRACTS =
=================================*/
/// @dev The address of the EtherDungeonCore contract.
RAMENInterface public RamenContract = RAMENInterface(0xc463aa806958f3BdD20081Cc5caB89FBB35B650D);
/*==============================
= EVENTS =
==============================*/
event LogDonateETH(
address indexed donarAddress,
uint256 amount,
uint256 timestamp
);
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Besides donating RAMEN tokens, you can also donate ETH as well.
function donateETH() public payable {
// When you make an ETH donation, it will use your address as referrer / masternode.
RamenContract.buy.value(msg.value)(msg.sender);
// Emit LogDonateETH event.
LogDonateETH(msg.sender, msg.value, now);
}
/// @dev Converts ETH dividends to RAMEN tokens.
function reinvestDividend() onlyOwner public {
RamenContract.reinvest();
}
/// @dev Withdraw ETH dividends and put it to this contract.
function withdrawDividend() onlyOwner public {
RamenContract.withdraw();
}
/// @dev Assign who can get how much of the dividends.
function assignFundReceiver(address _fundReceiver, uint _amount) onlyOwner public {
// Ensure there are sufficient available balance.
require(_amount <= this.balance - totalPayments);
// Using the asyncSend function of PullPayment, fund receiver can withdraw it anytime.
asyncSend(_fundReceiver, _amount);
}
/// @dev Fallback function to allow receiving funds from RAMEN contract.
function() public payable {}
/*=======================================
= SETTER FUNCTIONS =
=======================================*/
function setRamenContract(address _newRamenContractAddress) onlyOwner external {
RamenContract = RAMENInterface(_newRamenContractAddress);
}
}
/**
* @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;
}
} | 0x6060604052600436106100945763ffffffff60e060020a6000350416625b448781146100965780636103d70b146100bb5780636a474002146100ce5780638b4c40b0146100e15780638da5cb5b146100e9578063a4e0123014610118578063d1632f671461012b578063e2982c211461014d578063f03a56871461016c578063f2fde38b1461017f578063f460e5d01461019e575b005b34156100a157600080fd5b6100a96101bd565b60405190815260200160405180910390f35b34156100c657600080fd5b6100946101c3565b34156100d957600080fd5b61009461025c565b6100946102cc565b34156100f457600080fd5b6100fc610387565b604051600160a060020a03909116815260200160405180910390f35b341561012357600080fd5b6100fc610396565b341561013657600080fd5b610094600160a060020a03600435166024356103a5565b341561015857600080fd5b6100a9600160a060020a03600435166103e5565b341561017757600080fd5b6100946103f7565b341561018a57600080fd5b610094600160a060020a0360043516610451565b34156101a957600080fd5b610094600160a060020a03600435166104ec565b60025481565b33600160a060020a0381166000908152600160205260409020548015156101e957600080fd5b600160a060020a033016318190101561020157600080fd5b600254610214908263ffffffff61053616565b600255600160a060020a0382166000818152600160205260408082209190915582156108fc0290839051600060405180830381858888f19350505050151561025857fe5b5050565b60005433600160a060020a0390811691161461027757600080fd5b600354600160a060020a0316633ccfd60b6040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156102b657600080fd5b6102c65a03f115156102c757600080fd5b505050565b600354600160a060020a031663f088d547343360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390911660048201526024016020604051808303818588803b151561032557600080fd5b6125ee5a03f1151561033657600080fd5b5050505060405180515050600160a060020a0333167fbdf1e51339f01f93307d90fb0c439218118fa1c4855e5a60e924527030212ab2344260405191825260208201526040908101905180910390a2565b600054600160a060020a031681565b600354600160a060020a031681565b60005433600160a060020a039081169116146103c057600080fd5b600254600160a060020a03301631038111156103db57600080fd5b6102588282610548565b60016020526000908152604090205481565b60005433600160a060020a0390811691161461041257600080fd5b600354600160a060020a031663fdb5a03e6040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156102b657600080fd5b60005433600160a060020a0390811691161461046c57600080fd5b600160a060020a038116151561048157600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461050757600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008282111561054257fe5b50900390565b600160a060020a038216600090815260016020526040902054610571908263ffffffff6105a416565b600160a060020a03831660009081526001602052604090205560025461059d908263ffffffff6105a416565b6002555050565b6000828201838110156105b357fe5b93925050505600a165627a7a723058209ff30cfc8712141d7da7983f3351f7f5272896c0517e0c08df57f8c890c63fbd0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,526 |
0xed48654fcd1a3718256d3f63f6e42e162fced8b4 | /*
██████ █████ ██████ ██ ██ ██████ █████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██████ ████ ██ ███████ ██ █ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██
██████ ██ ██ ██████ ██ ██████ ██ ██ ███ ███
*/
// 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 BabyCAW is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "A Baby Hunters Dream";
string private constant _symbol = "BabyCAW";
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;
//Buy Fee
uint256 private _redisFeeOnBuy = 0; //
uint256 private _taxFeeOnBuy = 0; // no buy tax
//Sell Fee
uint256 private _redisFeeOnSell = 0; //
uint256 private _taxFeeOnSell = 2; // 2% sell tax only
//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(0x94505e475a7a357C6491Da4609aa5790f2C16e21);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x94505e475a7a357C6491Da4609aa5790f2C16e21);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9; //
uint256 public _maxWalletSize = 15000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 15000000000 * 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;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461052b578063dd62ed3e1461054b578063ea1644d514610591578063f2fde38b146105b157600080fd5b8063a2a957bb146104a6578063a9059cbb146104c6578063bfd79284146104e6578063c3c8cd801461051657600080fd5b80638f70ccf7116100d15780638f70ccf7146104205780638f9a55c01461044057806395d89b411461045657806398a5c3151461048657600080fd5b806374010ece146103cc5780637d1db4a5146103ec5780638da5cb5b1461040257600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103625780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b9990531461034257600080fd5b80631694505e116101a05780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461024257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611af9565b6105d1565b005b3480156101ff57600080fd5b506040805180820190915260148152734120426162792048756e7465727320447265616d60601b60208201525b6040516102399190611c23565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a4f565b61067e565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611a0f565b610695565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101f161035d36600461199f565b6106fe565b34801561036e57600080fd5b506101f161037d366004611bc0565b610749565b34801561038e57600080fd5b506101f1610791565b3480156103a357600080fd5b506102c26103b236600461199f565b6107dc565b3480156103c357600080fd5b506101f16107fe565b3480156103d857600080fd5b506101f16103e7366004611bda565b610872565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506000546001600160a01b0316610292565b34801561042c57600080fd5b506101f161043b366004611bc0565b6108a1565b34801561044c57600080fd5b506102c260175481565b34801561046257600080fd5b506040805180820190915260078152664261627943415760c81b602082015261022c565b34801561049257600080fd5b506101f16104a1366004611bda565b6108e9565b3480156104b257600080fd5b506101f16104c1366004611bf2565b610918565b3480156104d257600080fd5b506102626104e1366004611a4f565b610956565b3480156104f257600080fd5b5061026261050136600461199f565b60106020526000908152604090205460ff1681565b34801561052257600080fd5b506101f1610963565b34801561053757600080fd5b506101f1610546366004611a7a565b6109b7565b34801561055757600080fd5b506102c26105663660046119d7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059d57600080fd5b506101f16105ac366004611bda565b610a66565b3480156105bd57600080fd5b506101f16105cc36600461199f565b610a95565b6000546001600160a01b031633146106045760405162461bcd60e51b81526004016105fb90611c76565b60405180910390fd5b60005b815181101561067a5760016010600084848151811061063657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067281611d89565b915050610607565b5050565b600061068b338484610b7f565b5060015b92915050565b60006106a2848484610ca3565b6106f484336106ef85604051806060016040528060288152602001611de6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111df565b610b7f565b5060019392505050565b6000546001600160a01b031633146107285760405162461bcd60e51b81526004016105fb90611c76565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107735760405162461bcd60e51b81526004016105fb90611c76565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107c657506013546001600160a01b0316336001600160a01b0316145b6107cf57600080fd5b476107d981611219565b50565b6001600160a01b03811660009081526002602052604081205461068f9061129e565b6000546001600160a01b031633146108285760405162461bcd60e51b81526004016105fb90611c76565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089c5760405162461bcd60e51b81526004016105fb90611c76565b601655565b6000546001600160a01b031633146108cb5760405162461bcd60e51b81526004016105fb90611c76565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109135760405162461bcd60e51b81526004016105fb90611c76565b601855565b6000546001600160a01b031633146109425760405162461bcd60e51b81526004016105fb90611c76565b600893909355600a91909155600955600b55565b600061068b338484610ca3565b6012546001600160a01b0316336001600160a01b0316148061099857506013546001600160a01b0316336001600160a01b0316145b6109a157600080fd5b60006109ac306107dc565b90506107d981611322565b6000546001600160a01b031633146109e15760405162461bcd60e51b81526004016105fb90611c76565b60005b82811015610a60578160056000868685818110610a1157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a26919061199f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5881611d89565b9150506109e4565b50505050565b6000546001600160a01b03163314610a905760405162461bcd60e51b81526004016105fb90611c76565b601755565b6000546001600160a01b03163314610abf5760405162461bcd60e51b81526004016105fb90611c76565b6001600160a01b038116610b245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105fb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105fb565b6001600160a01b038216610c425760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105fb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105fb565b6001600160a01b038216610d695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105fb565b60008111610dcb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105fb565b6000546001600160a01b03848116911614801590610df757506000546001600160a01b03838116911614155b156110d857601554600160a01b900460ff16610e90576000546001600160a01b03848116911614610e905760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105fb565b601654811115610ee25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105fb565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2457506001600160a01b03821660009081526010602052604090205460ff16155b610f7c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105fb565b6015546001600160a01b038381169116146110015760175481610f9e846107dc565b610fa89190611d1b565b106110015760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105fb565b600061100c306107dc565b6018546016549192508210159082106110255760165491505b80801561103c5750601554600160a81b900460ff16155b801561105657506015546001600160a01b03868116911614155b801561106b5750601554600160b01b900460ff165b801561109057506001600160a01b03851660009081526005602052604090205460ff16155b80156110b557506001600160a01b03841660009081526005602052604090205460ff16155b156110d5576110c382611322565b4780156110d3576110d347611219565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061111a57506001600160a01b03831660009081526005602052604090205460ff165b8061114c57506015546001600160a01b0385811691161480159061114c57506015546001600160a01b03848116911614155b15611159575060006111d3565b6015546001600160a01b03858116911614801561118457506014546001600160a01b03848116911614155b1561119657600854600c55600954600d555b6015546001600160a01b0384811691161480156111c157506014546001600160a01b03858116911614155b156111d357600a54600c55600b54600d555b610a60848484846114c7565b600081848411156112035760405162461bcd60e51b81526004016105fb9190611c23565b5060006112108486611d72565b95945050505050565b6012546001600160a01b03166108fc6112338360026114f5565b6040518115909202916000818181858888f1935050505015801561125b573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112768360026114f5565b6040518115909202916000818181858888f1935050505015801561067a573d6000803e3d6000fd5b60006006548211156113055760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105fb565b600061130f611537565b905061131b83826114f5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061137857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140491906119bb565b8160018151811061142557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461144b9130911684610b7f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611484908590600090869030904290600401611cab565b600060405180830381600087803b15801561149e57600080fd5b505af11580156114b2573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114d4576114d461155a565b6114df848484611588565b80610a6057610a60600e54600c55600f54600d55565b600061131b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061167f565b60008060006115446116ad565b909250905061155382826114f5565b9250505090565b600c5415801561156a5750600d54155b1561157157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061159a876116ef565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115cc908761174c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115fb908661178e565b6001600160a01b03891660009081526002602052604090205561161d816117ed565b6116278483611837565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161166c91815260200190565b60405180910390a3505050505050505050565b600081836116a05760405162461bcd60e51b81526004016105fb9190611c23565b5060006112108486611d33565b6006546000908190683635c9adc5dea000006116c982826114f5565b8210156116e657505060065492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061170c8a600c54600d5461185b565b925092509250600061171c611537565b9050600080600061172f8e8787876118b0565b919e509c509a509598509396509194505050505091939550919395565b600061131b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111df565b60008061179b8385611d1b565b90508381101561131b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105fb565b60006117f7611537565b905060006118058383611900565b30600090815260026020526040902054909150611822908261178e565b30600090815260026020526040902055505050565b600654611844908361174c565b600655600754611854908261178e565b6007555050565b6000808080611875606461186f8989611900565b906114f5565b90506000611888606461186f8a89611900565b905060006118a08261189a8b8661174c565b9061174c565b9992985090965090945050505050565b60008080806118bf8886611900565b905060006118cd8887611900565b905060006118db8888611900565b905060006118ed8261189a868661174c565b939b939a50919850919650505050505050565b60008261190f5750600061068f565b600061191b8385611d53565b9050826119288583611d33565b1461131b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105fb565b803561198a81611dd0565b919050565b8035801515811461198a57600080fd5b6000602082840312156119b0578081fd5b813561131b81611dd0565b6000602082840312156119cc578081fd5b815161131b81611dd0565b600080604083850312156119e9578081fd5b82356119f481611dd0565b91506020830135611a0481611dd0565b809150509250929050565b600080600060608486031215611a23578081fd5b8335611a2e81611dd0565b92506020840135611a3e81611dd0565b929592945050506040919091013590565b60008060408385031215611a61578182fd5b8235611a6c81611dd0565b946020939093013593505050565b600080600060408486031215611a8e578283fd5b833567ffffffffffffffff80821115611aa5578485fd5b818601915086601f830112611ab8578485fd5b813581811115611ac6578586fd5b8760208260051b8501011115611ada578586fd5b602092830195509350611af0918601905061198f565b90509250925092565b60006020808385031215611b0b578182fd5b823567ffffffffffffffff80821115611b22578384fd5b818501915085601f830112611b35578384fd5b813581811115611b4757611b47611dba565b8060051b604051601f19603f83011681018181108582111715611b6c57611b6c611dba565b604052828152858101935084860182860187018a1015611b8a578788fd5b8795505b83861015611bb357611b9f8161197f565b855260019590950194938601938601611b8e565b5098975050505050505050565b600060208284031215611bd1578081fd5b61131b8261198f565b600060208284031215611beb578081fd5b5035919050565b60008060008060808587031215611c07578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c4f57858101830151858201604001528201611c33565b81811115611c605783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cfa5784516001600160a01b031683529383019391830191600101611cd5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d2e57611d2e611da4565b500190565b600082611d4e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d6d57611d6d611da4565b500290565b600082821015611d8457611d84611da4565b500390565b6000600019821415611d9d57611d9d611da4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f818a14e317fca67a0f3d306b31937cd678963901bbb0f30c331d1d6f7e277864736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,527 |
0xdc0e610e7a8a5543f8a16a5ba51e8009972e1572 | pragma solidity 0.4.24;
// File: node_modules\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: node_modules\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: node_modules\openzeppelin-solidity\contracts\token\ERC20\DetailedERC20.sol
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: node_modules\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: node_modules\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: node_modules\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: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: contracts\COSCNYToken.sol
contract COSCNYToken is DetailedERC20, StandardToken, Ownable {
string public name = "COSCNY Token";
string public symbol = "COSCNY";
uint8 public decimals = 18;
uint public initialSupply = 10800000000 * 10 ** uint256(decimals);
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
constructor() DetailedERC20(name, symbol, decimals) public {
totalSupply_ = initialSupply;
balances[msg.sender] = totalSupply_;
emit Transfer(address(0), owner, totalSupply_);
}
function transfer(address _to, uint256 _value) public returns (bool){
_transfer(msg.sender, _to, _value);
}
function _transfer(address _from, address _to, uint _value) internal {
require (_to != address(0));
require (balances[_from] >= _value);
require (balances[_to].add(_value) >= balances[_to]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
}
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
} | 0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd14610216578063313ce5671461029b578063378dc3dc146102cc57806366188463146102f757806370a082311461035c578063715018a6146103b35780638da5cb5b146103ca57806395d89b4114610421578063a9059cbb146104b1578063b414d4b614610516578063d73dd62314610571578063dd62ed3e146105d6578063e724529c1461064d578063f2fde38b1461069c575b600080fd5b34801561010257600080fd5b5061010b6106df565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077d565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b5061020061086f565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610879565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610c39565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d857600080fd5b506102e1610c4c565b6040518082815260200191505060405180910390f35b34801561030357600080fd5b50610342600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c52565b604051808215151515815260200191505060405180910390f35b34801561036857600080fd5b5061039d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ee4565b6040518082815260200191505060405180910390f35b3480156103bf57600080fd5b506103c8610f2d565b005b3480156103d657600080fd5b506103df611032565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042d57600080fd5b50610436611058565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047657808201518184015260208101905061045b565b50505050905090810190601f1680156104a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104bd57600080fd5b506104fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110f6565b604051808215151515815260200191505060405180910390f35b34801561052257600080fd5b50610557600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611109565b604051808215151515815260200191505060405180910390f35b34801561057d57600080fd5b506105bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611129565b604051808215151515815260200191505060405180910390f35b3480156105e257600080fd5b50610637600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611325565b6040518082815260200191505060405180910390f35b34801561065957600080fd5b5061069a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506113ac565b005b3480156106a857600080fd5b506106dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d2565b005b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107755780601f1061074a57610100808354040283529160200191610775565b820191906000526020600020905b81548152906001019060200180831161075857829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108c957600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561095457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561099057600080fd5b6109e282600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153a90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7782600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155390919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4982600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153a90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600960009054906101000a900460ff1681565b600a5481565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610d64576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610df8565b610d77838261153a90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f8957600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110ee5780601f106110c3576101008083540402835291602001916110ee565b820191906000526020600020905b8154815290600101906020018083116110d157829003601f168201915b505050505081565b600061110333848461156f565b92915050565b600b6020528060005260406000206000915054906101000a900460ff1681565b60006111ba82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155390919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561140857600080fd5b80600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561152e57600080fd5b611537816118de565b50565b600082821115151561154857fe5b818303905092915050565b6000818301905082811015151561156657fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156115ab57600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156115f957600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155390919063ffffffff16565b1015151561169857600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156116f157600080fd5b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561174a57600080fd5b61179c81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061183181600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155390919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561191a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820d03721fcd5fa25cfd249d44a5824aa11e6850ea32c30d3a3772453f4f516cb900029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 1,528 |
0x0fb6c0de0d3cd2a27941981ea1de878348b26014 | /**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
/*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___
_____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_
___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_
__/\\\_________________\//\\\\__________\/\\\_____\/\\\\\\\\\\\\\/__
_\/\\\__________________\/\\\\__________\/\\\_____\/\\\/////////____
_\//\\\_________________/\\\\\\_________\/\\\_____\/\\\_____________
__\///\\\_____________/\\\////\\\_______\/\\\_____\/\\\_____________
____\////\\\\\\\\\__/\\\/___\///\\\__/\\\\\\\\\\\_\/\\\_____________
_______\/////////__\///_______\///__\///////////__\///____________*/
contract CxipERC721 {
using Strings for string;
using Address for address;
function getRegistry () internal pure returns (ICxipRegistry) {
return ICxipRegistry (0xC267d41f81308D7773ecB3BDd863a902ACC01Ade);
}
event Transfer (address indexed from, address indexed to, uint256 indexed tokenId);
event Approval (address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll (address indexed owner, address indexed operator, bool approved);
event Withdraw (address indexed to, uint256 amount);
event PermanentURI (string uri, uint256 indexed id);
CollectionData private _collectionData;
uint256 private _currentTokenId;
uint256 [] private _allTokens;
mapping (uint256 => uint256) private _ownedTokensIndex;
mapping (uint256 => address) private _tokenOwner;
mapping (uint256 => address) private _tokenApprovals;
mapping (address => uint256) private _ownedTokensCount;
mapping (address => uint256 []) private _ownedTokens;
mapping (address => mapping (address => bool)) private _operatorApprovals;
mapping (uint256 => TokenData) private _tokenData;
address private _admin;
address private _owner;
uint256 private _totalTokens;
constructor () {}
function init (address newOwner, CollectionData calldata collectionData) public {
require (_admin.isZero (), 'CXIP: already initialized');
_admin = msg.sender;
_owner = address (this);
_collectionData = collectionData;
(bool royaltiesSuccess, /*bytes memory royaltiesResponse*/) = getRegistry ().getPA1D ().delegatecall (
abi.encodeWithSelector (
bytes4 (0xea2299f8),
uint256 (0),
payable (collectionData.royalties),
uint256 (collectionData.bps)
)
);
require (royaltiesSuccess, 'CXIP: failed setting royalties');
_owner = newOwner;
}
function getIdentity () public view returns (address) {
return ICxipProvenance (getRegistry ().getProvenance ()).getWalletIdentity (_owner);
}
function isIdentityWallet (address sender) internal view returns (bool) {
address identity = getIdentity ();
if (identity.isZero ()) {
return false;
}
return ICxipIdentity (identity).isWalletRegistered (sender);
}
function owner () public view returns (address) {
return _owner;
}
function isOwner () public view returns (bool) {
return (msg.sender == _owner || msg.sender == _admin || isIdentityWallet (msg.sender));
}
modifier onlyOwner () {
require (isOwner (), 'CXIP: caller not an owner');
_;
}
function setName (bytes32 newName, bytes32 newName2) public onlyOwner {
_collectionData.name = newName;
_collectionData.name2 = newName2;
}
function setSymbol (bytes32 newSymbol) public onlyOwner {
_collectionData.symbol = newSymbol;
}
function transferOwnership (address newOwner) public onlyOwner {
if (!newOwner.isZero ()) {
_owner = newOwner;
}
}
function supportsInterface (bytes4 interfaceId) external view returns (bool) {
if (
interfaceId == 0x01ffc9a7
|| interfaceId == 0x80ac58cd
|| interfaceId == 0x5b5e139f
|| interfaceId == 0x150b7a02
|| interfaceId == 0xe8a3d485
|| IPA1D (getRegistry ().getPA1D ()).supportsInterface (interfaceId)
) {
return true;
} else {
return false;
}
}
function ownerOf (uint256 tokenId) public view returns (address) {
address tokenOwner = _tokenOwner [tokenId];
require (!tokenOwner.isZero (), 'ERC721: token does not exist');
return tokenOwner;
}
function approve (address to, uint256 tokenId) public {
address tokenOwner = _tokenOwner [tokenId];
if (to != tokenOwner && _isApproved (msg.sender, tokenId)) {
_tokenApprovals [tokenId] = to;
emit Approval (tokenOwner, to, tokenId);
}
}
function getApproved (uint256 tokenId) public view returns (address) {
return _tokenApprovals [tokenId];
}
function setApprovalForAll (address to, bool approved) public {
if (to != msg.sender) {
_operatorApprovals [msg.sender] [to] = approved;
emit ApprovalForAll (msg.sender, to, approved);
} else {
assert (false);
}
}
function setApprovalForAll (address from, address to, bool approved) public onlyOwner {
if (to != from) {
_operatorApprovals [from] [to] = approved;
emit ApprovalForAll (from, to, approved);
}
}
function isApprovedForAll (address wallet, address operator) public view returns (bool) {
return
_operatorApprovals [wallet] [operator]
|| 0x4feE7B061C97C9c496b01DbcE9CDb10c02f0a0Be == operator // Rarible Transfer Proxy
|| address (OpenSeaProxyRegistry (0xa5409ec958C83C3f309868babACA7c86DCB077c1).proxies (wallet)) == operator // OpenSea Transfer Proxy
;
}
function transferFrom (address from, address to, uint256 tokenId) public {
transferFrom (from, to, tokenId, '');
}
function transferFrom (address from, address to, uint256 tokenId, bytes memory /*_data*/) public {
if (_isApproved (msg.sender, tokenId)) {
_transferFrom (from, to, tokenId);
}
}
function safeTransferFrom (address from, address to, uint256 tokenId) public {
safeTransferFrom (from, to, tokenId, '');
}
function safeTransferFrom (address from, address to, uint256 tokenId, bytes memory /*_data*/) public {
if (_isApproved (msg.sender, tokenId)) {
_transferFrom (from, to, tokenId);
}
}
function _exists (uint256 tokenId) private view returns (bool) {
address tokenOwner = _tokenOwner [tokenId];
return !tokenOwner.isZero ();
}
function _isApproved (address spender, uint256 tokenId) private view returns (bool) {
require (_exists (tokenId));
address tokenOwner = _tokenOwner [tokenId];
return (
spender == tokenOwner
|| getApproved (tokenId) == spender
|| isApprovedForAll (tokenOwner, spender)
|| ICxipIdentity (getIdentity ()).isWalletRegistered (spender)
);
}
function _clearApproval (uint256 tokenId) private {
delete _tokenApprovals [tokenId];
}
function totalSupply () public view returns (uint256) {
return _totalTokens;
}
function _transferFrom (address from, address to, uint256 tokenId) private {
if (_tokenOwner [tokenId] == from && !to.isZero ()) {
_clearApproval (tokenId);
_tokenOwner [tokenId] = to;
emit Transfer (from, to, tokenId);
} else {
assert (false);
}
}
function _mint (address to, uint256 tokenId) private {
if (to.isZero () || _exists (tokenId)) {
assert (false);
}
_tokenOwner [tokenId] = to;
emit Transfer (address (0), to, tokenId);
_totalTokens += 1;
}
function burn (uint256 tokenId) public {
if (_isApproved (msg.sender, tokenId)) {
address wallet = _tokenOwner [tokenId];
require (!wallet.isZero ());
_clearApproval (tokenId);
_tokenOwner [tokenId] = address (0);
emit Transfer (wallet, address (0), tokenId);
_totalTokens -= 1;
delete _tokenData [tokenId];
}
}
function cxipMint (uint256 id, TokenData calldata tokenData) public onlyOwner returns (uint256) {
if (id == 0) {
_currentTokenId += 1;
id = _currentTokenId;
}
_mint (tokenData.creator, id);
_tokenData [id] = tokenData;
emit PermanentURI (string (abi.encodePacked ('https://arweave.net/', tokenData.arweave)), id);
return id;
}
function tokenURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://arweave.net/', _tokenData [tokenId].arweave, _tokenData [tokenId].arweave2));
}
function name () external view returns (string memory) {
return string (abi.encodePacked (Bytes.trim (_collectionData.name), Bytes.trim (_collectionData.name2)));
}
function symbol () external view returns (string memory) {
return string (Bytes.trim (_collectionData.symbol));
}
function baseURI () public view returns (string memory) {
return string (abi.encodePacked ('https://cxip.io/nft/', Strings.toHexString (address (this))));
}
function contractURI () external view returns (string memory) {
return string (abi.encodePacked ('https://nft.cxip.io/', Strings.toHexString (address (this)), '/'));
}
function creator (uint256 tokenId) external view returns (address) {
return _tokenData [tokenId].creator;
}
function payloadHash (uint256 tokenId) external view returns (bytes32) {
return _tokenData [tokenId].payloadHash;
}
function payloadSignature (uint256 tokenId) external view returns (Verification memory) {
return _tokenData [tokenId].payloadSignature;
}
function payloadSigner (uint256 tokenId) external view returns (address) {
return _tokenData [tokenId].creator;
}
function arweaveURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://arweave.net/', _tokenData [tokenId].arweave, _tokenData [tokenId].arweave2));
}
function httpURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked (baseURI (), '/', Strings.toHexString (tokenId)));
}
function ipfsURI (uint256 tokenId) external view returns (string memory) {
return string (abi.encodePacked ('https://ipfs.io/ipfs/', _tokenData [tokenId].ipfs, _tokenData [tokenId].ipfs2));
}
function verifySHA256 (bytes32 hash, bytes calldata payload) external pure returns (bool) {
bytes32 thePayloadHash = sha256 (payload);
return hash == thePayloadHash;
}
function onERC721Received (address /*_operator*/, address /*_from*/, uint256 /*_tokenId*/, bytes calldata /*_data*/) public pure returns (bytes4) {
return 0x150b7a02;
}
function _royaltiesFallback () internal {
address _target = getRegistry ().getPA1D ();
assembly {
calldatacopy (0, 0, calldatasize ())
let result := delegatecall (gas (), _target, 0, calldatasize (), 0, 0)
returndatacopy (0, 0, returndatasize ())
switch result
case 0 {
revert (0, returndatasize ())
}
default {
return (0, returndatasize ())
}
}
}
fallback () external {
_royaltiesFallback ();
}
receive () external payable {
_royaltiesFallback ();
}
}
library Address {
function isZero (address account) internal pure returns (bool) {
return (account == address (0));
}
function isContract (address account) internal view returns (bool) {
bytes32 codehash;
assembly {
codehash := extcodehash (account)
}
return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
}
}
library Strings {
function toHexString (address account) internal pure returns (string memory) {
return toHexString (uint256 (uint160 (account)));
}
function toHexString (uint256 value) internal pure returns (string memory) {
if (value == 0) {
return '0x00';
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString (value, length);
}
function toHexString (uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes (2 * length + 2);
buffer [0] = '0';
buffer [1] = 'x';
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer [i] = bytes16 ('0123456789abcdef') [value & 0xf];
value >>= 4;
}
require (value == 0, 'Strings: hex length insufficient');
return string (buffer);
}
}
library Bytes {
function trim (bytes32 source) internal pure returns (bytes memory) {
uint256 temp = uint256 (source);
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return slice (abi.encodePacked (source), 32 - length, length);
}
function slice (bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) {
require (_length + 31 >= _length, 'slice_overflow');
require (_bytes.length >= _start + _length, 'slice_outOfBounds');
bytes memory tempBytes;
assembly {
switch iszero (_length)
case 0 {
tempBytes := mload (0x40)
let lengthmod := and (_length, 31)
let mc := add (add (tempBytes, lengthmod), mul (0x20, iszero (lengthmod)))
let end := add (mc, _length)
for {
let cc := add (add (add (_bytes, lengthmod), mul (0x20, iszero (lengthmod))), _start)
} lt (mc, end) {
mc := add (mc, 0x20)
cc := add (cc, 0x20)
} {
mstore (mc, mload (cc))
}
mstore (tempBytes, _length)
mstore (0x40, and (add (mc, 31), not (31)))
}
default {
tempBytes := mload (0x40)
mstore (tempBytes, 0)
mstore(0x40, add (tempBytes, 0x20))
}
}
return tempBytes;
}
}
struct Verification {
bytes32 r;
bytes32 s;
uint8 v;
}
struct CollectionData {
bytes32 name;
bytes32 name2;
bytes32 symbol;
address royalties;
uint96 bps;
}
struct TokenData {
bytes32 payloadHash;
Verification payloadSignature;
address creator;
bytes32 arweave;
bytes11 arweave2;
bytes32 ipfs;
bytes14 ipfs2;
}
interface IPA1D {
function supportsInterface (bytes4 interfaceId) external pure returns (bool);
}
interface ICxipProvenance {
function getIdentity () external view returns (address);
function getWalletIdentity (address wallet) external view returns (address);
function isIdentityValid (address identity) external view returns (bool);
}
interface ICxipIdentity {
function isWalletRegistered (address wallet) external view returns (bool);
function isOwner () external view returns (bool);
function isCollectionCertified (address collection) external view returns (bool);
function isCollectionRegistered (address collection) external view returns (bool);
}
interface ICxipRegistry {
function getPA1D () external view returns (address);
function setPA1D (address proxy) external;
function getPA1DSource () external view returns (address);
function setPA1DSource (address source) external;
function getAsset () external view returns (address);
function setAsset (address proxy) external;
function getAssetSource () external view returns (address);
function setAssetSource (address source) external;
function getCopyright () external view returns (address);
function setCopyright (address proxy) external;
function getCopyrightSource () external view returns (address);
function setCopyrightSource (address source) external;
function getProvenance () external view returns (address);
function setProvenance (address proxy) external;
function getProvenanceSource () external view returns (address);
function setProvenanceSource (address source) external;
function getIdentitySource () external view returns (address);
function setIdentitySource (address source) external;
function getERC721CollectionSource () external view returns (address);
function setERC721CollectionSource (address source) external;
function getERC1155CollectionSource () external view returns (address);
function setERC1155CollectionSource (address source) external;
function getAssetSigner () external view returns (address);
function setAssetSigner (address source) external;
function getCustomSource (bytes32 name) external view returns (address);
function getCustomSourceFromString (string memory name) external view returns (address);
function setCustomSource (string memory name, address source) external;
function owner () external view returns (address);
}
contract OpenSeaOwnableDelegateProxy {
}
contract OpenSeaProxyRegistry {
mapping (address => OpenSeaOwnableDelegateProxy) public proxies;
} | 0x6080604052600436106102385760003560e01c80634f8baacc11610138578063a546993e116100b0578063c87b56dd1161007f578063e985e9c511610064578063e985e9c514610708578063f2fde38b14610728578063f95bb91e1461074857610247565b8063c87b56dd14610693578063e8a3d485146106f357610247565b8063a546993e14610693578063ab67aa58146106b3578063b0cacd43146106d3578063b88d4fde146106b357610247565b80636c0360eb116101075780638f32d59b116100ec5780638f32d59b1461064957806395d89b411461065e578063a22cb4651461067357610247565b80636c0360eb146106095780638da5cb5b1461061e57610247565b80634f8baacc146105a9578063510b51581461029157806351e32024146105c95780636352211e146105e957610247565b80631a5c7f92116101cb57806336afc6fa1161019a57806342966c681161017f57806342966c681461053c578063475a80351461055c57806349e654401461058957610247565b806336afc6fa1461052757806342842e0e1461045657610247565b80631a5c7f921461043657806323b872dd146104565780632c2dadbc14610476578063367605ca1461050757610247565b8063095ea7b311610207578063095ea7b314610361578063128bfa2514610381578063150b7a02146103a157806318160ddd1461041757610247565b806301ffc9a71461025c57806306ce0db81461029157806306fdde03146102fc578063081812fc1461031e57610247565b3661024757610245610768565b005b34801561025357600080fd5b50610245610768565b34801561026857600080fd5b5061027c610277366004612a00565b610827565b60405190151581526020015b60405180910390f35b34801561029d57600080fd5b506102d76102ac366004612965565b6000908152600c602052604090206004015473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610288565b34801561030857600080fd5b50610311610b0c565b6040516102889190612c08565b34801561032a57600080fd5b506102d7610339366004612965565b60009081526008602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b34801561036d57600080fd5b5061024561037c36600461291e565b610b4c565b34801561038d57600080fd5b5061024561039c3660046128c1565b610c10565b3480156103ad57600080fd5b506103e66103bc36600461272c565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610288565b34801561042357600080fd5b50600f545b604051908152602001610288565b34801561044257600080fd5b50610311610451366004612965565b610f85565b34801561046257600080fd5b506102456104713660046126ec565b611021565b34801561048257600080fd5b506104e2610491366004612965565b604080516060808201835260008083526020808401829052928401819052938452600c82529282902082519384018352600181015484526002810154918401919091526003015460ff169082015290565b6040805182518152602080840151908201529181015160ff1690820152606001610288565b34801561051357600080fd5b506102456105223660046126a2565b61103c565b34801561053357600080fd5b506102d7611175565b34801561054857600080fd5b50610245610557366004612965565b6112b0565b34801561056857600080fd5b50610428610577366004612965565b6000908152600c602052604090205490565b34801561059557600080fd5b506102456105a4366004612965565b61148a565b3480156105b557600080fd5b506104286105c4366004612a40565b6114fd565b3480156105d557600080fd5b506103116105e4366004612965565b611666565b3480156105f557600080fd5b506102d7610604366004612965565b61168a565b34801561061557600080fd5b5061031161171c565b34801561062a57600080fd5b50600e5473ffffffffffffffffffffffffffffffffffffffff166102d7565b34801561065557600080fd5b5061027c611737565b34801561066a57600080fd5b50610311611786565b34801561067f57600080fd5b5061024561068e366004612894565b611796565b34801561069f57600080fd5b506103116106ae366004612965565b61187d565b3480156106bf57600080fd5b506102456106ce36600461279d565b611903565b3480156106df57600080fd5b5061027c6106ee3660046129b6565b611923565b3480156106ff57600080fd5b50610311611983565b34801561071457600080fd5b5061027c61072336600461266a565b61199e565b34801561073457600080fd5b50610245610743366004612632565b611ae4565b34801561075457600080fd5b50610245610763366004612995565b611bb3565b600073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c457600080fd5b505afa1580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc919061264e565b90503660008037600080366000845af43d6000803e80801561081d573d6000f35b3d6000fd5b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806108ba57507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061090657507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061095257507f150b7a02000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061099e57507fe8a3d485000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610af7575073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109fe57600080fd5b505afa158015610a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a36919061264e565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527fffffffff000000000000000000000000000000000000000000000000000000008416600482015273ffffffffffffffffffffffffffffffffffffffff91909116906301ffc9a79060240160206040518083038186803b158015610abf57600080fd5b505afa158015610ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af79190612949565b15610b0457506001919050565b506000919050565b6060610b1b6000800154611c2c565b600154610b2790611c2c565b604051602001610b38929190612ad0565b604051602081830303815290604052905090565b60008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff9081169083168114801590610b8a5750610b8a3383611cae565b156108225760008281526008602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600d5473ffffffffffffffffffffffffffffffffffffffff1615610c95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a20616c726561647920696e697469616c697a65640000000000000060448201526064015b60405180910390fd5b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000009081163317909155600e805490911630179055806000610cda8282612e2c565b506000905073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff166381d1779c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3957600080fd5b505afa158015610d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d71919061264e565b73ffffffffffffffffffffffffffffffffffffffff167fea2299f8000000000000000000000000000000000000000000000000000000006000610dba6080860160608701612632565b610dca60a0870160808801612a88565b604051602481019390935273ffffffffffffffffffffffffffffffffffffffff90911660448301526bffffffffffffffffffffffff166064820152608401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610e919190612ab4565b600060405180830381855af49150503d8060008114610ecc576040519150601f19603f3d011682016040523d82523d6000602084013e610ed1565b606091505b5050905080610f3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f435849503a206661696c65642073657474696e6720726f79616c7469657300006044820152606401610c8c565b5050600e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000818152600c60209081526040918290206007810154600890910154925160609361100b9360909190911b91017f68747470733a2f2f697066732e696f2f697066732f0000000000000000000000815260158101929092527fffffffffffffffffffffffffffff00000000000000000000000000000000000016603582015260430190565b6040516020818303038152906040529050919050565b61082283838360405180602001604052806000815250611903565b611044611737565b6110aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c8c565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146108225773ffffffffffffffffffffffffffffffffffffffff8381166000818152600b602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600073c267d41f81308d7773ecb3bdd863a902acc01ade73ffffffffffffffffffffffffffffffffffffffff1663b9da967d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d157600080fd5b505afa1580156111e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611209919061264e565b600e546040517f4b19fac800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152911690634b19fac89060240160206040518083038186803b15801561127357600080fd5b505afa158015611287573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ab919061264e565b905090565b6112ba3382611cae565b156114875760008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff16806112ee57600080fd5b600082815260086020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560008281526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46001600f60008282546113ab9190612cae565b9091555050506000818152600c6020526040812081815560018101829055600281018290556003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556004810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600581018290556006810180547fffffffffffffffffffffffffffffffffffffffffff0000000000000000000000169055600781019190915560080180547fffffffffffffffffffffffffffffffffffff00000000000000000000000000001690555b50565b611492611737565b6114f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c8c565b600255565b6000611507611737565b61156d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c8c565b82611590576001600460008282546115859190612c59565b909155505060045492505b6115a96115a360a0840160808501612632565b84611df8565b6000838152600c6020526040902082906115c38282612eea565b50506040517f68747470733a2f2f617277656176652e6e65742f000000000000000000000000602082015260a0830135603482015283907fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b5565720790605401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261165791612c08565b60405180910390a25090919050565b606061167061171c565b61167983611f08565b60405160200161100b929190612aff565b60008181526007602052604081205473ffffffffffffffffffffffffffffffffffffffff1680611716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20646f6573206e6f74206578697374000000006044820152606401610c8c565b92915050565b606061172730611f75565b604051602001610b389190612bc3565b600e5460009073ffffffffffffffffffffffffffffffffffffffff163314806117775750600d5473ffffffffffffffffffffffffffffffffffffffff1633145b806112ab57506112ab33611f96565b60606112ab600060020154611c2c565b73ffffffffffffffffffffffffffffffffffffffff8216331461184a57336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b5050565b6000818152600c60209081526040918290206005810154600690910154925160609361100b9360a89190911b91017f68747470733a2f2f617277656176652e6e65742f000000000000000000000000815260148101929092527fffffffffffffffffffffff000000000000000000000000000000000000000000166034820152603f0190565b61190d3383611cae565b1561191d5761191d848484612066565b50505050565b60008060028484604051611938929190612aa4565b602060405180830381855afa158015611955573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611978919061297d565b909414949350505050565b606061198e30611f75565b604051602001610b389190612b57565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600b6020908152604080832093851683529290529081205460ff1680611a0a5750734fee7b061c97c9c496b01dbce9cdb10c02f0a0be73ffffffffffffffffffffffffffffffffffffffff8316145b80611add57506040517fc455279100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283169073a5409ec958c83c3f309868babaca7c86dcb077c19063c45527919060240160206040518083038186803b158015611a8d57600080fd5b505afa158015611aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac5919061264e565b73ffffffffffffffffffffffffffffffffffffffff16145b9392505050565b611aec611737565b611b52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c8c565b73ffffffffffffffffffffffffffffffffffffffff81161561148757600e805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b611bbb611737565b611c21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f435849503a2063616c6c6572206e6f7420616e206f776e6572000000000000006044820152606401610c8c565b600091909155600155565b60608160005b8115611c515780611c4281612d26565b915050600882901c9150611c32565b611ca684604051602001611c6791815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052611ca0836020612cae565b8361216b565b949350505050565b60008181526007602052604081205473ffffffffffffffffffffffffffffffffffffffff16611cdc57600080fd5b60008281526007602052604090205473ffffffffffffffffffffffffffffffffffffffff908116908416811480611d39575060008381526008602052604090205473ffffffffffffffffffffffffffffffffffffffff8581169116145b80611d495750611d49818561199e565b80611ca65750611d57611175565b6040517f7f247e4900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301529190911690637f247e499060240160206040518083038186803b158015611dc057600080fd5b505afa158015611dd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca69190612949565b73ffffffffffffffffffffffffffffffffffffffff82161580611e3e575060008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff1615155b15611e72577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60008181526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001600f6000828254611eff9190612c59565b90915550505050565b606081611f4857505060408051808201909152600481527f3078303000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115611f6b5780611f5c81612d26565b915050600882901c9150611f4c565b611ca684826122e5565b60606117168273ffffffffffffffffffffffffffffffffffffffff16611f08565b600080611fa1611175565b905073ffffffffffffffffffffffffffffffffffffffff8116611fc75750600092915050565b6040517f7f247e4900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152821690637f247e499060240160206040518083038186803b15801561202e57600080fd5b505afa158015612042573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611add9190612949565b60008181526007602052604090205473ffffffffffffffffffffffffffffffffffffffff84811691161480156120b1575073ffffffffffffffffffffffffffffffffffffffff821615155b1561184a57600081815260086020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560008181526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60608161217981601f612c59565b10156121e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610c8c565b6121eb8284612c59565b84511015612255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401610c8c565b60608215801561227457604051915060008252602082016040526122dc565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156122ad578051835260209283019201612295565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b606060006122f4836002612c71565b6122ff906002612c59565b67ffffffffffffffff81111561233e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612368576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106123c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612450577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061248c846002612c71565b612497906001612c59565b90505b6001811115612582577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106124ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b82828151811061253c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361257b81612cf1565b905061249a565b508315611add576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c8c565b60008083601f8401126125fc578182fd5b50813567ffffffffffffffff811115612613578182fd5b60208301915083602082850101111561262b57600080fd5b9250929050565b600060208284031215612643578081fd5b8135611add81613032565b60006020828403121561265f578081fd5b8151611add81613032565b6000806040838503121561267c578081fd5b823561268781613032565b9150602083013561269781613032565b809150509250929050565b6000806000606084860312156126b6578081fd5b83356126c181613032565b925060208401356126d181613032565b915060408401356126e181613054565b809150509250925092565b600080600060608486031215612700578283fd5b833561270b81613032565b9250602084013561271b81613032565b929592945050506040919091013590565b600080600080600060808688031215612743578081fd5b853561274e81613032565b9450602086013561275e81613032565b935060408601359250606086013567ffffffffffffffff811115612780578182fd5b61278c888289016125eb565b969995985093965092949392505050565b600080600080608085870312156127b2578384fd5b84356127bd81613032565b935060208501356127cd81613032565b925060408501359150606085013567ffffffffffffffff808211156127f0578283fd5b818701915087601f830112612803578283fd5b81358181111561281557612815612d8e565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561285b5761285b612d8e565b816040528281528a6020848701011115612873578586fd5b82602086016020830137918201602001949094529598949750929550505050565b600080604083850312156128a6578182fd5b82356128b181613032565b9150602083013561269781613054565b60008082840360c08112156128d4578283fd5b83356128df81613032565b925060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082011215612910578182fd5b506020830190509250929050565b60008060408385031215612930578182fd5b823561293b81613032565b946020939093013593505050565b60006020828403121561295a578081fd5b8151611add81613054565b600060208284031215612976578081fd5b5035919050565b60006020828403121561298e578081fd5b5051919050565b600080604083850312156129a7578182fd5b50508035926020909101359150565b6000806000604084860312156129ca578081fd5b83359250602084013567ffffffffffffffff8111156129e7578182fd5b6129f3868287016125eb565b9497909650939450505050565b600060208284031215612a11578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611add578182fd5b600080828403610140811215612a54578283fd5b833592506101207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082011215612910578182fd5b600060208284031215612a99578081fd5b8135611add81613062565b8183823760009101908152919050565b60008251612ac6818460208701612cc5565b9190910192915050565b60008351612ae2818460208801612cc5565b835190830190612af6818360208801612cc5565b01949350505050565b60008351612b11818460208801612cc5565b7f2f000000000000000000000000000000000000000000000000000000000000009083019081528351612b4b816001840160208801612cc5565b01600101949350505050565b7f68747470733a2f2f6e66742e637869702e696f2f000000000000000000000000815260008251612b8f816014850160208701612cc5565b7f2f000000000000000000000000000000000000000000000000000000000000006014939091019283015250601501919050565b7f68747470733a2f2f637869702e696f2f6e66742f000000000000000000000000815260008251612bfb816014850160208701612cc5565b9190910160140192915050565b6020815260008251806020840152612c27816040850160208701612cc5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115612c6c57612c6c612d5f565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ca957612ca9612d5f565b500290565b600082821015612cc057612cc0612d5f565b500390565b60005b83811015612ce0578181015183820152602001612cc8565b8381111561191d5750506000910152565b600081612d0057612d00612d5f565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d5857612d58612d5f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000813561171681613032565b600081357fffffffffffffffffffffff00000000000000000000000000000000000000000081168114611716578182fd5b600081357fffffffffffffffffffffffffffff00000000000000000000000000000000000081168114611716578182fd5b813581556020820135600182015560408201356002820155600381016060830135612e5681613032565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8216178255506080830135612ea381613062565b815473ffffffffffffffffffffffffffffffffffffffff1660a09190911b7fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555050565b81358155602082013560018201556040820135600282015560038101606083013560ff8116808214612f1b57600080fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00161790915550612f99612f5360808401612dbd565b6004830173ffffffffffffffffffffffffffffffffffffffff82167fffffffffffffffffffffffff00000000000000000000000000000000000000008254161781555050565b60a08201356005820155612fe5612fb260c08401612dca565b600683018160a81c7fffffffffffffffffffffffffffffffffffffffffff00000000000000000000008254161781555050565b60e08201356007820155611879612fff6101008401612dfb565b600883018160901c7fffffffffffffffffffffffffffffffffffff00000000000000000000000000008254161781555050565b73ffffffffffffffffffffffffffffffffffffffff8116811461148757600080fd5b801515811461148757600080fd5b6bffffffffffffffffffffffff8116811461148757600080fdfea264697066735822122085dcbfb8a57b6b09cdf30302035056fe7b3d96a5e3592714378d216811b478ed64736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 1,529 |
0x313b2d598dEC8F20bd683F6212f3703a462b2767 | pragma solidity ^0.4.23;
library SafeMathLib {
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);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract DateTimeLib {
struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
uint8 hour;
uint8 minute;
uint8 second;
uint8 weekday;
}
uint constant DAY_IN_SECONDS = 86400;
uint constant YEAR_IN_SECONDS = 31536000;
uint constant LEAP_YEAR_IN_SECONDS = 31622400;
uint constant HOUR_IN_SECONDS = 3600;
uint constant MINUTE_IN_SECONDS = 60;
uint16 constant ORIGIN_YEAR = 1970;
function isLeapYear(uint16 year) internal pure returns (bool) {
if (year % 4 != 0) {
return false;
}
if (year % 100 != 0) {
return true;
}
if (year % 400 != 0) {
return false;
}
return true;
}
function leapYearsBefore(uint year) internal pure returns (uint) {
year -= 1;
return year / 4 - year / 100 + year / 400;
}
function getDaysInMonth(uint8 month, uint16 year) internal pure returns (uint8) {
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
}
else if (month == 4 || month == 6 || month == 9 || month == 11) {
return 30;
}
else if (isLeapYear(year)) {
return 29;
}
else {
return 28;
}
}
function parseTimestamp(uint timestamp) internal pure returns (_DateTime dt) {
uint secondsAccountedFor = 0;
uint buf;
uint8 i;
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
uint secondsInMonth;
for (i = 1; i <= 12; i++) {
secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year);
if (secondsInMonth + secondsAccountedFor > timestamp) {
dt.month = i;
break;
}
secondsAccountedFor += secondsInMonth;
}
for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
secondsAccountedFor += DAY_IN_SECONDS;
}
dt.hour = getHour(timestamp);
dt.minute = getMinute(timestamp);
dt.second = getSecond(timestamp);
dt.weekday = getWeekday(timestamp);
}
function getYear(uint timestamp) internal pure returns (uint16) {
uint secondsAccountedFor = 0;
uint16 year;
uint numLeapYears;
year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS);
numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears;
secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears);
while (secondsAccountedFor > timestamp) {
if (isLeapYear(uint16(year - 1))) {
secondsAccountedFor -= LEAP_YEAR_IN_SECONDS;
}
else {
secondsAccountedFor -= YEAR_IN_SECONDS;
}
year -= 1;
}
return year;
}
function getMonth(uint timestamp) internal pure returns (uint8) {
return parseTimestamp(timestamp).month;
}
function getDay(uint timestamp) internal pure returns (uint8) {
return parseTimestamp(timestamp).day;
}
function getHour(uint timestamp) internal pure returns (uint8) {
return uint8((timestamp / 60 / 60) % 24);
}
function getMinute(uint timestamp) internal pure returns (uint8) {
return uint8((timestamp / 60) % 60);
}
function getSecond(uint timestamp) internal pure returns (uint8) {
return uint8(timestamp % 60);
}
function getWeekday(uint timestamp) internal pure returns (uint8) {
return uint8((timestamp / DAY_IN_SECONDS + 4) % 7);
}
function toTimestamp(uint16 year, uint8 month, uint8 day) internal pure returns (uint timestamp) {
return toTimestamp(year, month, day, 0, 0, 0);
}
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour) internal pure returns (uint timestamp) {
return toTimestamp(year, month, day, hour, 0, 0);
}
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) internal pure returns (uint timestamp) {
return toTimestamp(year, month, day, hour, minute, 0);
}
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second) internal pure returns (uint timestamp) {
uint16 i;
for (i = ORIGIN_YEAR; i < year; i++) {
if (isLeapYear(i)) {
timestamp += LEAP_YEAR_IN_SECONDS;
}
else {
timestamp += YEAR_IN_SECONDS;
}
}
uint8[12] memory monthDayCounts;
monthDayCounts[0] = 31;
if (isLeapYear(year)) {
monthDayCounts[1] = 29;
}
else {
monthDayCounts[1] = 28;
}
monthDayCounts[2] = 31;
monthDayCounts[3] = 30;
monthDayCounts[4] = 31;
monthDayCounts[5] = 30;
monthDayCounts[6] = 31;
monthDayCounts[7] = 31;
monthDayCounts[8] = 30;
monthDayCounts[9] = 31;
monthDayCounts[10] = 30;
monthDayCounts[11] = 31;
for (i = 1; i < month; i++) {
timestamp += DAY_IN_SECONDS * monthDayCounts[i - 1];
}
timestamp += DAY_IN_SECONDS * (day - 1);
timestamp += HOUR_IN_SECONDS * (hour);
timestamp += MINUTE_IN_SECONDS * (minute);
timestamp += second;
return timestamp;
}
}
interface IERC20 {
function totalSupply() external constant returns (uint256);
function balanceOf(address _owner) external constant returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) external constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address _spender, uint256 _value);
}
contract StandardToken is IERC20,DateTimeLib {
using SafeMathLib for uint256;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
string public constant symbol = "NMC";
string public constant name = "NamyChain Coin";
uint _totalSupply = 1000000000 * 10 ** 8;
uint8 public constant decimals = 8;
function totalSupply() external constant returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) external constant returns (uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _value) public returns (bool success) {
return transferInternal(msg.sender, _to, _value);
}
function transferInternal(address _from, address _to, uint256 _value) internal returns (bool success) {
require(_value > 0 && balances[_from] >= _value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value > 0 && allowed[_from][msg.sender] >= _value && balances[_from] >= _value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract LockableToken is StandardToken {
address internal developerReservedAddress = 0xbECbC200EDe5FAC310FD0224dA88FB8eFE2cf10D;
uint[4] internal developerReservedUnlockTimes;
uint256[4] internal developerReservedBalanceLimits;
mapping(address => uint256) internal balanceLocks;
mapping(address => uint) internal timeLocks;
function getLockInfo(address _address) public constant returns (uint timeLock, uint256 balanceLock) {
return (timeLocks[_address], balanceLocks[_address]);
}
function getDeveloperReservedBalanceLimit() internal returns (uint256 balanceLimit) {
uint time = now;
for (uint index = 0; index < developerReservedUnlockTimes.length; index++) {
if (developerReservedUnlockTimes[index] == 0x0) {
continue;
}
if (time > developerReservedUnlockTimes[index]) {
developerReservedUnlockTimes[index] = 0x0;
} else {
return developerReservedBalanceLimits[index];
}
}
return 0;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
return transferInternal(msg.sender, _to, _value);
}
function transferInternal(address _from, address _to, uint256 _value) internal returns (bool success) {
require(_from != 0x0 && _to != 0x0 && _value > 0x0);
if (_from == developerReservedAddress) {
uint256 balanceLimit = getDeveloperReservedBalanceLimit();
require(balances[_from].sub(balanceLimit) >= _value);
}
var(timeLock, balanceLock) = getLockInfo(_from);
if (timeLock <= now && timeLock != 0x0) {
timeLock = 0x0;
timeLocks[_from] = 0x0;
balanceLocks[_from] = 0x0;
emit UnLock(_from, timeLock, balanceLock);
balanceLock = 0x0;
}
if (timeLock != 0x0 && balanceLock > 0x0) {
require(balances[_from].sub(balanceLock) >= _value);
}
return super.transferInternal(_from, _to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_from != 0x0 && _to != 0x0 && _value > 0x0);
if (_from == developerReservedAddress) {
uint256 balanceLimit = getDeveloperReservedBalanceLimit();
require(balances[_from].sub(balanceLimit) >= _value);
}
var(timeLock, balanceLock) = getLockInfo(_from);
if (timeLock <= now && timeLock != 0x0) {
timeLock = 0x0;
timeLocks[_from] = 0x0;
balanceLocks[_from] = 0x0;
emit UnLock(_from, timeLock, balanceLock);
balanceLock = 0x0;
}
if (timeLock != 0x0 && balanceLock > 0x0) {
require(balances[_from].sub(balanceLock) >= _value);
}
return super.transferFrom(_from, _to, _value);
}
event DeveloperReservedUnlockTimeChanged(uint index, uint unlockTime, uint newUnlockTime);
event DeveloperReservedLockInfo(address indexed publicOfferingAddress, uint index, uint unlockTime, uint256 balanceLimit);
event Lock(address indexed lockAddress, uint timeLock, uint256 balanceLock);
event UnLock(address indexed lockAddress, uint timeLock, uint256 balanceLock);
}
contract TradeableToken is LockableToken {
address internal publicOfferingAddress = 0xe5eEB1357C74543B475BaAf6fED35f2B0D9e8Ef7;
uint256 public exchangeRate = 7500;
function buy(address _beneficiary, uint256 _weiAmount) internal {
require(_beneficiary != 0x0);
require(publicOfferingAddress != 0x0);
require(exchangeRate > 0x0);
require(_weiAmount > 0x0);
uint256 exchangeToken = _weiAmount.mul(exchangeRate);
exchangeToken = exchangeToken.div(1 * 10 ** 10);
publicOfferingAddress.transfer(_weiAmount);
super.transferInternal(publicOfferingAddress, _beneficiary, exchangeToken);
}
event ExchangeRateChanged(uint256 oldExchangeRate,uint256 newExchangeRate);
}
contract OwnableToken is TradeableToken {
address internal owner = 0xd07cA79B4Cb32c2A91F23E7eC49BED63706aD207;
mapping(address => uint) administrators;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyAdministrator() {
require(msg.sender == owner || administrators[msg.sender] > 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner public returns (bool success) {
require(_newOwner != address(0));
owner = _newOwner;
emit OwnershipTransferred(owner, _newOwner);
return true;
}
function addAdministrator(address _adminAddress) onlyOwner public returns (bool success) {
require(_adminAddress != address(0));
require(administrators[_adminAddress] <= 0x0);
administrators[_adminAddress] = 0x1;
emit AddAdministrator(_adminAddress);
return true;
}
function removeAdministrator(address _adminAddress) onlyOwner public returns (bool success) {
require(_adminAddress != address(0));
require(administrators[_adminAddress] > 0x0);
administrators[_adminAddress] = 0x0;
emit RemoveAdministrator(_adminAddress);
return true;
}
function isAdministrator(address _adminAddress) view public returns (bool success) {
require(_adminAddress != address(0));
return (administrators[_adminAddress] == 0x1 || _adminAddress == owner);
}
function setExchangeRate(uint256 _exchangeRate) public onlyAdministrator returns (bool success) {
require(_exchangeRate > 0x0);
uint256 oldExchangeRate = exchangeRate;
exchangeRate = _exchangeRate;
emit ExchangeRateChanged(oldExchangeRate, exchangeRate);
return true;
}
function changeUnlockTime(uint _index, uint _unlockTime) public onlyAdministrator returns (bool success) {
require(_index >= 0x0 && _index < developerReservedUnlockTimes.length && _unlockTime > 0x0);
if(_index > 0x0) {
uint beforeUnlockTime = developerReservedUnlockTimes[_index - 1];
require(beforeUnlockTime == 0x0 || beforeUnlockTime < _unlockTime);
}
if(_index < developerReservedUnlockTimes.length - 1) {
uint afterUnlockTime = developerReservedUnlockTimes[_index + 1];
require(afterUnlockTime == 0x0 || _unlockTime < afterUnlockTime);
}
uint oldUnlockTime = developerReservedUnlockTimes[_index];
developerReservedUnlockTimes[_index] = _unlockTime;
emit DeveloperReservedUnlockTimeChanged(_index,oldUnlockTime,_unlockTime);
return true;
}
function getDeveloperReservedLockInfo(uint _index) public onlyAdministrator returns (uint, uint256) {
require(_index >= 0x0 && _index < developerReservedUnlockTimes.length && _index < developerReservedBalanceLimits.length);
emit DeveloperReservedLockInfo(developerReservedAddress,_index,developerReservedUnlockTimes[_index],developerReservedBalanceLimits[_index]);
return (developerReservedUnlockTimes[_index], developerReservedBalanceLimits[_index]);
}
function lock(address _owner, uint _releaseTime, uint256 _value) public onlyAdministrator returns (uint releaseTime, uint256 limit) {
require(_owner != 0x0 && _value > 0x0 && _releaseTime >= now);
balanceLocks[_owner] = _value;
timeLocks[_owner] = _releaseTime;
emit Lock(_owner, _releaseTime, _value);
return (_releaseTime, _value);
}
function unlock(address _owner) public onlyAdministrator returns (bool) {
require(_owner != 0x0);
uint _releaseTime = timeLocks[_owner];
uint256 _value = balanceLocks[_owner];
balanceLocks[_owner] = 0x0;
timeLocks[_owner] = 0x0;
emit UnLock(_owner, _releaseTime, _value);
return true;
}
function transferAndLock(address _to, uint256 _value, uint _releaseTime) public onlyAdministrator returns (bool success) {
require(_to != 0x0);
require(_value > 0);
require(_releaseTime >= now);
require(_value <= balances[msg.sender]);
lock(_to, _releaseTime, _value);
super.transfer(_to, _value);
return true;
}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event AddAdministrator(address indexed adminAddress);
event RemoveAdministrator(address indexed adminAddress);
}
contract NMC is OwnableToken {
constructor() public {
balances[owner] = 500000000 * 10 ** 8;
balances[publicOfferingAddress] = 300000000 * 10 ** 8;
uint256 developerReservedBalance = 200000000 * 10 ** 8;
balances[developerReservedAddress] = developerReservedBalance;
developerReservedUnlockTimes =
[
DateTimeLib.toTimestamp(2019, 8, 1),
DateTimeLib.toTimestamp(2020, 8, 1),
DateTimeLib.toTimestamp(2021, 8, 1),
DateTimeLib.toTimestamp(2022, 8, 1)
];
developerReservedBalanceLimits =
[
developerReservedBalance,
developerReservedBalance - (developerReservedBalance / 4) * 1,
developerReservedBalance - (developerReservedBalance / 4) * 2,
developerReservedBalance - (developerReservedBalance / 4) * 3
];
}
function() public payable {
buy(msg.sender, msg.value);
}
} | 0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610129578063095ea7b3146101b95780630a2eb3011461021e57806318160ddd1461027957806323b872dd146102a45780632f6c493c14610329578063313ce567146103845780633ba0b9a9146103b557806368fa8134146103e057806370a082311461043b5780637238ccdb1461049257806384d5d944146104f057806395d89b411461055f578063a9059cbb146105ef578063aad7104014610654578063c9991176146106a3578063db068e0e146106fe578063dd62ed3e14610743578063e2ab691d146107ba578063f2fde38b1461082c578063f6988b7914610887575b61012733346108cf565b005b34801561013557600080fd5b5061013e610a2b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017e578082015181840152602081019050610163565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c557600080fd5b50610204600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a64565b604051808215151515815260200191505060405180910390f35b34801561022a57600080fd5b5061025f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b73565b604051808215151515815260200191505060405180910390f35b34801561028557600080fd5b5061028e610c52565b6040518082815260200191505060405180910390f35b3480156102b057600080fd5b5061030f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c5c565b604051808215151515815260200191505060405180910390f35b34801561033557600080fd5b5061036a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f10565b604051808215151515815260200191505060405180910390f35b34801561039057600080fd5b50610399611150565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103c157600080fd5b506103ca611155565b6040518082815260200191505060405180910390f35b3480156103ec57600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061115b565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b5061047c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d4565b6040518082815260200191505060405180910390f35b34801561049e57600080fd5b506104d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061131c565b604051808381526020018281526020019250505060405180910390f35b3480156104fc57600080fd5b50610545600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506113a8565b604051808215151515815260200191505060405180910390f35b34801561056b57600080fd5b50610574611504565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b4578082015181840152602081019050610599565b50505050905090810190601f1680156105e15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105fb57600080fd5b5061063a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061153d565b604051808215151515815260200191505060405180910390f35b34801561066057600080fd5b506106896004803603810190808035906020019092919080359060200190929190505050611552565b604051808215151515815260200191505060405180910390f35b3480156106af57600080fd5b506106e4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611717565b604051808215151515815260200191505060405180910390f35b34801561070a57600080fd5b5061072960048036038101908080359060200190929190505050611891565b604051808215151515815260200191505060405180910390f35b34801561074f57600080fd5b506107a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119a0565b6040518082815260200191505060405180910390f35b3480156107c657600080fd5b5061080f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611a27565b604051808381526020018281526020019250505060405180910390f35b34801561083857600080fd5b5061086d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bfa565b604051808215151515815260200191505060405180910390f35b34801561089357600080fd5b506108b260048036038101908080359060200190929190505050611d5a565b604051808381526020018281526020019250505060405180910390f35b6000808373ffffffffffffffffffffffffffffffffffffffff16141515156108f657600080fd5b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561093e57600080fd5b6000600f5411151561094f57600080fd5b60008211151561095e57600080fd5b610973600f5483611ef690919063ffffffff16565b905061098d6402540be40082611f2990919063ffffffff16565b9050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156109f7573d6000803e3d6000fd5b50610a25600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168483611f6a565b50505050565b6040805190810160405280600e81526020017f4e616d79436861696e20436f696e00000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a26001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610bb057600080fd5b6001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480610c4b5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b9050919050565b6000600254905090565b60008060008060008773ffffffffffffffffffffffffffffffffffffffff1614158015610ca0575060008673ffffffffffffffffffffffffffffffffffffffff1614155b8015610cac5750600085115b1515610cb757600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610d7757610d1561221e565b925084610d69846000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b10151515610d7657600080fd5b5b610d808761131c565b91509150428211158015610d95575060008214155b15610e8357600091506000600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff167fc56cef68903bdd36458fd80e70fac1fabcf0b8b37d32e6b9d02ccef26642570b8383604051808381526020018281526020019250505060405180910390a2600090505b60008214158015610e945750600081115b15610ef95784610eeb826000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b10151515610ef857600080fd5b5b610f048787876122ce565b93505050509392505050565b6000806000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610fb057506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1515610fbb57600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff1614151515610fe157600080fd5b600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167fc56cef68903bdd36458fd80e70fac1fabcf0b8b37d32e6b9d02ccef26642570b8383604051808381526020018281526020019250505060405180910390a2600192505050919050565b600881565b600f5481565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111b957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156111f557600080fd5b6000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561124357600080fd5b6000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f5e40a439a19faa971f5d14cf300dcd7ee0d236808b9a988c9b4ca89cb833e96160405160405180910390a260019050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061144557506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b151561145057600080fd5b60008473ffffffffffffffffffffffffffffffffffffffff161415151561147657600080fd5b60008311151561148557600080fd5b42821015151561149457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156114e157600080fd5b6114ec848385611a27565b50506114f8848461153d565b50600190509392505050565b6040805190810160405280600381526020017f4e4d43000000000000000000000000000000000000000000000000000000000081525081565b600061154a338484611f6a565b905092915050565b600080600080601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115f357506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15156115fe57600080fd5b6000861015801561160f5750600486105b801561161b5750600085115b151561162657600080fd5b600086111561165f5760046001870360048110151561164157fe5b01549250600083148061165357508483105b151561165e57600080fd5b5b600160040386101561169b5760046001870160048110151561167d57fe5b01549150600082148061168f57508185105b151561169a57600080fd5b5b6004866004811015156116aa57fe5b01549050846004876004811015156116be57fe5b01819055507fbf790663d2af8830f8589af82ffcf2307f6f0d20b9a4f38b6e2219739e70fe7a86828760405180848152602001838152602001828152602001935050505060405180910390a16001935050505092915050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156117b157600080fd5b6000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115151561180057600080fd5b6001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f6e5eedde7d0d690d55dea362660be04ef1eb36252e48817545afb1ae6b245a4060405160405180910390a260019050919050565b600080601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061192f57506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b151561193a57600080fd5b60008311151561194957600080fd5b600f54905082600f819055507fb01b0304cdcaffa13e4b57ecbe280da183afb719becd1d56e9211cc3781ea42181600f54604051808381526020018281526020019250505060405180910390a16001915050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611ac557506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1515611ad057600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff1614158015611af75750600083115b8015611b035750428410155b1515611b0e57600080fd5b82600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8585604051808381526020018281526020019250505060405180910390a2838391509150935093915050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c5857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611c9457600080fd5b81601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360019050919050565b600080601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611df857506000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1515611e0357600080fd5b60008310158015611e145750600483105b8015611e205750600483105b1515611e2b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f84a36c1f95c5b90497f063912621cdc88710ee4fffb678361d2caecc144130a184600486600481101515611e9557fe5b0154600887600481101515611ea657fe5b015460405180848152602001838152602001828152602001935050505060405180910390a2600483600481101515611eda57fe5b0154600884600481101515611eeb57fe5b015491509150915091565b60008082840290506000841480611f175750828482811515611f1457fe5b04145b1515611f1f57fe5b8091505092915050565b600080600083111515611f3857fe5b8284811515611f4357fe5b0490508284811515611f5157fe5b068184020184141515611f6057fe5b8091505092915050565b60008060008060008773ffffffffffffffffffffffffffffffffffffffff1614158015611fae575060008673ffffffffffffffffffffffffffffffffffffffff1614155b8015611fba5750600085115b1515611fc557600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156120855761202361221e565b925084612077846000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b1015151561208457600080fd5b5b61208e8761131c565b915091504282111580156120a3575060008214155b1561219157600091506000600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff167fc56cef68903bdd36458fd80e70fac1fabcf0b8b37d32e6b9d02ccef26642570b8383604051808381526020018281526020019250505060405180910390a2600090505b600082141580156121a25750600081115b1561220757846121f9826000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b1015151561220657600080fd5b5b612212878787612655565b93505050509392505050565b6000806000429150600090505b60048110156122ab57600060048260048110151561224557fe5b015414156122525761229e565b60048160048110151561226157fe5b015482111561228557600060048260048110151561227b57fe5b018190555061229d565b60088160048110151561229457fe5b015492506122b0565b5b808060010191505061222b565b600092505b505090565b60008282111515156122c357fe5b818303905092915050565b6000808211801561235b575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156123a55750816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b15156123b057600080fd5b612401826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612494826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256582600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080821180156126a45750816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b15156126af57600080fd5b612700826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612793826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561285957fe5b8091505092915050565b6000612875848484600080600061287e565b90509392505050565b600080612889612ba6565b6107b291505b8861ffff168261ffff1610156128d2576128a882612b25565b156128bb576301e28500830192506128c5565b6301e13380830192505b818060010192505061288f565b601f816000600c811015156128e357fe5b602002019060ff16908160ff16815250506128fd89612b25565b1561292957601d816001600c8110151561291357fe5b602002019060ff16908160ff168152505061294c565b601c816001600c8110151561293a57fe5b602002019060ff16908160ff16815250505b601f816002600c8110151561295d57fe5b602002019060ff16908160ff1681525050601e816003600c8110151561297f57fe5b602002019060ff16908160ff1681525050601f816004600c811015156129a157fe5b602002019060ff16908160ff1681525050601e816005600c811015156129c357fe5b602002019060ff16908160ff1681525050601f816006600c811015156129e557fe5b602002019060ff16908160ff1681525050601f816007600c81101515612a0757fe5b602002019060ff16908160ff1681525050601e816008600c81101515612a2957fe5b602002019060ff16908160ff1681525050601f816009600c81101515612a4b57fe5b602002019060ff16908160ff1681525050601e81600a600c81101515612a6d57fe5b602002019060ff16908160ff1681525050601f81600b600c81101515612a8f57fe5b602002019060ff16908160ff1681525050600191505b8760ff168261ffff161015612ae757806001830361ffff16600c81101515612ac957fe5b602002015160ff166201518002830192508180600101925050612aa5565b6001870360ff166201518002830192508560ff16610e1002830192508460ff16603c02830192508360ff168301925082925050509695505050505050565b60008060048361ffff16811515612b3857fe5b0661ffff16141515612b4d5760009050612ba1565b600060648361ffff16811515612b5f57fe5b0661ffff16141515612b745760019050612ba1565b60006101908361ffff16811515612b8757fe5b0661ffff16141515612b9c5760009050612ba1565b600190505b919050565b61018060405190810160405280600c906020820280388339808201915050905050905600a165627a7a723058200f8b122c3a4b5cbd361cc7c076c4f575bc2409abe711e12e4c6544fb6027c12b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,530 |
0xae6f9dd1c0f0350f3b92bb2c715bf76a3ffc70c8 | /*
https://t.me/datreon
https://datreon.media/
https://twitter.com/DatreonETH
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract DATREON 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"DATREON";
string public constant symbol = unicode"DAT";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 11;
uint public _sellFee = 11;
uint private _feeRate = 15;
uint public _maxBuyTokens;
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 + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
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);
_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;
_maxBuyTokens = 5000000 * 10**9;
_maxHeldTokens = 20000000 * 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 < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external onlyOwner(){
_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];
}
} | 0x6080604052600436106101e75760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf91461058f578063db92dbb6146105a4578063dcb0e0ad146105b9578063dd62ed3e146105d957600080fd5b8063a9059cbb1461051a578063b2289c621461053a578063b515566a1461055a578063c3c8cd801461057a57600080fd5b80638da5cb5b116100d15780638da5cb5b1461049857806394b8d8f2146104b657806395d89b41146104d65780639e78fb4f1461050557600080fd5b80636fc3eaec1461042e57806370a0823114610443578063715018a61461046357806373f54a111461047857600080fd5b806331c2d8471161017a57806345596e2e1161014957806345596e2e146103aa57806349bd5a5e146103ca578063590f897e146104025780636755a4d01461041857600080fd5b806331c2d8471461032557806332d873d8146103455780633bbac5791461035b57806340b9a54b1461039457600080fd5b80631940d020116101b65780631940d020146102b357806323b872dd146102c957806327f3a72a146102e9578063313ce567146102fe57600080fd5b806306fdde03146101f3578063095ea7b31461023c5780630b78f9c01461026c57806318160ddd1461028e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610226604051806040016040528060078152602001662220aa2922a7a760c91b81525081565b6040516102339190611747565b60405180910390f35b34801561024857600080fd5b5061025c6102573660046117c1565b61061f565b6040519015158152602001610233565b34801561027857600080fd5b5061028c6102873660046117ed565b610635565b005b34801561029a57600080fd5b50670de0b6b3a76400005b604051908152602001610233565b3480156102bf57600080fd5b506102a5600d5481565b3480156102d557600080fd5b5061025c6102e436600461180f565b6106ca565b3480156102f557600080fd5b506102a561071e565b34801561030a57600080fd5b50610313600981565b60405160ff9091168152602001610233565b34801561033157600080fd5b5061028c610340366004611866565b61072e565b34801561035157600080fd5b506102a5600e5481565b34801561036757600080fd5b5061025c61037636600461192b565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a057600080fd5b506102a560095481565b3480156103b657600080fd5b5061028c6103c5366004611948565b6107c4565b3480156103d657600080fd5b506008546103ea906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b34801561040e57600080fd5b506102a5600a5481565b34801561042457600080fd5b506102a5600c5481565b34801561043a57600080fd5b5061028c61088a565b34801561044f57600080fd5b506102a561045e36600461192b565b610897565b34801561046f57600080fd5b5061028c6108b2565b34801561048457600080fd5b5061028c61049336600461192b565b610926565b3480156104a457600080fd5b506000546001600160a01b03166103ea565b3480156104c257600080fd5b50600f5461025c9062010000900460ff1681565b3480156104e257600080fd5b506102266040518060400160405280600381526020016211105560ea1b81525081565b34801561051157600080fd5b5061028c61099e565b34801561052657600080fd5b5061025c6105353660046117c1565b610ba9565b34801561054657600080fd5b506007546103ea906001600160a01b031681565b34801561056657600080fd5b5061028c610575366004611866565b610bb6565b34801561058657600080fd5b5061028c610ccf565b34801561059b57600080fd5b5061028c610ce5565b3480156105b057600080fd5b506102a5610ea4565b3480156105c557600080fd5b5061028c6105d436600461196f565b610ebc565b3480156105e557600080fd5b506102a56105f436600461198c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061062c338484610f39565b50600192915050565b6000546001600160a01b031633146106685760405162461bcd60e51b815260040161065f906119c5565b60405180910390fd5b6009548210801561067a5750600a5481105b61068357600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106d784848461105d565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610706908490611a10565b9050610713853383610f39565b506001949350505050565b600061072930610897565b905090565b6000546001600160a01b031633146107585760405162461bcd60e51b815260040161065f906119c5565b60005b81518110156107c05760006005600084848151811061077c5761077c611a27565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107b881611a3d565b91505061075b565b5050565b6000546001600160a01b031633146107ee5760405162461bcd60e51b815260040161065f906119c5565b6007546001600160a01b0316336001600160a01b03161461080e57600080fd5b6000811161084e5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b604482015260640161065f565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761089481611414565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108dc5760405162461bcd60e51b815260040161065f906119c5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109505760405162461bcd60e51b815260040161065f906119c5565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161087f565b6000546001600160a01b031633146109c85760405162461bcd60e51b815260040161065f906119c5565b600f5460ff1615610a1b5760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161065f565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa49190611a58565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b159190611a58565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b869190611a58565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061062c33848461105d565b6000546001600160a01b03163314610be05760405162461bcd60e51b815260040161065f906119c5565b60005b81518110156107c05760085482516001600160a01b0390911690839083908110610c0f57610c0f611a27565b60200260200101516001600160a01b031614158015610c60575060065482516001600160a01b0390911690839083908110610c4c57610c4c611a27565b60200260200101516001600160a01b031614155b15610cbd57600160056000848481518110610c7d57610c7d611a27565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610cc781611a3d565b915050610be3565b6000610cda30610897565b90506108948161144e565b6000546001600160a01b03163314610d0f5760405162461bcd60e51b815260040161065f906119c5565b600f5460ff1615610d1f57600080fd5b600654610d3f9030906001600160a01b0316670de0b6b3a7640000610f39565b6006546001600160a01b031663f305d7194730610d5b81610897565b600080610d706000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610dd8573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dfd9190611a75565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7a9190611aa3565b50600f805460ff1916600117905542600e556611c37937e08000600c5566470de4df820000600d55565b600854600090610729906001600160a01b0316610897565b6000546001600160a01b03163314610ee65760405162461bcd60e51b815260040161065f906119c5565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161087f565b6001600160a01b038316610f9b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161065f565b6001600160a01b038216610ffc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161065f565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561108357600080fd5b6001600160a01b0383166110e75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161065f565b6001600160a01b0382166111495760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161065f565b600081116111ab5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161065f565b600080546001600160a01b038581169116148015906111d857506000546001600160a01b03848116911614155b156113b5576008546001600160a01b03858116911614801561120857506006546001600160a01b03848116911614155b801561122d57506001600160a01b03831660009081526004602052604090205460ff16155b156112ce57600f5460ff166112845760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161065f565b42600e5460b46112949190611ac0565b11156112ca57600c548211156112a957600080fd5b600d546112b584610897565b6112bf9084611ac0565b11156112ca57600080fd5b5060015b600f54610100900460ff161580156112e85750600f5460ff165b801561130257506008546001600160a01b03858116911614155b156113b557600061131230610897565b9050801561139e57600f5462010000900460ff161561139557600b5460085460649190611347906001600160a01b0316610897565b6113519190611ad8565b61135b9190611af7565b81111561139557600b546008546064919061137e906001600160a01b0316610897565b6113889190611ad8565b6113929190611af7565b90505b61139e8161144e565b4780156113ae576113ae47611414565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113f757506001600160a01b03841660009081526004602052604090205460ff165b15611400575060005b61140d85858584866115c2565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107c0573d6000803e3d6000fd5b600f805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061149257611492611a27565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150f9190611a58565b8160018151811061152257611522611a27565b6001600160a01b0392831660209182029290920101526006546115489130911684610f39565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611581908590600090869030904290600401611b19565b600060405180830381600087803b15801561159b57600080fd5b505af11580156115af573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b60006115ce83836115e4565b90506115dc86868684611608565b505050505050565b60008083156116015782156115fc5750600954611601565b50600a545b9392505050565b60008061161584846116e5565b6001600160a01b038816600090815260026020526040902054919350915061163e908590611a10565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461166e908390611ac0565b6001600160a01b03861660009081526002602052604090205561169081611719565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116d591815260200190565b60405180910390a3505050505050565b6000808060646116f58587611ad8565b6116ff9190611af7565b9050600061170d8287611a10565b96919550909350505050565b30600090815260026020526040902054611734908290611ac0565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561177457858101830151858201604001528201611758565b81811115611786576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461089457600080fd5b80356117bc8161179c565b919050565b600080604083850312156117d457600080fd5b82356117df8161179c565b946020939093013593505050565b6000806040838503121561180057600080fd5b50508035926020909101359150565b60008060006060848603121561182457600080fd5b833561182f8161179c565b9250602084013561183f8161179c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561187957600080fd5b823567ffffffffffffffff8082111561189157600080fd5b818501915085601f8301126118a557600080fd5b8135818111156118b7576118b7611850565b8060051b604051601f19603f830116810181811085821117156118dc576118dc611850565b6040529182528482019250838101850191888311156118fa57600080fd5b938501935b8285101561191f57611910856117b1565b845293850193928501926118ff565b98975050505050505050565b60006020828403121561193d57600080fd5b81356116018161179c565b60006020828403121561195a57600080fd5b5035919050565b801515811461089457600080fd5b60006020828403121561198157600080fd5b813561160181611961565b6000806040838503121561199f57600080fd5b82356119aa8161179c565b915060208301356119ba8161179c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a2257611a226119fa565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a5157611a516119fa565b5060010190565b600060208284031215611a6a57600080fd5b81516116018161179c565b600080600060608486031215611a8a57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ab557600080fd5b815161160181611961565b60008219821115611ad357611ad36119fa565b500190565b6000816000190483118215151615611af257611af26119fa565b500290565b600082611b1457634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b695784516001600160a01b031683529383019391830191600101611b44565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122018221cb02174eaec2e39b2f31c05e1212ae8f6a1d8af281daeb6de078bf1412264736f6c634300080b0033 | {"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"}]}} | 1,531 |
0xb53a7255d1fba335f759bbf963c8333a962e3148 | pragma solidity 0.8.10;
// SPDX-License-Identifier: MIT
/**
* @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.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = 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];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @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() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function balanceOf(address) external returns (uint256);
}
contract TCAT_TO_VATOR is Ownable {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private holders;
// TCAT token contract address
address public tokenAddressTCAT = 0x0E84D86C3745A05D65f8051407249cd1c4970346;
// VATOR token contract address
address public tokenAddressVATOR = 0x051Bda85FbC58AcE9D6060Ba9488aBE120ac072D;
// Team address
address public addressTeam = 0xD938FFD144253d61Ae7f26194E84fe9929de7b4b;
mapping (address => uint256) public depositedTokens;
function withdraw(uint256 amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(holders.contains(msg.sender), "Not whitelisted..");
require(Token(tokenAddressTCAT).balanceOf(msg.sender) >= amountToWithdraw, "Invalid amount to withdraw");
require(Token(tokenAddressTCAT).transferFrom(msg.sender, addressTeam, amountToWithdraw), "Could not transfer token.");
require(Token(tokenAddressVATOR).transferFrom(addressTeam, msg.sender, amountToWithdraw), "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 addHolders(address[] memory _holders, uint256[] memory _values) onlyOwner public returns (bool) {
require(_holders.length == _values.length);
for (uint i = 0; i < _values.length; i++) {
Add(_holders[i], _values[i]);
}
return true;
}
function Add(address account, uint256 amount) private {
holders.add(account);
depositedTokens[account] = depositedTokens[account].add(amount);
}
function setTokenAddressTCAT(address _tokenAddress) public onlyOwner {
tokenAddressTCAT = _tokenAddress;
}
function setTokenAddressVATOR(address _tokenAddress) public onlyOwner {
tokenAddressVATOR = _tokenAddress;
}
function setTeamAddress(address _teamAddress) public onlyOwner {
addressTeam = _teamAddress;
}
// function to allow admin to claim *any* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddress, address _to, uint256 _amount) public onlyOwner {
Token(_tokenAddress).transfer(_to, _amount);
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80637d4437c0116100715780637d4437c0146101655780638da5cb5b146101955780638e9bea1c146101b3578063c326bf4f146101cf578063eb906836146101ff578063f2fde38b1461021d576100b4565b80632e1a7d4d146100b95780633e5ac182146100d55780634a2fe189146100f3578063562e9df91461010f5780636690864e1461012d5780636a395ccb14610149575b600080fd5b6100d360048036038101906100ce919061100a565b610239565b005b6100dd610706565b6040516100ea9190611078565b60405180910390f35b61010d600480360381019061010891906110bf565b61072c565b005b6101176107c8565b6040516101249190611078565b60405180910390f35b610147600480360381019061014291906110bf565b6107ee565b005b610163600480360381019061015e91906110ec565b61088a565b005b61017f600480360381019061017a919061135b565b610966565b60405161018c91906113ee565b60405180910390f35b61019d610a37565b6040516101aa9190611078565b60405180910390f35b6101cd60048036038101906101c891906110bf565b610a5b565b005b6101e960048036038101906101e491906110bf565b610af7565b6040516101f69190611418565b60405180910390f35b610207610b0f565b6040516102149190611078565b60405180910390f35b610237600480360381019061023291906110bf565b610b35565b005b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156102bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b290611490565b60405180910390fd5b6102cf336001610c8490919063ffffffff16565b61030e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610305906114fc565b60405180910390fd5b80600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b815260040161036a9190611078565b6020604051808303816000875af1158015610389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ad9190611531565b10156103ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e590611490565b60405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b815260040161046f9392919061155e565b6020604051808303816000875af115801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b291906115c1565b6104f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e89061163a565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633846040518463ffffffff1660e01b81526004016105729392919061155e565b6020604051808303816000875af1158015610591573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b591906115c1565b6105f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105eb906116a6565b60405180910390fd5b61064681600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cb490919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061069d336001610c8490919063ffffffff16565b80156106e857506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561070357610701336001610cdb90919063ffffffff16565b505b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461078457600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461084657600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e257600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b815260040161091d9291906116c6565b6020604051808303816000875af115801561093c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096091906115c1565b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109c157600080fd5b81518351146109cf57600080fd5b60005b8251811015610a2c57610a198482815181106109f1576109f06116ef565b5b6020026020010151848381518110610a0c57610a0b6116ef565b5b6020026020010151610d0b565b8080610a249061174d565b9150506109d2565b506001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ab357600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b8d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610bc757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610cac836000018373ffffffffffffffffffffffffffffffffffffffff1660001b610db9565b905092915050565b600082821115610cc757610cc6611796565b5b8183610cd391906117c5565b905092915050565b6000610d03836000018373ffffffffffffffffffffffffffffffffffffffff1660001b610ddc565b905092915050565b610d1f826001610ef490919063ffffffff16565b50610d7281600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2490919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114610ee8576000600182610e0e91906117c5565b9050600060018660000180549050610e2691906117c5565b90506000866000018281548110610e4057610e3f6116ef565b5b9060005260206000200154905080876000018481548110610e6457610e636116ef565b5b9060005260206000200181905550600183610e7f91906117f9565b8760010160008381526020019081526020016000208190555086600001805480610eac57610eab61184f565b5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610eee565b60009150505b92915050565b6000610f1c836000018373ffffffffffffffffffffffffffffffffffffffff1660001b610f50565b905092915050565b6000808284610f3391906117f9565b905083811015610f4657610f45611796565b5b8091505092915050565b6000610f5c8383610db9565b610fb5578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050610fba565b600090505b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610fe781610fd4565b8114610ff257600080fd5b50565b60008135905061100481610fde565b92915050565b6000602082840312156110205761101f610fca565b5b600061102e84828501610ff5565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061106282611037565b9050919050565b61107281611057565b82525050565b600060208201905061108d6000830184611069565b92915050565b61109c81611057565b81146110a757600080fd5b50565b6000813590506110b981611093565b92915050565b6000602082840312156110d5576110d4610fca565b5b60006110e3848285016110aa565b91505092915050565b60008060006060848603121561110557611104610fca565b5b6000611113868287016110aa565b9350506020611124868287016110aa565b925050604061113586828701610ff5565b9150509250925092565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61118d82611144565b810181811067ffffffffffffffff821117156111ac576111ab611155565b5b80604052505050565b60006111bf610fc0565b90506111cb8282611184565b919050565b600067ffffffffffffffff8211156111eb576111ea611155565b5b602082029050602081019050919050565b600080fd5b600061121461120f846111d0565b6111b5565b90508083825260208201905060208402830185811115611237576112366111fc565b5b835b81811015611260578061124c88826110aa565b845260208401935050602081019050611239565b5050509392505050565b600082601f83011261127f5761127e61113f565b5b813561128f848260208601611201565b91505092915050565b600067ffffffffffffffff8211156112b3576112b2611155565b5b602082029050602081019050919050565b60006112d76112d284611298565b6111b5565b905080838252602082019050602084028301858111156112fa576112f96111fc565b5b835b81811015611323578061130f8882610ff5565b8452602084019350506020810190506112fc565b5050509392505050565b600082601f8301126113425761134161113f565b5b81356113528482602086016112c4565b91505092915050565b6000806040838503121561137257611371610fca565b5b600083013567ffffffffffffffff8111156113905761138f610fcf565b5b61139c8582860161126a565b925050602083013567ffffffffffffffff8111156113bd576113bc610fcf565b5b6113c98582860161132d565b9150509250929050565b60008115159050919050565b6113e8816113d3565b82525050565b600060208201905061140360008301846113df565b92915050565b61141281610fd4565b82525050565b600060208201905061142d6000830184611409565b92915050565b600082825260208201905092915050565b7f496e76616c696420616d6f756e7420746f207769746864726177000000000000600082015250565b600061147a601a83611433565b915061148582611444565b602082019050919050565b600060208201905081810360008301526114a98161146d565b9050919050565b7f4e6f742077686974656c69737465642e2e000000000000000000000000000000600082015250565b60006114e6601183611433565b91506114f1826114b0565b602082019050919050565b60006020820190508181036000830152611515816114d9565b9050919050565b60008151905061152b81610fde565b92915050565b60006020828403121561154757611546610fca565b5b60006115558482850161151c565b91505092915050565b60006060820190506115736000830186611069565b6115806020830185611069565b61158d6040830184611409565b949350505050565b61159e816113d3565b81146115a957600080fd5b50565b6000815190506115bb81611595565b92915050565b6000602082840312156115d7576115d6610fca565b5b60006115e5848285016115ac565b91505092915050565b7f436f756c64206e6f74207472616e7366657220746f6b656e2e00000000000000600082015250565b6000611624601983611433565b915061162f826115ee565b602082019050919050565b6000602082019050818103600083015261165381611617565b9050919050565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b6000611690601a83611433565b915061169b8261165a565b602082019050919050565b600060208201905081810360008301526116bf81611683565b9050919050565b60006040820190506116db6000830185611069565b6116e86020830184611409565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061175882610fd4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561178b5761178a61171e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60006117d082610fd4565b91506117db83610fd4565b9250828210156117ee576117ed61171e565b5b828203905092915050565b600061180482610fd4565b915061180f83610fd4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118445761184361171e565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212203345536311e306baa010f5ab1eba9ce68a6618b9594648b8508ad51440a9451464736f6c634300080a0033 | {"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"}]}} | 1,532 |
0x36e4d2d2e500ca798cf032de8d65708c07d16017 | /**
*Submitted for verification at Etherscan.io on 2020-11-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IKeep3rV1Oracle {
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory);
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut);
}
interface IERC20 {
function decimals() external view returns (uint);
}
contract Keep3rV1Volatility {
uint private constant FIXED_1 = 0x080000000000000000000000000000000;
uint private constant FIXED_2 = 0x100000000000000000000000000000000;
uint private constant SQRT_1 = 13043817825332782212;
uint private constant LNX = 3988425491;
uint private constant LOG_10_2 = 3010299957;
uint private constant LOG_E_2 = 6931471806;
uint private constant BASE = 1e10;
IKeep3rV1Oracle public constant KV1O = IKeep3rV1Oracle(0x73353801921417F465377c8d898c6f4C0270282C);
address public constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
function floorLog2(uint256 _n) public pure returns (uint8) {
uint8 res = 0;
if (_n < 256) {
// At most 8 iterations
while (_n > 1) {
_n >>= 1;
res += 1;
}
} else {
// Exactly 8 iterations
for (uint8 s = 128; s > 0; s >>= 1) {
if (_n >= (uint(1) << s)) {
_n >>= s;
res |= s;
}
}
}
return res;
}
function ln(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_E_2 / BASE;
}
/**
* @dev computes e ^ (x / FIXED_1) * FIXED_1
* input range: 0 <= x <= OPT_EXP_MAX_VAL - 1
* auto-generated via 'PrintFunctionOptimalExp.py'
* Detailed description:
* - Rewrite the input as a sum of binary exponents and a single residual r, as small as possible
* - The exponentiation of each binary exponent is given (pre-calculated)
* - The exponentiation of r is calculated via Taylor series for e^x, where x = r
* - The exponentiation of the input is calculated by multiplying the intermediate results above
* - For example: e^5.521692859 = e^(4 + 1 + 0.5 + 0.021692859) = e^4 * e^1 * e^0.5 * e^0.021692859
*/
function optimalExp(uint256 x) public pure returns (uint256) {
uint256 res = 0;
uint256 y;
uint256 z;
z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3)
z = (z * y) / FIXED_1;
res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!)
z = (z * y) / FIXED_1;
res += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!)
z = (z * y) / FIXED_1;
res += z * 0x0168244fdac78000; // add y^04 * (20! / 04!)
z = (z * y) / FIXED_1;
res += z * 0x004807432bc18000; // add y^05 * (20! / 05!)
z = (z * y) / FIXED_1;
res += z * 0x000c0135dca04000; // add y^06 * (20! / 06!)
z = (z * y) / FIXED_1;
res += z * 0x0001b707b1cdc000; // add y^07 * (20! / 07!)
z = (z * y) / FIXED_1;
res += z * 0x000036e0f639b800; // add y^08 * (20! / 08!)
z = (z * y) / FIXED_1;
res += z * 0x00000618fee9f800; // add y^09 * (20! / 09!)
z = (z * y) / FIXED_1;
res += z * 0x0000009c197dcc00; // add y^10 * (20! / 10!)
z = (z * y) / FIXED_1;
res += z * 0x0000000e30dce400; // add y^11 * (20! / 11!)
z = (z * y) / FIXED_1;
res += z * 0x000000012ebd1300; // add y^12 * (20! / 12!)
z = (z * y) / FIXED_1;
res += z * 0x0000000017499f00; // add y^13 * (20! / 13!)
z = (z * y) / FIXED_1;
res += z * 0x0000000001a9d480; // add y^14 * (20! / 14!)
z = (z * y) / FIXED_1;
res += z * 0x00000000001c6380; // add y^15 * (20! / 15!)
z = (z * y) / FIXED_1;
res += z * 0x000000000001c638; // add y^16 * (20! / 16!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000001ab8; // add y^17 * (20! / 17!)
z = (z * y) / FIXED_1;
res += z * 0x000000000000017c; // add y^18 * (20! / 18!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000014; // add y^19 * (20! / 19!)
z = (z * y) / FIXED_1;
res += z * 0x0000000000000001; // add y^20 * (20! / 20!)
res = res / 0x21c3677c82b40000 + y + FIXED_1; // divide by 20! and then add y^1 / 1! + y^0 / 0!
if ((x & 0x010000000000000000000000000000000) != 0)
res = (res * 0x1c3d6a24ed82218787d624d3e5eba95f9) / 0x18ebef9eac820ae8682b9793ac6d1e776; // multiply by e^2^(-3)
if ((x & 0x020000000000000000000000000000000) != 0)
res = (res * 0x18ebef9eac820ae8682b9793ac6d1e778) / 0x1368b2fc6f9609fe7aceb46aa619baed4; // multiply by e^2^(-2)
if ((x & 0x040000000000000000000000000000000) != 0)
res = (res * 0x1368b2fc6f9609fe7aceb46aa619baed5) / 0x0bc5ab1b16779be3575bd8f0520a9f21f; // multiply by e^2^(-1)
if ((x & 0x080000000000000000000000000000000) != 0)
res = (res * 0x0bc5ab1b16779be3575bd8f0520a9f21e) / 0x0454aaa8efe072e7f6ddbab84b40a55c9; // multiply by e^2^(+0)
if ((x & 0x100000000000000000000000000000000) != 0)
res = (res * 0x0454aaa8efe072e7f6ddbab84b40a55c5) / 0x00960aadc109e7a3bf4578099615711ea; // multiply by e^2^(+1)
if ((x & 0x200000000000000000000000000000000) != 0)
res = (res * 0x00960aadc109e7a3bf4578099615711d7) / 0x0002bf84208204f5977f9a8cf01fdce3d; // multiply by e^2^(+2)
if ((x & 0x400000000000000000000000000000000) != 0)
res = (res * 0x0002bf84208204f5977f9a8cf01fdc307) / 0x0000003c6ab775dd0b95b4cbee7e65d11; // multiply by e^2^(+3)
return res;
}
function quote(address tokenIn, address tokenOut, uint t) public view returns (uint call, uint put) {
uint _price = price(tokenIn, tokenOut);
return quotePrice(tokenIn, tokenIn == WETH ? tokenOut : WETH, t, _price, _price);
}
function price(address tokenIn, address tokenOut) public view returns (uint) {
if (tokenIn == WETH) {
return KV1O.current(WETH, 1e18, tokenOut);
} else {
uint _weth = KV1O.current(tokenIn, uint(10)**IERC20(tokenIn).decimals(), WETH);
return KV1O.current(WETH, _weth, tokenOut);
}
}
function quotePrice(address tokenIn, address tokenOut, uint t, uint sp, uint st) public view returns (uint call, uint put) {
uint v = rVol(tokenIn, tokenOut, 4, 24);
return quoteAll(t, v, sp, st);
}
function quoteAll(uint t, uint v, uint sp, uint st) public pure returns (uint call, uint put) {
uint _c;
uint _p;
if (sp > st) {
_c = C(t, v, sp, st);
_p = st-sp+_c;
} else {
_p = C(t, v, st, sp);
_c = st-sp+_p;
}
return (_c, _p);
}
function C(uint t, uint v, uint sp, uint st) public pure returns (uint) {
if (sp == st) {
return LNX * sp / 1e10 * v / 1e18 * sqrt(1e18 * t / 365) / 1e9;
}
uint sigma = ((v**2)/2);
uint sigmaB = 1e36;
uint sig = 1e18 * sigma / sigmaB * t / 365;
uint sSQRT = v * sqrt(1e18 * t / 365) / 1e9;
uint d1 = 1e18 * ln(FIXED_1 * sp / st) / FIXED_1;
d1 = (d1 + sig) * 1e18 / sSQRT;
uint d2 = d1 - sSQRT;
uint cdfD1 = ncdf(FIXED_1 * d1 / 1e18);
uint cdfD2 = cdf(int(FIXED_1) * int(d2) / 1e18);
return sp * cdfD1 / 1e14 - st * cdfD2 / 1e14;
}
function ncdf(uint x) public pure returns (uint) {
int t1 = int(1e7 + (2315419 * x / FIXED_1));
uint exp = x / 2 * x / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
/**
* @notice Takes the absolute value of a given number
* @dev Helper function
* @param _number The specified number
* @return The absolute value of the number
*/
function abs(int256 _number) public pure returns (uint256) {
return _number < 0 ? uint256(_number * (-1)) : uint256(_number);
}
function cdf(int x) public pure returns (uint) {
int t1 = int(1e7 + int(2315419 * abs(x) / FIXED_1));
uint exp = uint(x / 2 * x) / FIXED_1;
int d = int(3989423 * FIXED_1 / optimalExp(uint(exp)));
uint prob = uint(d * (3193815 + ( -3565638 + (17814780 + (-18212560 + 13302740 * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1) * 1e7 / t1);
if( x > 0 ) prob = 1e14 - prob;
return prob;
}
function generalLog(uint256 x) public pure returns (uint) {
uint res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = count * FIXED_1;
}
// If x > 1, then we compute the fraction part of log2(x), which is larger than 0.
if (x > FIXED_1) {
for (uint8 i = 127; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += uint(1) << (i - 1);
}
}
}
return res * LOG_10_2 / BASE;
}
function sqrt(uint x) public pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
function vol(uint[] memory p) public pure returns (uint x) {
for (uint8 i = 1; i <= (p.length-1); i++) {
x += ((generalLog(p[i] * FIXED_1) - generalLog(p[i-1] * FIXED_1)))**2;
//denom += FIXED_1**2;
}
//return (sum, denom);
x = sqrt(uint(252) * sqrt(x / (p.length-1)));
return uint(1e18) * x / SQRT_1;
}
function rVol(address tokenIn, address tokenOut, uint points, uint window) public view returns (uint) {
return vol(KV1O.sample(tokenIn, uint(10)**IERC20(tokenIn).decimals(), tokenOut, points, window));
}
function rVolHourly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 2);
}
function rVolDaily(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 48);
}
function rVolWeekly(address tokenIn, address tokenOut, uint points) external view returns (uint) {
return rVol(tokenIn, tokenOut, points, 336);
}
function rVolHourlyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 2);
}
function rVolDailyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 48);
}
function rVolWeeklyRecent(address tokenIn, address tokenOut) external view returns (uint) {
return rVol(tokenIn, tokenOut, 2, 336);
}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806365c3c2b4116100c3578063b64663841161007c578063b64663841461049a578063c6a51535146104d0578063c801e06714610506578063d0b71b1e1461053c578063d3442edf14610559578063e031d453146105885761014d565b806365c3c2b414610363578063677342ce146103915780637f8290d0146103ae578063892f82f0146103d25780639505086214610475578063ad5c4648146104925761014d565b80632b00490d116101155780632b00490d146102445780632b9432a8146102725780633394f9ed146102a15780633a6fdf47146102d757806345b8bafc146103135780634c3eea9e146103465761014d565b80630969e8db146101525780630e755974146101ad578063101c5422146101ed5780631b5ac4b51461020a57806324d4e90a14610227575b600080fd5b610194600480360360a081101561016857600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356105b6565b6040805192835260208301919091528051918290030190f35b6101db600480360360408110156101c357600080fd5b506001600160a01b03813581169160200135166105e6565b60408051918252519081900360200190f35b6101db6004803603602081101561020357600080fd5b5035610600565b6101db6004803603602081101561022057600080fd5b50356106ce565b6101db6004803603602081101561023d57600080fd5b50356106e4565b6101db6004803603604081101561025a57600080fd5b506001600160a01b038135811691602001351661077a565b6101946004803603608081101561028857600080fd5b5080359060208101359060408101359060600135610a2b565b6101db600480360360608110156102b757600080fd5b506001600160a01b03813581169160208101359091169060400135610a75565b6101db600480360360808110156102ed57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135610a8c565b6103306004803603602081101561032957600080fd5b5035610c4f565b6040805160ff9092168252519081900360200190f35b6101db6004803603602081101561035c57600080fd5b5035610cb0565b6101db6004803603604081101561037957600080fd5b506001600160a01b0381358116916020013516610d3f565b6101db600480360360208110156103a757600080fd5b5035610d4e565b6103b6610d85565b604080516001600160a01b039092168252519081900360200190f35b6101db600480360360208110156103e857600080fd5b81019060208101813564010000000081111561040357600080fd5b82018360208201111561041557600080fd5b8035906020019184602083028401116401000000008311171561043757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d9d945050505050565b6101db6004803603602081101561048b57600080fd5b5035610e3e565b6103b66111e2565b610194600480360360608110156104b057600080fd5b506001600160a01b038135811691602081013590911690604001356111fa565b6101db600480360360608110156104e657600080fd5b506001600160a01b03813581169160208101359091169060400135611264565b6101db6004803603606081101561051c57600080fd5b506001600160a01b03813581169160208101359091169060400135611273565b6101db6004803603602081101561055257600080fd5b5035611283565b6101db6004803603608081101561056f57600080fd5b5080359060208101359060408101359060600135611362565b6101db6004803603604081101561059e57600080fd5b506001600160a01b03813581169160200135166114b8565b60008060006105c9888860046018610a8c565b90506105d786828787610a2b565b92509250509550959350505050565b60006105f783836002610150610a8c565b90505b92915050565b6000806001607f1b6223549b8402046298968001905060006001607f1b846002868161062857fe5b04028161063157fe5b049050600061063f82610e3e565b623cdfaf607f1b8161064d57fe5b049050600083848586876578fcdaec22008161066557fe5b05630115e6cf190162989680028161067957fe5b0563010fd4fc0162989680028161068c57fe5b0562366845190162989680028161069f57fe5b056230bbd70183026298968002816106b357fe5b05905085156106c557655af3107a4000035b95945050505050565b60008082126106dd57816105fa565b5060000390565b600080600160801b83106107155760006107046001607f1b855b04610c4f565b60ff1693841c936001607f1b029150505b6001607f1b83111561076357607f5b60ff811615610761576001607f1b848002049350600160801b841061075857600193841c9360ff6000198301161b91909101905b60001901610724565b505b6402540be40064019d25ddbe82025b049392505050565b60006001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561085657604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152670de0b6b3a764000060248201526001600160a01b038416604482015290517373353801921417f465377c8d898c6f4c0270282c9163a75d39c2916064808301926020929190829003018186803b15801561082357600080fd5b505afa158015610837573d6000803e3d6000fd5b505050506040513d602081101561084d57600080fd5b505190506105fa565b60007373353801921417f465377c8d898c6f4c0270282c6001600160a01b031663a75d39c285866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b557600080fd5b505afa1580156108c9573d6000803e3d6000fd5b505050506040513d60208110156108df57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039093166004840152600a9190910a602483015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26044830152516064808301926020929190829003018186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b5051604080516353ae9ce160e11b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26004820152602481018390526001600160a01b038616604482015290519192507373353801921417f465377c8d898c6f4c0270282c9163a75d39c291606480820192602092909190829003018186803b1580156109f657600080fd5b505afa158015610a0a573d6000803e3d6000fd5b505050506040513d6020811015610a2057600080fd5b505191506105fa9050565b60008060008084861115610a5257610a4588888888611362565b9150508484038101610a68565b610a5e88888789611362565b9050808686030191505b9097909650945050505050565b6000610a848484846002610a8c565b949350505050565b60006106c57373353801921417f465377c8d898c6f4c0270282c6001600160a01b0316630a79339887886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610aee57600080fd5b505afa158015610b02573d6000803e3d6000fd5b505050506040513d6020811015610b1857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152600a9290920a602483015291891660448201526064810188905260848101879052905160a4808301926000929190829003018186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610bbe57600080fd5b8101908080516040519392919084640100000000821115610bde57600080fd5b908301906020820185811115610bf357600080fd5b8251866020820283011164010000000082111715610c1057600080fd5b82525081516020918201928201910280838360005b83811015610c3d578181015183820152602001610c25565b50505050905001604052505050610d9d565b600080610100831015610c77575b6001831115610c7257600192831c9201610c5d565b6105fa565b60805b60ff811615610ca957600160ff82161b8410610c9e5760ff81169390931c92908117905b60011c607f16610c7a565b5092915050565b600080600160801b8310610cdf576000610cce6001607f1b856106fe565b60ff1693841c936001607f1b029150505b6001607f1b831115610d2d57607f5b60ff811615610d2b576001607f1b848002049350600160801b8410610d2257600193841c9360ff6000198301161b91909101905b60001901610cee565b505b6402540be40063b36d88358202610772565b60006105f78383600280610a8c565b80600260018201045b81811015610d7f57809150600281828581610d6e57fe5b040181610d7757fe5b049050610d57565b50919050565b7373353801921417f465377c8d898c6f4c0270282c81565b600060015b60018351038160ff1611610e00576002610dda6001607f1b856001850360ff1681518110610dcc57fe5b602002602001015102610cb0565b610df16001607f1b868560ff1681518110610dcc57fe5b030a9190910190600101610da2565b50610e22610e1a60018451038381610e1457fe5b04610d4e565b60fc02610d4e565b67b504f333f9de6484670de0b6b3a76400009091020492915050565b6000670168244fdac780006001607f1b6f0fffffffffffffffffffffffffffffff84168080028290048082028390048083028490049485026710e1b3be415a00009092026705a0913f6b1e000091909102010192909181830204905080664807432bc1800002830192506001607f1b82820281610eb757fe5b04905080660c0135dca0400002830192506001607f1b82820281610ed757fe5b049050806601b707b1cdc00002830192506001607f1b82820281610ef757fe5b049050806536e0f639b80002830192506001607f1b82820281610f1657fe5b04905080650618fee9f80002830192506001607f1b82820281610f3557fe5b04905080649c197dcc0002830192506001607f1b82820281610f5357fe5b04905080640e30dce40002830192506001607f1b82820281610f7157fe5b0490508064012ebd130002830192506001607f1b82820281610f8f57fe5b049050806317499f0002830192506001607f1b82820281610fac57fe5b049050806301a9d48002830192506001607f1b82820281610fc957fe5b04905080621c638002830192506001607f1b82820281610fe557fe5b049050806201c63802830192506001607f1b8282028161100157fe5b04905080611ab802830192506001607f1b8282028161101c57fe5b0490508061017c02830192506001607f1b8282028161103757fe5b04905080601402830192506001607f1b8282028161105157fe5b6721c3677c82b400009190049384010482016001607f1b019290506001607c1b8516156110a25770018ebef9eac820ae8682b9793ac6d1e7767001c3d6a24ed82218787d624d3e5eba95f984020492505b6001607d1b8516156110d8577001368b2fc6f9609fe7aceb46aa619baed470018ebef9eac820ae8682b9793ac6d1e77884020492505b6001607e1b85161561110d576fbc5ab1b16779be3575bd8f0520a9f21f7001368b2fc6f9609fe7aceb46aa619baed584020492505b6001607f1b851615611141576f454aaa8efe072e7f6ddbab84b40a55c96fbc5ab1b16779be3575bd8f0520a9f21e84020492505b600160801b851615611175576f0960aadc109e7a3bf4578099615711ea6f454aaa8efe072e7f6ddbab84b40a55c584020492505b600160811b8516156111a8576e2bf84208204f5977f9a8cf01fdce3d6f0960aadc109e7a3bf4578099615711d784020492505b600160821b8516156111d9576d03c6ab775dd0b95b4cbee7e65d116e2bf84208204f5977f9a8cf01fdc30784020492505b50909392505050565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000806000611209868661077a565b9050611257866001600160a01b03811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461124d5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261124f565b865b8684856105b6565b9250925050935093915050565b6000610a848484846030610a8c565b6000610a84848484610150610a8c565b6000806001607f1b611294846106ce565b6223549b02816112a057fe5b046298968001905060006001607f1b84600286816112ba57fe5b0502816112c357fe5b04905060006112d182610e3e565b623cdfaf607f1b816112df57fe5b049050600083848586876578fcdaec2200816112f757fe5b05630115e6cf190162989680028161130b57fe5b0563010fd4fc0162989680028161131e57fe5b0562366845190162989680028161133157fe5b056230bbd701830262989680028161134557fe5b05905060008613156106c557655af3107a40000395945050505050565b6000818314156113b157633b9aca0061138761016d670de0b6b3a76400008802610e14565b670de0b6b3a76400006402540be40063edba8b1387020487020402816113a957fe5b049050610a84565b600280850a046ec097ce7bc90715b34b9f1000000000600061016d670de0b6b3a7640000840283900489020490506000633b9aca006113fc61016d670de0b6b3a76400008c02610e14565b89028161140557fe5b04905060006001607f1b611427888a6001607f1b028161142157fe5b046106e4565b670de0b6b3a7640000028161143857fe5b04905081838201670de0b6b3a7640000028161145057fe5b0490508181036000611471670de0b6b3a76400006001607f1b850204610600565b9050600061148e670de0b6b3a76400006001607f1b850205611283565b9050655af3107a40008a820204655af3107a40008c840204039d9c50505050505050505050505050565b60006105f7838360026030610a8c56fea2646970667358221220899b38e76fccd98d03834d5b4f8cae6c85d51a0d86903f5f6d13cba85a8bd81e64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,533 |
0xc42123690348918f87f99f3236d5e0b3f4bac310 | pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/ISGRAuthorizationManager.sol
/**
* @title SGR Authorization Manager Interface.
*/
interface ISGRAuthorizationManager {
/**
* @dev Determine whether or not a user is authorized to buy SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToBuy(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to sell SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToSell(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR to another user.
* @param _sender The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransfer(address _sender, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR from one user to another user.
* @param _sender The address of the custodian user.
* @param _source The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized for public operation.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
}
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _ISogurExchanger_ = "ISogurExchanger" ;
bytes32 internal constant _SgnToSgrExchangeInitiator_ = "SgnToSgrExchangeInitiator" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGRAuthorizationManager_ = "ISGRAuthorizationManager";
bytes32 internal constant _ISGRToken_ = "ISGRToken" ;
bytes32 internal constant _ISGRTokenManager_ = "ISGRTokenManager" ;
bytes32 internal constant _ISGRTokenInfo_ = "ISGRTokenInfo" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGRTokenManager_ = "BuyWalletsTLSGRTokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGRTokenManager_ = "SellWalletsTLSGRTokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
bytes32 internal constant _SGAToSGRInitializer_ = "SGAToSGRInitializer" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: contracts/authorization/AuthorizationActionRoles.sol
/**
* @title Authorization Action Roles.
*/
library AuthorizationActionRoles {
string public constant VERSION = "1.1.0";
enum Flag {
BuySgr ,
SellSgr ,
SellSgn ,
ReceiveSgn ,
TransferSgn ,
TransferFromSgn
}
function isAuthorizedToBuySgr (uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.BuySgr );}
function isAuthorizedToSellSgr (uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.SellSgr );}
function isAuthorizedToSellSgn (uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.SellSgn );}
function isAuthorizedToReceiveSgn (uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.ReceiveSgn );}
function isAuthorizedToTransferSgn (uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.TransferSgn );}
function isAuthorizedToTransferFromSgn(uint256 _flags) internal pure returns (bool) {return isAuthorized(_flags, Flag.TransferFromSgn);}
function isAuthorized(uint256 _flags, Flag _flag) private pure returns (bool) {return ((_flags >> uint256(_flag)) & 1) == 1;}
}
// File: contracts/authorization/interfaces/IAuthorizationDataSource.sol
/**
* @title Authorization Data Source Interface.
*/
interface IAuthorizationDataSource {
/**
* @dev Get the authorized action-role of a wallet.
* @param _wallet The address of the wallet.
* @return The authorized action-role of the wallet.
*/
function getAuthorizedActionRole(address _wallet) external view returns (bool, uint256);
/**
* @dev Get the authorized action-role and trade-class of a wallet.
* @param _wallet The address of the wallet.
* @return The authorized action-role and class of the wallet.
*/
function getAuthorizedActionRoleAndClass(address _wallet) external view returns (bool, uint256, uint256);
/**
* @dev Get all the trade-limits and trade-class of a wallet.
* @param _wallet The address of the wallet.
* @return The trade-limits and trade-class of the wallet.
*/
function getTradeLimitsAndClass(address _wallet) external view returns (uint256, uint256, uint256);
/**
* @dev Get the buy trade-limit and trade-class of a wallet.
* @param _wallet The address of the wallet.
* @return The buy trade-limit and trade-class of the wallet.
*/
function getBuyTradeLimitAndClass(address _wallet) external view returns (uint256, uint256);
/**
* @dev Get the sell trade-limit and trade-class of a wallet.
* @param _wallet The address of the wallet.
* @return The sell trade-limit and trade-class of the wallet.
*/
function getSellTradeLimitAndClass(address _wallet) external view returns (uint256, uint256);
}
// File: contracts/wallet_trading_limiter/interfaces/ITradingClasses.sol
/**
* @title Trading Classes Interface.
*/
interface ITradingClasses {
/**
* @dev Get the complete info of a class.
* @param _id The id of the class.
* @return complete info of a class.
*/
function getInfo(uint256 _id) external view returns (uint256, uint256, uint256);
/**
* @dev Get the action-role of a class.
* @param _id The id of the class.
* @return The action-role of the class.
*/
function getActionRole(uint256 _id) external view returns (uint256);
/**
* @dev Get the sell limit of a class.
* @param _id The id of the class.
* @return The sell limit of the class.
*/
function getSellLimit(uint256 _id) external view returns (uint256);
/**
* @dev Get the buy limit of a class.
* @param _id The id of the class.
* @return The buy limit of the class.
*/
function getBuyLimit(uint256 _id) external view returns (uint256);
}
// File: contracts/sogur/SGRAuthorizationManager.sol
/**
* Details of usage of licenced software see here: https://www.sogur.com/software/readme_v1
*/
/**
* @title SGR Authorization Manager.
*/
contract SGRAuthorizationManager is ISGRAuthorizationManager, ContractAddressLocatorHolder {
string public constant VERSION = "2.0.0";
using AuthorizationActionRoles for uint256;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) ContractAddressLocatorHolder(_contractAddressLocator) public {}
/**
* @dev Return the contract which implements the IAuthorizationDataSource interface.
*/
function getAuthorizationDataSource() public view returns (IAuthorizationDataSource) {
return IAuthorizationDataSource(getContractAddress(_IAuthorizationDataSource_));
}
/**
* @dev Return the contract which implements the ITradingClasses interface.
*/
function getTradingClasses() public view returns (ITradingClasses) {
return ITradingClasses(getContractAddress(_ITradingClasses_));
}
/**
* @dev Determine whether or not a user is authorized to buy SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToBuy(address _sender) external view returns (bool) {
(bool senderIsWhitelisted, uint256 senderActionRole, uint256 tradeClassId) = getAuthorizationDataSource().getAuthorizedActionRoleAndClass(_sender);
return senderIsWhitelisted && getActionRole(senderActionRole, tradeClassId).isAuthorizedToBuySgr();
}
/**
* @dev Determine whether or not a user is authorized to sell SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToSell(address _sender) external view returns (bool) {
(bool senderIsWhitelisted, uint256 senderActionRole, uint256 tradeClassId) = getAuthorizationDataSource().getAuthorizedActionRoleAndClass(_sender);
return senderIsWhitelisted && getActionRole(senderActionRole, tradeClassId).isAuthorizedToSellSgr();
}
/**
* @dev User is always authorized to transfer SGR to another user.
* @param _sender The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransfer(address _sender, address _target) external view returns (bool) {
_sender;
_target;
return true;
}
/**
* @dev User is always authorized to transfer SGR from one user to another user.
* @param _sender The address of the custodian user.
* @param _source The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool) {
_sender;
_source;
_target;
return true;
}
/**
* @dev Determine whether or not a user is authorized for public operation.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedForPublicOperation(address _sender) external view returns (bool) {
IAuthorizationDataSource authorizationDataSource = getAuthorizationDataSource();
(bool senderIsWhitelisted,) = authorizationDataSource.getAuthorizedActionRole(_sender);
return senderIsWhitelisted;
}
/**
* @dev Get the relevant action-role.
* @return The relevant action-role.
*/
function getActionRole(uint256 _actionRole, uint256 _tradeClassId) private view returns (uint256) {
return _actionRole > 0 ? _actionRole : getTradingClasses().getActionRole(_tradeClassId);
}
} | 0x6080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630d70e29c811461009d5780635dd588df146100e557806374f1649a1461011f5780637916910e1461015d5780639353922c1461018b578063a3f7edb8146101a0578063b7d130ff146101ce578063e9d41d48146101fc578063ffa1ad7414610211575b600080fd5b3480156100a957600080fd5b506100d173ffffffffffffffffffffffffffffffffffffffff6004358116906024351661029b565b604080519115158252519081900360200190f35b3480156100f157600080fd5b506100d173ffffffffffffffffffffffffffffffffffffffff600435811690602435811690604435166102a3565b34801561012b57600080fd5b506101346102ac565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561016957600080fd5b506100d173ffffffffffffffffffffffffffffffffffffffff600435166102c8565b34801561019757600080fd5b5061013461037a565b3480156101ac57600080fd5b506100d173ffffffffffffffffffffffffffffffffffffffff600435166103aa565b3480156101da57600080fd5b506100d173ffffffffffffffffffffffffffffffffffffffff600435166104b5565b34801561020857600080fd5b506101346105b7565b34801561021d57600080fd5b506102266105e2565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610260578181015183820152602001610248565b50505050905090810190601f16801561028d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600192915050565b60019392505050565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60008060006102d56105b7565b604080517f15b7c03e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff878116600483015282519395508516926315b7c03e926024808401939192918290030181600087803b15801561034657600080fd5b505af115801561035a573d6000803e3d6000fd5b505050506040513d604081101561037057600080fd5b5051949350505050565b60006103a57f4954726164696e67436c61737365730000000000000000000000000000000000610619565b905090565b6000806000806103b86105b7565b73ffffffffffffffffffffffffffffffffffffffff1663fb67ed12866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050606060405180830381600087803b15801561045257600080fd5b505af1158015610466573d6000803e3d6000fd5b505050506040513d606081101561047c57600080fd5b508051602082015160409092015190945090925090508280156104ac57506104ac6104a783836106bf565b610778565b95945050505050565b6000806000806104c36105b7565b73ffffffffffffffffffffffffffffffffffffffff1663fb67ed12866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050606060405180830381600087803b15801561055d57600080fd5b505af1158015610571573d6000803e3d6000fd5b505050506040513d606081101561058757600080fd5b508051602082015160409092015190945090925090508280156104ac57506104ac6105b283836106bf565b61078b565b60006103a57f49417574686f72697a6174696f6e44617461536f757263650000000000000000610619565b60408051808201909152600581527f322e302e30000000000000000000000000000000000000000000000000000000602082015281565b60008054604080517f0d2020dd00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630d2020dd9160248082019260209290919082900301818787803b15801561068d57600080fd5b505af11580156106a1573d6000803e3d6000fd5b505050506040513d60208110156106b757600080fd5b505192915050565b600080831161076f576106d061037a565b73ffffffffffffffffffffffffffffffffffffffff1663adb9c0f7836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561073e57600080fd5b505af1158015610752573d6000803e3d6000fd5b505050506040513d602081101561076857600080fd5b5051610771565b825b9392505050565b6000610785826000610794565b92915050565b60006107858260015b60008160058111156107a257fe5b839060020a90046001166001149050929150505600a165627a7a723058206c32ce5fa5252bac562d6241a96c0065047eccdd75f171d42fe549e23688fef90029 | {"success": true, "error": null, "results": {}} | 1,534 |
0xbcd74757b7ab90d5357c376cab3d76ee6efcd391 | // SPDX-License-Identifier: Unlicensed
// SHIBBER TOKEN
// https://twitter.com/ShibberToken
//
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 ShibberToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SHIBBER";
string private constant _symbol = "SBR";
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 = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 25;
//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(0xb3fc95cf58A3e33271eC5e455cDF566cE5031386);
address payable private _marketingAddress = payable(0xb3fc95cf58A3e33271eC5e455cDF566cE5031386);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount * 10**_decimals;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize * 10**_decimals;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d81565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e52565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612eaa565b61087b565b6040516102649190612f05565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f7f565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612fa9565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fc4565b6108cf565b6040516102f79190612f05565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612fa9565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d9190613033565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b604051610378919061305d565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613078565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130d1565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613078565b610c50565b60405161041e9190612fa9565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130fe565b610df4565b005b34801561047357600080fd5b5061047c610eab565b6040516104899190612fa9565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613078565b610eb1565b6040516104c69190612fa9565b60405180910390f35b3480156104db57600080fd5b506104e4610ec9565b6040516104f1919061305d565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130d1565b610ef2565b005b34801561052f57600080fd5b50610538610fa4565b6040516105459190612fa9565b60405180910390f35b34801561055a57600080fd5b50610563610faa565b6040516105709190612e52565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130fe565b610fe7565b005b3480156105ae57600080fd5b506105c960048036038101906105c4919061312b565b611086565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612eaa565b61113d565b6040516105ff9190612f05565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613078565b61115b565b60405161063c9190612f05565b60405180910390f35b34801561065157600080fd5b5061065a61117b565b005b34801561066857600080fd5b50610683600480360381019061067e91906131ed565b611254565b005b34801561069157600080fd5b506106ac60048036038101906106a7919061324d565b61138e565b6040516106b99190612fa9565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130fe565b611415565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613078565b6114cc565b005b61071c61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132d9565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132f9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613357565b9150506107ac565b5050565b60606040518060400160405280600781526020017f5348494242455200000000000000000000000000000000000000000000000000815250905090565b600061088f61088861168d565b8484611695565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc84848461185e565b61099d846108e861168d565b61099885604051806060016040528060288152602001613f1560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61168d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e19092919063ffffffff16565b611695565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132d9565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132d9565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061168d565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61168d565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d81612145565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b1565b9050919050565b610ca961168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132d9565b60405180910390fd5b6009600a610e9791906134d2565b81610ea2919061351d565b60168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efa61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7e906132d9565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600381526020017f5342520000000000000000000000000000000000000000000000000000000000815250905090565b610fef61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461107c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611073906132d9565b60405180910390fd5b8060188190555050565b61108e61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461111b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611112906132d9565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061115161114a61168d565b848461185e565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111bc61168d565b73ffffffffffffffffffffffffffffffffffffffff1614806112325750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661121a61168d565b73ffffffffffffffffffffffffffffffffffffffff16145b61123b57600080fd5b600061124630610c50565b90506112518161221f565b50565b61125c61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e0906132d9565b60405180910390fd5b60005b8383905081101561138857816005600086868581811061130f5761130e6132f9565b5b90506020020160208101906113249190613078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061138090613357565b9150506112ec565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61141d61168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a1906132d9565b60405180910390fd5b6009600a6114b891906134d2565b816114c3919061351d565b60178190555050565b6114d461168d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611561576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611558906132d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036115d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c7906135e9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb9061367b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611773576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176a9061370d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118519190612fa9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036118cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c49061379f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361193c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193390613831565b60405180910390fd5b6000811161197f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611976906138c3565b60405180910390fd5b611987610ec9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119f557506119c5610ec9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611de057601560149054906101000a900460ff16611a8457611a16610ec9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7a90613955565b60405180910390fd5b5b601654811115611ac9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac0906139c1565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b6d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba390613a53565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c595760175481611c0e84610c50565b611c189190613a73565b10611c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4f90613b3b565b60405180910390fd5b5b6000611c6430610c50565b9050600060185482101590506016548210611c7f5760165491505b808015611c97575060158054906101000a900460ff16155b8015611cf15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611d095750601560169054906101000a900460ff165b8015611d5f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611db55750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ddd57611dc38261221f565b60004790506000811115611ddb57611dda47612145565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f3a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f395750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f4857600090506120cf565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611ff35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561200b57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120b65750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120ce57600a54600c81905550600b54600d819055505b5b6120db84848484612496565b50505050565b6000838311158290612129576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121209190612e52565b60405180910390fd5b50600083856121389190613b5b565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156121ad573d6000803e3d6000fd5b5050565b60006006548211156121f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ef90613c01565b60405180910390fd5b60006122026124c3565b905061221781846124ee90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561225657612255612be0565b5b6040519080825280602002602001820160405280156122845781602001602082028036833780820191505090505b509050308160008151811061229c5761229b6132f9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612343573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123679190613c36565b8160018151811061237b5761237a6132f9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123e230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611695565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612446959493929190613d5c565b600060405180830381600087803b15801561246057600080fd5b505af1158015612474573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124a4576124a3612538565b5b6124af848484612575565b806124bd576124bc612740565b5b50505050565b60008060006124d0612754565b915091506124e781836124ee90919063ffffffff16565b9250505090565b600061253083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506127b3565b905092915050565b6000600c5414801561254c57506000600d54145b61257357600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061258787612816565b9550955095509550955095506125e586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461287e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061267a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128c890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126c681612926565b6126d084836129e3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161272d9190612fa9565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612788670de0b6b3a76400006006546124ee90919063ffffffff16565b8210156127a657600654670de0b6b3a76400009350935050506127af565b81819350935050505b9091565b600080831182906127fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f19190612e52565b60405180910390fd5b50600083856128099190613de5565b9050809150509392505050565b60008060008060008060008060006128338a600c54600d54612a1d565b92509250925060006128436124c3565b905060008060006128568e878787612ab3565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128c083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120e1565b905092915050565b60008082846128d79190613a73565b90508381101561291c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161291390613e62565b60405180910390fd5b8091505092915050565b60006129306124c3565b905060006129478284612b3c90919063ffffffff16565b905061299b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128c890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129f88260065461287e90919063ffffffff16565b600681905550612a13816007546128c890919063ffffffff16565b6007819055505050565b600080600080612a496064612a3b888a612b3c90919063ffffffff16565b6124ee90919063ffffffff16565b90506000612a736064612a65888b612b3c90919063ffffffff16565b6124ee90919063ffffffff16565b90506000612a9c82612a8e858c61287e90919063ffffffff16565b61287e90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612acc8589612b3c90919063ffffffff16565b90506000612ae38689612b3c90919063ffffffff16565b90506000612afa8789612b3c90919063ffffffff16565b90506000612b2382612b15858761287e90919063ffffffff16565b61287e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808303612b4e5760009050612bb0565b60008284612b5c919061351d565b9050828482612b6b9190613de5565b14612bab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba290613ef4565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c1882612bcf565b810181811067ffffffffffffffff82111715612c3757612c36612be0565b5b80604052505050565b6000612c4a612bb6565b9050612c568282612c0f565b919050565b600067ffffffffffffffff821115612c7657612c75612be0565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612cb782612c8c565b9050919050565b612cc781612cac565b8114612cd257600080fd5b50565b600081359050612ce481612cbe565b92915050565b6000612cfd612cf884612c5b565b612c40565b90508083825260208201905060208402830185811115612d2057612d1f612c87565b5b835b81811015612d495780612d358882612cd5565b845260208401935050602081019050612d22565b5050509392505050565b600082601f830112612d6857612d67612bca565b5b8135612d78848260208601612cea565b91505092915050565b600060208284031215612d9757612d96612bc0565b5b600082013567ffffffffffffffff811115612db557612db4612bc5565b5b612dc184828501612d53565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612e04578082015181840152602081019050612de9565b83811115612e13576000848401525b50505050565b6000612e2482612dca565b612e2e8185612dd5565b9350612e3e818560208601612de6565b612e4781612bcf565b840191505092915050565b60006020820190508181036000830152612e6c8184612e19565b905092915050565b6000819050919050565b612e8781612e74565b8114612e9257600080fd5b50565b600081359050612ea481612e7e565b92915050565b60008060408385031215612ec157612ec0612bc0565b5b6000612ecf85828601612cd5565b9250506020612ee085828601612e95565b9150509250929050565b60008115159050919050565b612eff81612eea565b82525050565b6000602082019050612f1a6000830184612ef6565b92915050565b6000819050919050565b6000612f45612f40612f3b84612c8c565b612f20565b612c8c565b9050919050565b6000612f5782612f2a565b9050919050565b6000612f6982612f4c565b9050919050565b612f7981612f5e565b82525050565b6000602082019050612f946000830184612f70565b92915050565b612fa381612e74565b82525050565b6000602082019050612fbe6000830184612f9a565b92915050565b600080600060608486031215612fdd57612fdc612bc0565b5b6000612feb86828701612cd5565b9350506020612ffc86828701612cd5565b925050604061300d86828701612e95565b9150509250925092565b600060ff82169050919050565b61302d81613017565b82525050565b60006020820190506130486000830184613024565b92915050565b61305781612cac565b82525050565b6000602082019050613072600083018461304e565b92915050565b60006020828403121561308e5761308d612bc0565b5b600061309c84828501612cd5565b91505092915050565b6130ae81612eea565b81146130b957600080fd5b50565b6000813590506130cb816130a5565b92915050565b6000602082840312156130e7576130e6612bc0565b5b60006130f5848285016130bc565b91505092915050565b60006020828403121561311457613113612bc0565b5b600061312284828501612e95565b91505092915050565b6000806000806080858703121561314557613144612bc0565b5b600061315387828801612e95565b945050602061316487828801612e95565b935050604061317587828801612e95565b925050606061318687828801612e95565b91505092959194509250565b600080fd5b60008083601f8401126131ad576131ac612bca565b5b8235905067ffffffffffffffff8111156131ca576131c9613192565b5b6020830191508360208202830111156131e6576131e5612c87565b5b9250929050565b60008060006040848603121561320657613205612bc0565b5b600084013567ffffffffffffffff81111561322457613223612bc5565b5b61323086828701613197565b93509350506020613243868287016130bc565b9150509250925092565b6000806040838503121561326457613263612bc0565b5b600061327285828601612cd5565b925050602061328385828601612cd5565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132c3602083612dd5565b91506132ce8261328d565b602082019050919050565b600060208201905081810360008301526132f2816132b6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061336282612e74565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361339457613393613328565b5b600182019050919050565b60008160011c9050919050565b6000808291508390505b60018511156133f6578086048111156133d2576133d1613328565b5b60018516156133e15780820291505b80810290506133ef8561339f565b94506133b6565b94509492505050565b60008261340f57600190506134cb565b8161341d57600090506134cb565b8160018114613433576002811461343d5761346c565b60019150506134cb565b60ff84111561344f5761344e613328565b5b8360020a91508482111561346657613465613328565b5b506134cb565b5060208310610133831016604e8410600b84101617156134a15782820a90508381111561349c5761349b613328565b5b6134cb565b6134ae84848460016133ac565b925090508184048111156134c5576134c4613328565b5b81810290505b9392505050565b60006134dd82612e74565b91506134e883613017565b92506135157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846133ff565b905092915050565b600061352882612e74565b915061353383612e74565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561356c5761356b613328565b5b828202905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006135d3602683612dd5565b91506135de82613577565b604082019050919050565b60006020820190508181036000830152613602816135c6565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613665602483612dd5565b915061367082613609565b604082019050919050565b6000602082019050818103600083015261369481613658565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006136f7602283612dd5565b91506137028261369b565b604082019050919050565b60006020820190508181036000830152613726816136ea565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613789602583612dd5565b91506137948261372d565b604082019050919050565b600060208201905081810360008301526137b88161377c565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061381b602383612dd5565b9150613826826137bf565b604082019050919050565b6000602082019050818103600083015261384a8161380e565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006138ad602983612dd5565b91506138b882613851565b604082019050919050565b600060208201905081810360008301526138dc816138a0565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b600061393f603f83612dd5565b915061394a826138e3565b604082019050919050565b6000602082019050818103600083015261396e81613932565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006139ab601c83612dd5565b91506139b682613975565b602082019050919050565b600060208201905081810360008301526139da8161399e565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613a3d602383612dd5565b9150613a48826139e1565b604082019050919050565b60006020820190508181036000830152613a6c81613a30565b9050919050565b6000613a7e82612e74565b9150613a8983612e74565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613abe57613abd613328565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b25602383612dd5565b9150613b3082613ac9565b604082019050919050565b60006020820190508181036000830152613b5481613b18565b9050919050565b6000613b6682612e74565b9150613b7183612e74565b925082821015613b8457613b83613328565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613beb602a83612dd5565b9150613bf682613b8f565b604082019050919050565b60006020820190508181036000830152613c1a81613bde565b9050919050565b600081519050613c3081612cbe565b92915050565b600060208284031215613c4c57613c4b612bc0565b5b6000613c5a84828501613c21565b91505092915050565b6000819050919050565b6000613c88613c83613c7e84613c63565b612f20565b612e74565b9050919050565b613c9881613c6d565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613cd381612cac565b82525050565b6000613ce58383613cca565b60208301905092915050565b6000602082019050919050565b6000613d0982613c9e565b613d138185613ca9565b9350613d1e83613cba565b8060005b83811015613d4f578151613d368882613cd9565b9750613d4183613cf1565b925050600181019050613d22565b5085935050505092915050565b600060a082019050613d716000830188612f9a565b613d7e6020830187613c8f565b8181036040830152613d908186613cfe565b9050613d9f606083018561304e565b613dac6080830184612f9a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613df082612e74565b9150613dfb83612e74565b925082613e0b57613e0a613db6565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613e4c601b83612dd5565b9150613e5782613e16565b602082019050919050565b60006020820190508181036000830152613e7b81613e3f565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613ede602183612dd5565b9150613ee982613e82565b604082019050919050565b60006020820190508181036000830152613f0d81613ed1565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e1b1c1a15e838f0d37288a4ed609d9e73fe6f7bdbbcb783e8d476d657868c4a864736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,535 |
0x04220cb64879a6196b5d57e7f54663b7e0136b41 | /*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string[]public offers; // offers made for token redemption - updateable by manager
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event AddOffer(uint256 index, string terms);
event AmendOffer(uint256 index, string terms);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function purchase() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn token with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function addOffer(string calldata offer) external onlyManager {
offers.push(offer);
emit AddOffer(offers.length-1, offer);
}
function amendOffer(uint256 index, string calldata offer) external onlyManager {
offers[index] = offer;
emit AmendOffer(index, offer);
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
} | 0x6080604052600436106102135760003560e01c806355b6ed5c116101185780637ecebe00116100a0578063a457c2d71161006f578063a457c2d714610ceb578063a9059cbb14610d24578063bb102aea14610d5d578063d505accf14610d72578063e3537d6814610dd05761030f565b80637ecebe0014610c645780638a72ea6a14610c9757806392ff0d3114610cc157806395d89b4114610cd65761030f565b806364edfbf0116100e757806364edfbf0146109cf57806370a08231146109d757806379cc679014610a0a5780637a0c21ee14610a435780637c88e3d914610b995761030f565b806355b6ed5c14610913578063565974d31461094e57806361d3458f1461096357806364629ff71461098f5761030f565b80633644e5151161019b57806340c10f191161016a57806340c10f19146107ef57806342966c6814610828578063466ccac014610852578063481c6a75146108675780634f0371e9146108985761030f565b80633644e515146106c157806339509351146106d65780633b3e672f1461070f57806340557cf1146107da5761030f565b806321af8235116101e257806321af82351461053157806323b872dd146105bc57806324b76fd5146105ff57806330adf81f14610681578063313ce567146106965761030f565b806306fdde0314610314578063095ea7b31461039e57806318160ddd146103eb5780631d809a79146104125761030f565b3661030f5760095460ff1661025a576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d80600081146102a7576040519150601f19603f3d011682016040523d82523d6000602084013e6102ac565b606091505b50509050806102ed576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b61030c303361030760015434610e5290919063ffffffff16565b610e82565b50005b600080fd5b34801561032057600080fd5b50610329610f30565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561036357818101518382015260200161034b565b50505050905090810190601f1680156103905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103aa57600080fd5b506103d7600480360360408110156103c157600080fd5b506001600160a01b038135169060200135610fbe565b604080519115158252519081900360200190f35b3480156103f757600080fd5b50610400610fd4565b60408051918252519081900360200190f35b34801561041e57600080fd5b5061052f6004803603608081101561043557600080fd5b810190602081018135600160201b81111561044f57600080fd5b82018360208201111561046157600080fd5b803590602001918460208302840111600160201b8311171561048257600080fd5b919390929091602081019035600160201b81111561049f57600080fd5b8201836020820111156104b157600080fd5b803590602001918460208302840111600160201b831117156104d257600080fd5b919390929091602081019035600160201b8111156104ef57600080fd5b82018360208201111561050157600080fd5b803590602001918460208302840111600160201b8311171561052257600080fd5b9193509150351515610fda565b005b34801561053d57600080fd5b5061052f6004803603604081101561055457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561057e57600080fd5b82018360208201111561059057600080fd5b803590602001918460018302840111600160201b831117156105b157600080fd5b50909250905061120e565b3480156105c857600080fd5b506103d7600480360360608110156105df57600080fd5b506001600160a01b038135811691602081013590911690604001356112ef565b34801561060b57600080fd5b5061052f6004803603604081101561062257600080fd5b81359190810190604081016020820135600160201b81111561064357600080fd5b82018360208201111561065557600080fd5b803590602001918460018302840111600160201b8311171561067657600080fd5b50909250905061138e565b34801561068d57600080fd5b506104006113fd565b3480156106a257600080fd5b506106ab611421565b6040805160ff9092168252519081900360200190f35b3480156106cd57600080fd5b50610400611431565b3480156106e257600080fd5b506103d7600480360360408110156106f957600080fd5b506001600160a01b038135169060200135611437565b34801561071b57600080fd5b5061052f6004803603604081101561073257600080fd5b810190602081018135600160201b81111561074c57600080fd5b82018360208201111561075e57600080fd5b803590602001918460208302840111600160201b8311171561077f57600080fd5b919390929091602081019035600160201b81111561079c57600080fd5b8201836020820111156107ae57600080fd5b803590602001918460208302840111600160201b831117156107cf57600080fd5b50909250905061146d565b3480156107e657600080fd5b5061040061154c565b3480156107fb57600080fd5b5061052f6004803603604081101561081257600080fd5b506001600160a01b038135169060200135611552565b34801561083457600080fd5b5061052f6004803603602081101561084b57600080fd5b50356115aa565b34801561085e57600080fd5b506103d76115b7565b34801561087357600080fd5b5061087c6115c0565b604080516001600160a01b039092168252519081900360200190f35b3480156108a457600080fd5b5061052f600480360360208110156108bb57600080fd5b810190602081018135600160201b8111156108d557600080fd5b8201836020820111156108e757600080fd5b803590602001918460018302840111600160201b8311171561090857600080fd5b5090925090506115cf565b34801561091f57600080fd5b506104006004803603604081101561093657600080fd5b506001600160a01b03813581169160200135166116cb565b34801561095a57600080fd5b506103296116e8565b34801561096f57600080fd5b5061052f6004803603602081101561098657600080fd5b50351515611743565b34801561099b57600080fd5b5061052f600480360360808110156109b257600080fd5b5080359060208101359060408101351515906060013515156117de565b61052f61190d565b3480156109e357600080fd5b50610400600480360360208110156109fa57600080fd5b50356001600160a01b03166119fc565b348015610a1657600080fd5b5061052f60048036036040811015610a2d57600080fd5b506001600160a01b038135169060200135611a0e565b348015610a4f57600080fd5b5061052f6004803603610160811015610a6757600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b811115610ab157600080fd5b820183602082011115610ac357600080fd5b803590602001918460018302840111600160201b83111715610ae457600080fd5b919390929091602081019035600160201b811115610b0157600080fd5b820183602082011115610b1357600080fd5b803590602001918460018302840111600160201b83111715610b3457600080fd5b919390929091602081019035600160201b811115610b5157600080fd5b820183602082011115610b6357600080fd5b803590602001918460018302840111600160201b83111715610b8457600080fd5b91935091508035151590602001351515611a4d565b348015610ba557600080fd5b5061052f60048036036040811015610bbc57600080fd5b810190602081018135600160201b811115610bd657600080fd5b820183602082011115610be857600080fd5b803590602001918460208302840111600160201b83111715610c0957600080fd5b919390929091602081019035600160201b811115610c2657600080fd5b820183602082011115610c3857600080fd5b803590602001918460208302840111600160201b83111715610c5957600080fd5b509092509050611cba565b348015610c7057600080fd5b5061040060048036036020811015610c8757600080fd5b50356001600160a01b0316611d8e565b348015610ca357600080fd5b5061032960048036036020811015610cba57600080fd5b5035611da0565b348015610ccd57600080fd5b506103d7611e16565b348015610ce257600080fd5b50610329611e25565b348015610cf757600080fd5b506103d760048036036040811015610d0e57600080fd5b506001600160a01b038135169060200135611e80565b348015610d3057600080fd5b506103d760048036036040811015610d4757600080fd5b506001600160a01b038135169060200135611eb6565b348015610d6957600080fd5b50610400611f11565b348015610d7e57600080fd5b5061052f600480360360e0811015610d9557600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611f17565b348015610ddc57600080fd5b5061052f60048036036040811015610df357600080fd5b81359190810190604081016020820135600160201b811115610e1457600080fd5b820183602082011115610e2657600080fd5b803590602001918460018302840111600160201b83111715610e4757600080fd5b5090925090506120fb565b600082610e6157506000610e7c565b82820282848281610e6e57fe5b0414610e7957600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610ea590826121d9565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610ed490826121ee565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b820191906000526020600020905b815481529060010190602001808311610f9957829003601f168201915b505050505081565b6000610fcb338484612200565b50600192915050565b60025481565b6000546001600160a01b03163314611024576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b858414801561103257508582145b611083576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b8681101561120457600084848381811061109c57fe5b9050602002013590508215611142578888838181106110b757fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561111357600080fd5b505afa158015611127573d6000803e3d6000fd5b505050506040513d602081101561113d57600080fd5b505190505b88888381811061114e57fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb88888581811061117857fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156111cf57600080fd5b505af11580156111e3573d6000803e3d6000fd5b505050506040513d60208110156111f957600080fd5b505050600101611086565b5050505050505050565b6000546001600160a01b03163314611258576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561127f600583836123d0565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b60095460009062010000900460ff1661133f576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a602090815260408083203380855292529091205461137991869161137490866121d9565b612200565b611384848484610e82565b5060019392505050565b6113983384612262565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610fcb91859061137490866121ee565b8281146114ad576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60095462010000900460ff166114fa576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b838110156115455761153d3386868481811061151557fe5b905060200201356001600160a01b031685858581811061153157fe5b90506020020135610e82565b6001016114fd565b5050505050565b60015481565b6000546001600160a01b0316331461159c576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6115a682826122f3565b5050565b6115b43382612262565b50565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b03163314611619576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60078054600181018255600091909152611656907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880183836123d0565b507fbc51c630f8cb647f3f7b7f755e8a9a267b836d659ef4fd39444767b2e99f8eb8600160078054905003838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a15050565b600a60209081526000928352604080842090915290825290205481565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b6000546001600160a01b0316331461178d576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6009805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b6000546001600160a01b03163314611828576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556009805460ff191682151517905582158015906118475750815b15611856576118563084612262565b600083118015611864575081155b156118735761187330846122f3565b80156118be57600084116118be576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b60095460ff1661194f576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d806000811461199c576040519150601f19603f3d011682016040523d82523d6000602084013e6119a1565b606091505b50509050806119e2576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6115b4303361030760015434610e5290919063ffffffff16565b600b6020526000908152604090205481565b6001600160a01b0382166000908152600a6020908152604080832033808552925290912054611a4391849161137490856121d9565b6115a68282612262565b600954610100900460ff1615611a98576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8d6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600060146101000a81548160ff021916908360ff1602179055508a60018190555088600381905550878760059190611af89291906123d0565b50611b05600687876123d0565b50611b12600885856123d0565b506009805461010060ff199091168415151761ff0019161762ff0000191662010000831515021790558b15611b4b57611b4b8e8d6122f3565b8915611b5b57611b5b308b6122f3565b8115611ba65760008b11611ba6576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60066040518082805460018160011615610100020316600290048015611c295780601f10611c07576101008083540402835291820191611c29565b820191906000526020600020905b815481529060010190602001808311611c15575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c0909401909452505080519101206004555050505050505050505050505050565b6000546001600160a01b03163314611d04576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611d44576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b8381101561154557611d86858583818110611d5e57fe5b905060200201356001600160a01b0316848484818110611d7a57fe5b905060200201356122f3565b600101611d47565b600c6020526000908152604090205481565b60078181548110611db057600080fd5b600091825260209182902001805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815293509091830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b60095462010000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610fcb91859061137490866121d9565b60095460009062010000900460ff16611f06576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610fcb338484610e82565b60035481565b83421115611f56576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015612073573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906120a95750896001600160a01b0316816001600160a01b0316145b6120e4576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b6120ef8a8a8a612200565b50505050505050505050565b6000546001600160a01b03163314612145576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b81816007858154811061215457fe5b90600052602060002001919061216b9291906123d0565b507f8353bf99044ef1e4388a189da7c56d24f2b33549e3dfffdba49ca25a4e3aa1a983838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a1505050565b6000828211156121e857600080fd5b50900390565b600082820183811015610e7957600080fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600b602052604090205461228590826121d9565b6001600160a01b0383166000908152600b60205260409020556002546122ab90826121d9565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60035460025461230390836121ee565b111561233f576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b602052604090205461236290826121ee565b6001600160a01b0383166000908152600b602052604090205560025461238890826121ee565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612406576000855561244c565b82601f1061241f5782800160ff1982351617855561244c565b8280016001018555821561244c579182015b8281111561244c578235825591602001919060010190612431565b5061245892915061245c565b5090565b5b80821115612458576000815560010161245d56fea2646970667358221220a721542c575ba01afd31b73756f4d59b630e82efe7daf8c5fa0573caac7a885d64736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,536 |
0x1284ff048b2cf5f86374103ee094a86cc7cba4b3 | 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 Dancer is StandardToken, Ownable {
// Constants
string public constant name = "Dancer";
string public constant symbol = "DANC";
uint8 public constant decimals = 6;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function Dancer() 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);
}
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf5780632ff2e9dc146101f7578063313ce5671461020a5780635f56b6fe14610233578063661884631461024b57806370a082311461026d578063715018a61461028c5780638da5cb5b1461029f57806395d89b41146102ce578063a9059cbb146102e1578063d73dd62314610303578063dd62ed3e14610325578063f2fde38b1461034a575b600080fd5b34156100f557600080fd5b6100fd610369565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a03600435166024356103a0565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd61040c565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a0360043581169060243516604435610412565b341561020257600080fd5b6101bd610592565b341561021557600080fd5b61021d61059d565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b6102496004356105a2565b005b341561025657600080fd5b610196600160a060020a0360043516602435610638565b341561027857600080fd5b6101bd600160a060020a0360043516610732565b341561029757600080fd5b61024961074d565b34156102aa57600080fd5b6102b26107bf565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b6100fd6107ce565b34156102ec57600080fd5b610196600160a060020a0360043516602435610805565b341561030e57600080fd5b610196600160a060020a0360043516602435610917565b341561033057600080fd5b6101bd600160a060020a03600435811690602435166109bb565b341561035557600080fd5b610249600160a060020a03600435166109e6565b60408051908101604052600681527f44616e6365720000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561042957600080fd5b600160a060020a03841660009081526020819052604090205482111561044e57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561048157600080fd5b600160a060020a0384166000908152602081905260409020546104aa908363ffffffff610a8116565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104df908363ffffffff610a9316565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610525908363ffffffff610a8116565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b66038d7ea4c6800081565b600681565b60035433600160a060020a039081169116146105bd57600080fd5b80151561060257600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156105fd57600080fd5b610635565b600354600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561063557600080fd5b50565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561069557600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106cc565b6106a5818463ffffffff610a8116565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461076857600080fd5b600354600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031681565b60408051908101604052600481527f44414e4300000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561081c57600080fd5b600160a060020a03331660009081526020819052604090205482111561084157600080fd5b600160a060020a03331660009081526020819052604090205461086a908363ffffffff610a8116565b600160a060020a03338116600090815260208190526040808220939093559085168152205461089f908363ffffffff610a9316565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461094f908363ffffffff610a9316565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610a0157600080fd5b600160a060020a0381161515610a1657600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a8d57fe5b50900390565b81810182811015610aa057fe5b929150505600a165627a7a723058207334e98cb8fd4edaa69371f8a60988c21bc2047d1a56b6c43088741977e77a530029 | {"success": true, "error": null, "results": {}} | 1,537 |
0xa89859f3e0bbbd3fb05cc89983a4c1f15b61c423 | /**
* ChocolateMilk - ETH
/ https://t.me/chocolatemilkETH
*/
// 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 ChocolateMilkToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ChocolateMilkToken";
string private constant _symbol = "CHOCC";
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 = 13;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 15;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xADa6B2a9D989201B881f3C5251a61df481b1D66C);
address payable private _marketingAddress = payable(0xADa6B2a9D989201B881f3C5251a61df481b1D66C);
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 = 300000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 60000 * 10**9; //.6%
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;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610525578063dd62ed3e14610545578063ea1644d51461058b578063f2fde38b146105ab57600080fd5b8063a2a957bb146104a0578063a9059cbb146104c0578063bfd79284146104e0578063c3c8cd801461051057600080fd5b80638f70ccf7116100d15780638f70ccf71461041c5780638f9a55c01461043c57806395d89b411461045257806398a5c3151461048057600080fd5b806374010ece146103c85780637d1db4a5146103e85780638da5cb5b146103fe57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035e5780636fc3eaec1461037e57806370a0823114610393578063715018a6146103b357600080fd5b8063313ce5671461030257806349bd5a5e1461031e5780636b9990531461033e57600080fd5b80631694505e116101a05780631694505e1461027057806318160ddd146102a857806323b872dd146102cc5780632fd689e3146102ec57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461024057600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ac1565b6105cb565b005b3480156101ff57600080fd5b5060408051808201909152601281527121b437b1b7b630ba32a6b4b635aa37b5b2b760711b60208201525b6040516102379190611bf3565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611a11565b61066a565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50662386f26fc100005b604051908152602001610237565b3480156102d857600080fd5b506102606102e73660046119d0565b610681565b3480156102f857600080fd5b506102be60185481565b34801561030e57600080fd5b5060405160098152602001610237565b34801561032a57600080fd5b50601554610290906001600160a01b031681565b34801561034a57600080fd5b506101f161035936600461195d565b6106ea565b34801561036a57600080fd5b506101f1610379366004611b8d565b610735565b34801561038a57600080fd5b506101f161077d565b34801561039f57600080fd5b506102be6103ae36600461195d565b6107c8565b3480156103bf57600080fd5b506101f16107ea565b3480156103d457600080fd5b506101f16103e3366004611ba8565b61085e565b3480156103f457600080fd5b506102be60165481565b34801561040a57600080fd5b506000546001600160a01b0316610290565b34801561042857600080fd5b506101f1610437366004611b8d565b61088d565b34801561044857600080fd5b506102be60175481565b34801561045e57600080fd5b5060408051808201909152600581526443484f434360d81b602082015261022a565b34801561048c57600080fd5b506101f161049b366004611ba8565b6108d5565b3480156104ac57600080fd5b506101f16104bb366004611bc1565b610904565b3480156104cc57600080fd5b506102606104db366004611a11565b610942565b3480156104ec57600080fd5b506102606104fb36600461195d565b60106020526000908152604090205460ff1681565b34801561051c57600080fd5b506101f161094f565b34801561053157600080fd5b506101f1610540366004611a3d565b6109a3565b34801561055157600080fd5b506102be610560366004611997565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059757600080fd5b506101f16105a6366004611ba8565b610a44565b3480156105b757600080fd5b506101f16105c636600461195d565b610a73565b6000546001600160a01b031633146105fe5760405162461bcd60e51b81526004016105f590611c48565b60405180910390fd5b60005b81518110156106665760016010600084848151811061062257610622611d8f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065e81611d5e565b915050610601565b5050565b6000610677338484610b5d565b5060015b92915050565b600061068e848484610c81565b6106e084336106db85604051806060016040528060288152602001611dd1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bd565b610b5d565b5060019392505050565b6000546001600160a01b031633146107145760405162461bcd60e51b81526004016105f590611c48565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075f5760405162461bcd60e51b81526004016105f590611c48565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b257506013546001600160a01b0316336001600160a01b0316145b6107bb57600080fd5b476107c5816111f7565b50565b6001600160a01b03811660009081526002602052604081205461067b9061127c565b6000546001600160a01b031633146108145760405162461bcd60e51b81526004016105f590611c48565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108885760405162461bcd60e51b81526004016105f590611c48565b601655565b6000546001600160a01b031633146108b75760405162461bcd60e51b81526004016105f590611c48565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108ff5760405162461bcd60e51b81526004016105f590611c48565b601855565b6000546001600160a01b0316331461092e5760405162461bcd60e51b81526004016105f590611c48565b600893909355600a91909155600955600b55565b6000610677338484610c81565b6012546001600160a01b0316336001600160a01b0316148061098457506013546001600160a01b0316336001600160a01b0316145b61098d57600080fd5b6000610998306107c8565b90506107c581611300565b6000546001600160a01b031633146109cd5760405162461bcd60e51b81526004016105f590611c48565b60005b82811015610a3e5781600560008686858181106109ef576109ef611d8f565b9050602002016020810190610a04919061195d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3681611d5e565b9150506109d0565b50505050565b6000546001600160a01b03163314610a6e5760405162461bcd60e51b81526004016105f590611c48565b601755565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b81526004016105f590611c48565b6001600160a01b038116610b025760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f5565b6001600160a01b038216610c205760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f5565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f5565b6001600160a01b038216610d475760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f5565b60008111610da95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f5565b6000546001600160a01b03848116911614801590610dd557506000546001600160a01b03838116911614155b156110b657601554600160a01b900460ff16610e6e576000546001600160a01b03848116911614610e6e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f5565b601654811115610ec05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f5565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0257506001600160a01b03821660009081526010602052604090205460ff16155b610f5a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f5565b6015546001600160a01b03838116911614610fdf5760175481610f7c846107c8565b610f869190611cee565b10610fdf5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f5565b6000610fea306107c8565b6018546016549192508210159082106110035760165491505b80801561101a5750601554600160a81b900460ff16155b801561103457506015546001600160a01b03868116911614155b80156110495750601554600160b01b900460ff165b801561106e57506001600160a01b03851660009081526005602052604090205460ff16155b801561109357506001600160a01b03841660009081526005602052604090205460ff16155b156110b3576110a182611300565b4780156110b1576110b1476111f7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f857506001600160a01b03831660009081526005602052604090205460ff165b8061112a57506015546001600160a01b0385811691161480159061112a57506015546001600160a01b03848116911614155b15611137575060006111b1565b6015546001600160a01b03858116911614801561116257506014546001600160a01b03848116911614155b1561117457600854600c55600954600d555b6015546001600160a01b03848116911614801561119f57506014546001600160a01b03858116911614155b156111b157600a54600c55600b54600d555b610a3e84848484611489565b600081848411156111e15760405162461bcd60e51b81526004016105f59190611bf3565b5060006111ee8486611d47565b95945050505050565b6012546001600160a01b03166108fc6112118360026114b7565b6040518115909202916000818181858888f19350505050158015611239573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112548360026114b7565b6040518115909202916000818181858888f19350505050158015610666573d6000803e3d6000fd5b60006006548211156112e35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f5565b60006112ed6114f9565b90506112f983826114b7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134857611348611d8f565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139c57600080fd5b505afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d4919061197a565b816001815181106113e7576113e7611d8f565b6001600160a01b03928316602091820292909201015260145461140d9130911684610b5d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611446908590600090869030904290600401611c7d565b600060405180830381600087803b15801561146057600080fd5b505af1158015611474573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114965761149661151c565b6114a184848461154a565b80610a3e57610a3e600e54600c55600f54600d55565b60006112f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611641565b600080600061150661166f565b909250905061151582826114b7565b9250505090565b600c5415801561152c5750600d54155b1561153357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061155c876116ad565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158e908761170a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115bd908661174c565b6001600160a01b0389166000908152600260205260409020556115df816117ab565b6115e984836117f5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162e91815260200190565b60405180910390a3505050505050505050565b600081836116625760405162461bcd60e51b81526004016105f59190611bf3565b5060006111ee8486611d06565b6006546000908190662386f26fc1000061168982826114b7565b8210156116a457505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116ca8a600c54600d54611819565b92509250925060006116da6114f9565b905060008060006116ed8e87878761186e565b919e509c509a509598509396509194505050505091939550919395565b60006112f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bd565b6000806117598385611cee565b9050838110156112f95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f5565b60006117b56114f9565b905060006117c383836118be565b306000908152600260205260409020549091506117e0908261174c565b30600090815260026020526040902055505050565b600654611802908361170a565b600655600754611812908261174c565b6007555050565b6000808080611833606461182d89896118be565b906114b7565b90506000611846606461182d8a896118be565b9050600061185e826118588b8661170a565b9061170a565b9992985090965090945050505050565b600080808061187d88866118be565b9050600061188b88876118be565b9050600061189988886118be565b905060006118ab82611858868661170a565b939b939a50919850919650505050505050565b6000826118cd5750600061067b565b60006118d98385611d28565b9050826118e68583611d06565b146112f95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f5565b803561194881611dbb565b919050565b8035801515811461194857600080fd5b60006020828403121561196f57600080fd5b81356112f981611dbb565b60006020828403121561198c57600080fd5b81516112f981611dbb565b600080604083850312156119aa57600080fd5b82356119b581611dbb565b915060208301356119c581611dbb565b809150509250929050565b6000806000606084860312156119e557600080fd5b83356119f081611dbb565b92506020840135611a0081611dbb565b929592945050506040919091013590565b60008060408385031215611a2457600080fd5b8235611a2f81611dbb565b946020939093013593505050565b600080600060408486031215611a5257600080fd5b833567ffffffffffffffff80821115611a6a57600080fd5b818601915086601f830112611a7e57600080fd5b813581811115611a8d57600080fd5b8760208260051b8501011115611aa257600080fd5b602092830195509350611ab8918601905061194d565b90509250925092565b60006020808385031215611ad457600080fd5b823567ffffffffffffffff80821115611aec57600080fd5b818501915085601f830112611b0057600080fd5b813581811115611b1257611b12611da5565b8060051b604051601f19603f83011681018181108582111715611b3757611b37611da5565b604052828152858101935084860182860187018a1015611b5657600080fd5b600095505b83861015611b8057611b6c8161193d565b855260019590950194938601938601611b5b565b5098975050505050505050565b600060208284031215611b9f57600080fd5b6112f98261194d565b600060208284031215611bba57600080fd5b5035919050565b60008060008060808587031215611bd757600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c2057858101830151858201604001528201611c04565b81811115611c32576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ccd5784516001600160a01b031683529383019391830191600101611ca8565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d0157611d01611d79565b500190565b600082611d2357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d4257611d42611d79565b500290565b600082821015611d5957611d59611d79565b500390565b6000600019821415611d7257611d72611d79565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122076aa84fae696f039bd9dfd535b8f0b4a2bc214897183297e270c1369c952a49764736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,538 |
0x7e8229ffd78f51f1e274d9486afce0ee1a1d793c | pragma solidity ^0.4.12;
/**
* @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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title Contracts that should not own Contracts
* @author Remco Bloemen <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4133242c222e0173">[email protected]</a>π.com>
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
* of this contract to reclaim ownership of the contracts.
*/
contract HasNoContracts is Ownable {
/**
* @dev Reclaim ownership of Ownable contracts
* @param contractAddr The address of the Ownable to be reclaimed.
*/
function reclaimContract(address contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr);
contractInst.transferOwnership(owner);
}
}
/**
* @title Contracts that should not own Tokens
* @author Remco Bloemen <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3c4e59515f537c0e">[email protected]</a>π.com>
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
* owner to reclaim the tokens.
*/
contract HasNoTokens is Ownable {
/**
* @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint256 value_, bytes data_) external {
revert();
}
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param tokenAddr address The address of the token contract
*/
function reclaimToken(address tokenAddr) external onlyOwner {
ERC20Basic tokenInst = ERC20Basic(tokenAddr);
uint256 balance = tokenInst.balanceOf(this);
tokenInst.transfer(owner, balance);
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will 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);
Transfer(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
* @title Draft token
*/
contract DraftToken is MintableToken, HasNoContracts, HasNoTokens { //MintableToken is StandardToken, Ownable
using SafeMath for uint256;
string public name = "Draft";
string public symbol = "DFS";
uint256 public decimals = 18;
} | 0x606060405236156100d55763ffffffff60e060020a60003504166305d2035b81146100da57806306fdde0314610101578063095ea7b31461018c57806317ffc320146101c257806318160ddd146101e357806323b872dd146102085780632aed7f3f14610244578063313ce5671461026557806340c10f191461028a57806370a08231146102c05780637d64bcb4146102f15780638da5cb5b1461031857806395d89b4114610347578063a9059cbb146103d2578063c0ee0b8a14610408578063dd62ed3e14610439578063f2fde38b14610470575b600080fd5b34156100e557600080fd5b6100ed610491565b604051901515815260200160405180910390f35b341561010c57600080fd5b6101146104a1565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101515780820151818401525b602001610138565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019757600080fd5b6100ed600160a060020a036004351660243561053f565b604051901515815260200160405180910390f35b34156101cd57600080fd5b6101e1600160a060020a03600435166105e6565b005b34156101ee57600080fd5b6101f6610702565b60405190815260200160405180910390f35b341561021357600080fd5b6100ed600160a060020a0360043581169060243516604435610708565b604051901515815260200160405180910390f35b341561024f57600080fd5b6101e1600160a060020a036004351661080b565b005b341561027057600080fd5b6101f661089a565b60405190815260200160405180910390f35b341561029557600080fd5b6100ed600160a060020a03600435166024356108a0565b604051901515815260200160405180910390f35b34156102cb57600080fd5b6101f6600160a060020a036004351661099e565b60405190815260200160405180910390f35b34156102fc57600080fd5b6100ed6109bd565b604051901515815260200160405180910390f35b341561032357600080fd5b61032b610a25565b604051600160a060020a03909116815260200160405180910390f35b341561035257600080fd5b610114610a34565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101515780820151818401525b602001610138565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103dd57600080fd5b6100ed600160a060020a0360043516602435610ad2565b604051901515815260200160405180910390f35b341561041357600080fd5b6101e160048035600160a060020a03169060248035916044359182019101356100d5565b005b341561044457600080fd5b6101f6600160a060020a0360043581169060243516610b8b565b60405190815260200160405180910390f35b341561047b57600080fd5b6101e1600160a060020a0360043516610bb8565b005b60035460a060020a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105375780601f1061050c57610100808354040283529160200191610537565b820191906000526020600020905b81548152906001019060200180831161051a57829003601f168201915b505050505081565b60008115806105715750600160a060020a03338116600090815260026020908152604080832093871683529290522054155b151561057c57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b600354600090819033600160a060020a0390811691161461060657600080fd5b82915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561066057600080fd5b6102c65a03f1151561067157600080fd5b5050506040518051600354909250600160a060020a03808516925063a9059cbb91168360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156106e057600080fd5b6102c65a03f115156106f157600080fd5b505050604051805150505b5b505050565b60005481565b600160a060020a03808416600090815260026020908152604080832033851684528252808320549386168352600190915281205490919061074f908463ffffffff610c0816565b600160a060020a038086166000908152600160205260408082209390935590871681522054610784908463ffffffff610c2216565b600160a060020a0386166000908152600160205260409020556107ad818463ffffffff610c2216565b600160a060020a0380871660008181526002602090815260408083203386168452909152908190209390935590861691600080516020610c3a8339815191529086905190815260200160405180910390a3600191505b509392505050565b60035460009033600160a060020a0390811691161461082957600080fd5b506003548190600160a060020a038083169163f2fde38b911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561088057600080fd5b6102c65a03f1151561089157600080fd5b5050505b5b5050565b60065481565b60035460009033600160a060020a039081169116146108be57600080fd5b60035460a060020a900460ff16156108d557600080fd5b6000546108e8908363ffffffff610c0816565b6000908155600160a060020a038416815260016020526040902054610913908363ffffffff610c0816565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a282600160a060020a03166000600080516020610c3a8339815191528460405190815260200160405180910390a35060015b5b5b92915050565b600160a060020a0381166000908152600160205260409020545b919050565b60035460009033600160a060020a039081169116146109db57600080fd5b6003805460a060020a60ff02191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b5b90565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105375780601f1061050c57610100808354040283529160200191610537565b820191906000526020600020905b81548152906001019060200180831161051a57829003601f168201915b505050505081565b600160a060020a033316600090815260016020526040812054610afb908363ffffffff610c2216565b600160a060020a033381166000908152600160205260408082209390935590851681522054610b30908363ffffffff610c0816565b600160a060020a038085166000818152600160205260409081902093909355913390911690600080516020610c3a8339815191529085905190815260200160405180910390a35060015b92915050565b600080fd5b50505050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60035433600160a060020a03908116911614610bd357600080fd5b600160a060020a0381161515610be857600080fd5b60038054600160a060020a031916600160a060020a0383161790555b5b50565b600082820183811015610c1757fe5b8091505b5092915050565b600082821115610c2e57fe5b508082035b929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582002ea14cc6267e40918608f9a1812538aca3a66617d207ce0ddd3bbf27e62cc850029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,539 |
0x21112efb2f7de8237041220ebfcd052e93bcaf9e | /**
*Submitted for verification at Etherscan.io on 2021-03-16
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
}
contract rVault is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint public min = 9500;
uint public constant max = 10000;
address public governance;
address public controller;
constructor (address _token, address _controller) public ERC20Detailed(
string(abi.encodePacked("recom ", ERC20Detailed(_token).name())),
string(abi.encodePacked("r", ERC20Detailed(_token).symbol())),
ERC20Detailed(_token).decimals()
) {
token = IERC20(_token);
governance = msg.sender;
controller = _controller;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this))
.add(Controller(controller).balanceOf(address(token)));
}
function setMin(uint _min) external {
require(msg.sender == governance, "!governance");
min = _min;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setController(address _controller) public {
require(msg.sender == governance, "!governance");
controller = _controller;
}
// Custom logic in here for how much the vault allows to be borrowed
// Sets minimum required on-hand to keep small withdrawals cheap
function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(min).div(max);
}
function earn() public {
uint _bal = available();
token.safeTransfer(controller, _bal);
Controller(controller).earn(address(token), _bal);
}
function deposit(uint _amount) external {
uint _pool = balance();
token.safeTransferFrom(msg.sender, address(this), _amount);
uint shares = 0;
if (_pool == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
// No rebalance implementation for lower fees and faster swaps
function withdraw(uint _shares) external {
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
}
token.safeTransfer(msg.sender, r);
}
function getPricePerFullShare() public view returns (uint) {
return balance().mul(1e18).div(totalSupply());
}
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c806377c7b8fc116100de578063b69ef8a811610097578063dd62ed3e11610071578063dd62ed3e14610714578063f77c47911461078c578063f8897945146107d6578063fc0c546a146107f457610173565b8063b69ef8a8146106be578063b6b55f25146106dc578063d389800f1461070a57610173565b806377c7b8fc146104c957806392eefe9b146104e757806395d89b411461052b578063a457c2d7146105ae578063a9059cbb14610614578063ab033ea91461067a57610173565b80633950935111610130578063395093511461035757806345dc3dd8146103bd57806348a0d754146103eb5780635aa6e675146104095780636ac5db191461045357806370a082311461047157610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461026157806323b872dd1461027f5780632e1a7d4d14610305578063313ce56714610333575b600080fd5b61018061083e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e0565b604051808215151515815260200191505060405180910390f35b6102696108fe565b6040518082815260200191505060405180910390f35b6102eb6004803603606081101561029557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610908565b604051808215151515815260200191505060405180910390f35b6103316004803603602081101561031b57600080fd5b81019080803590602001909291905050506109e1565b005b61033b610d6b565b604051808260ff1660ff16815260200191505060405180910390f35b6103a36004803603604081101561036d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d82565b604051808215151515815260200191505060405180910390f35b6103e9600480360360208110156103d357600080fd5b8101908080359060200190929190505050610e35565b005b6103f3610f02565b6040518082815260200191505060405180910390f35b61041161100b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61045b611031565b6040518082815260200191505060405180910390f35b6104b36004803603602081101561048757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611037565b6040518082815260200191505060405180910390f35b6104d161107f565b6040518082815260200191505060405180910390f35b610529600480360360208110156104fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110c1565b005b6105336111c8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610573578082015181840152602081019050610558565b50505050905090810190601f1680156105a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105fa600480360360408110156105c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061126a565b604051808215151515815260200191505060405180910390f35b6106606004803603604081101561062a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611337565b604051808215151515815260200191505060405180910390f35b6106bc6004803603602081101561069057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611355565b005b6106c661145c565b6040518082815260200191505060405180910390f35b610708600480360360208110156106f257600080fd5b810190808035906020019092919050505061164a565b005b6107126116f9565b005b6107766004803603604081101561072a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061185a565b6040518082815260200191505060405180910390f35b6107946118e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107de611907565b6040518082815260200191505060405180910390f35b6107fc61190d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108d65780601f106108ab576101008083540402835291602001916108d6565b820191906000526020600020905b8154815290600101906020018083116108b957829003601f168201915b5050505050905090565b60006108f46108ed611933565b848461193b565b6001905092915050565b6000600254905090565b6000610915848484611b32565b6109d684610921611933565b6109d18560405180606001604052806028815260200161299f60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610987611933565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de89092919063ffffffff16565b61193b565b600190509392505050565b6000610a166109ee6108fe565b610a08846109fa61145c565b611ea890919063ffffffff16565b611f2e90919063ffffffff16565b9050610a223383611f78565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ac357600080fd5b505afa158015610ad7573d6000803e3d6000fd5b505050506040513d6020811015610aed57600080fd5b8101908080519060200190929190505050905081811015610d19576000610b1d828461213090919063ffffffff16565b9050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3fef3a3600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610bea57600080fd5b505af1158015610bfe573d6000803e3d6000fd5b505050506000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ca357600080fd5b505afa158015610cb7573d6000803e3d6000fd5b505050506040513d6020811015610ccd57600080fd5b810190808051906020019092919050505090506000610cf5848361213090919063ffffffff16565b905082811015610d1557610d12818561217a90919063ffffffff16565b94505b5050505b610d663383600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166122029092919063ffffffff16565b505050565b6000600560009054906101000a900460ff16905090565b6000610e2b610d8f611933565b84610e268560016000610da0611933565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217a90919063ffffffff16565b61193b565b6001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ef8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060068190555050565b6000611006612710610ff8600654600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610faf57600080fd5b505afa158015610fc3573d6000803e3d6000fd5b505050506040513d6020811015610fd957600080fd5b8101908080519060200190929190505050611ea890919063ffffffff16565b611f2e90919063ffffffff16565b905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61271081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006110bc61108c6108fe565b6110ae670de0b6b3a76400006110a061145c565b611ea890919063ffffffff16565b611f2e90919063ffffffff16565b905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112605780601f1061123557610100808354040283529160200191611260565b820191906000526020600020905b81548152906001019060200180831161124357829003601f168201915b5050505050905090565b600061132d611277611933565b8461132885604051806060016040528060258152602001612a5b60259139600160006112a1611933565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de89092919063ffffffff16565b61193b565b6001905092915050565b600061134b611344611933565b8484611b32565b6001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000611645600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561152257600080fd5b505afa158015611536573d6000803e3d6000fd5b505050506040513d602081101561154c57600080fd5b8101908080519060200190929190505050600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156115fc57600080fd5b505afa158015611610573d6000803e3d6000fd5b505050506040513d602081101561162657600080fd5b810190808051906020019092919050505061217a90919063ffffffff16565b905090565b600061165461145c565b90506116a5333084600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166122d3909392919063ffffffff16565b600080905060008214156116bb578290506116ea565b6116e7826116d96116ca6108fe565b86611ea890919063ffffffff16565b611f2e90919063ffffffff16565b90505b6116f433826123d9565b505050565b6000611703610f02565b9050611774600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166122029092919063ffffffff16565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b02bf4b9600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561183f57600080fd5b505af1158015611853573d6000803e3d6000fd5b5050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119c1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612a0d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129366022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bb8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806129e86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806128f16023913960400191505060405180910390fd5b611ca981604051806060016040528060268152602001612958602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de89092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d3c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611e95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e5a578082015181840152602081019050611e3f565b50505050905090810190601f168015611e875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831415611ebb5760009050611f28565b6000828402905082848281611ecc57fe5b0414611f23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061297e6021913960400191505060405180910390fd5b809150505b92915050565b6000611f7083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612594565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ffe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806129c76021913960400191505060405180910390fd5b61206981604051806060016040528060228152602001612914602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de89092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120c08160025461213090919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600061217283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611de8565b905092915050565b6000808284019050838110156121f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6122ce838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061265a565b505050565b6123d3848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061265a565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561247c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6124918160025461217a90919063ffffffff16565b6002819055506124e8816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083118290612640576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156126055780820151818401526020810190506125ea565b50505050905090810190601f1680156126325780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161264c57fe5b049050809150509392505050565b6126798273ffffffffffffffffffffffffffffffffffffffff166128a5565b6126eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061273a5780518252602082019150602081019050602083039250612717565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461279c576040519150601f19603f3d011682016040523d82523d6000602084013e6127a1565b606091505b509150915081612819576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b60008151111561289f5780806020019051602081101561283857600080fd5b810190808051906020019092919050505061289e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612a31602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b82141580156128e75750808214155b9250505091905056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158207c3d1698b7daecb81b927541284ba3a780d5c783c57bbbcb81fb7f314aaa5a6064736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 1,540 |
0x85db0c54146cc45c5f25e6da6ea6a4b93696c935 | /*
Copyright 2018 Source Code Chain Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract BasicERC20Token {
// Public variables of the token
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balances;
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);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Save this for an assertion in the future
uint previousBalances = balances[_from] + balances[_to];
// Subtract from the sender
balances[_from] -= _value;
// Add the same to the recipient
balances[_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(balances[_from] + balances[_to] == previousBalances);
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` 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;
}
}
/**
* 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(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balances[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
}
/**
* @title Source Code Chain AI Token.
* @author Bertrand Huang - <bertrand.huang@sourcecc.io>.
*/
contract SCCAIToken is BasicERC20Token {
using SafeMath for uint256;
string public name = "Source Code Chain AI Token";
string public symbol = "SCC";
uint public decimals = 18;
uint public exchange = 100000;
address public target;
address public foundationTarget;
bool public isStart = true;
bool public isClose = false;
modifier onlyOwner {
if (target == msg.sender) {
_;
} else {
revert();
}
}
modifier inProgress {
if(isStart && !isClose) {
_;
}else {
revert();
}
}
function SCCAIToken(address _target, address _foundationTarget) public{
target = _target;
foundationTarget = _foundationTarget;
totalSupply = 10000000000 * 10 ** uint256(decimals);
balances[target] = 2000000000 * 10 ** uint256(decimals);
balances[foundationTarget] = 8000000000 * 10 ** uint256(decimals);
emit Transfer(msg.sender, target, balances[target]);
emit Transfer(msg.sender, foundationTarget, balances[foundationTarget]);
}
function open() public onlyOwner {
isStart = true;
isClose = false;
}
function close() public onlyOwner inProgress {
isStart = false;
isClose = true;
}
function () payable public {
issueToken();
}
function issueToken() payable inProgress public{
assert(balances[target] > 0);
assert(msg.value >= 0.0001 ether);
uint256 tokens = msg.value.mul(exchange);
if (tokens > balances[target]) {
revert();
}
balances[target] = balances[target].sub(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(target, msg.sender, tokens);
if (!target.send(msg.value)) {
revert();
}
}
} | 0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610127578063095ea7b3146101b55780631338f4931461020f57806318160ddd1461023c57806323b872dd1461026557806327e235e3146102de578063313ce5671461032b57806342966c681461035457806343d726d61461038f57806370a08231146103a457806372cd7b89146103f157806379cc6790146104465780638a55d36e146104a057806395d89b41146104cd578063a1ee8c781461055b578063a9059cbb14610565578063cae9ca51146105a7578063d2f7265a14610644578063d4b839921461066d578063dd62ed3e146106c2578063fcfff16f1461072e575b610125610743565b005b341561013257600080fd5b61013a610adb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c057600080fd5b6101f5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b79565b604051808215151515815260200191505060405180910390f35b341561021a57600080fd5b610222610c06565b604051808215151515815260200191505060405180910390f35b341561024757600080fd5b61024f610c19565b6040518082815260200191505060405180910390f35b341561027057600080fd5b6102c4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c1f565b604051808215151515815260200191505060405180910390f35b34156102e957600080fd5b610315600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d4c565b6040518082815260200191505060405180910390f35b341561033657600080fd5b61033e610d64565b6040518082815260200191505060405180910390f35b341561035f57600080fd5b6103756004808035906020019091905050610d6a565b604051808215151515815260200191505060405180910390f35b341561039a57600080fd5b6103a2610e6d565b005b34156103af57600080fd5b6103db600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f3d565b6040518082815260200191505060405180910390f35b34156103fc57600080fd5b610404610f86565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045157600080fd5b610486600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fac565b604051808215151515815260200191505060405180910390f35b34156104ab57600080fd5b6104b36111c5565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b6104e06111d8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610520578082015181840152602081019050610505565b50505050905090810190601f16801561054d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610563610743565b005b341561057057600080fd5b6105a5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611276565b005b34156105b257600080fd5b61062a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611285565b604051808215151515815260200191505060405180910390f35b341561064f57600080fd5b6106576113ff565b6040518082815260200191505060405180910390f35b341561067857600080fd5b610680611405565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106cd57600080fd5b610718600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061142b565b6040518082815260200191505060405180910390f35b341561073957600080fd5b610741611450565b005b6000600860149054906101000a900460ff16801561076e5750600860159054906101000a900460ff16155b15610ad357600060016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156107e057fe5b655af3107a400034101515156107f257fe5b610807600654346114e890919063ffffffff16565b905060016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561087757600080fd5b6108eb8160016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152390919063ffffffff16565b60016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109a281600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153c90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610ace57600080fd5b610ad8565b600080fd5b50565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b715780601f10610b4657610100808354040283529160200191610b71565b820191906000526020600020905b815481529060010190602001808311610b5457829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b600860159054906101000a900460ff1681565b60005481565b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610cac57600080fd5b81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610d4184848461155a565b600190509392505050565b60016020528060005260406000206000915090505481565b60055481565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610dba57600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610f3657600860149054906101000a900460ff168015610eec5750600860159054906101000a900460ff16155b15610f2c576000600860146101000a81548160ff0219169083151502179055506001600860156101000a81548160ff021916908315150217905550610f31565b600080fd5b610f3b565b600080fd5b565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ffc57600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561108757600080fd5b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160008082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b600860149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561126e5780601f106112435761010080835404028352916020019161126e565b820191906000526020600020905b81548152906001019060200180831161125157829003601f168201915b505050505081565b61128133838361155a565b5050565b6000808490506112958585610b79565b156113f6578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561138f578082015181840152602081019050611374565b50505050905090810190601f1680156113bc5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156113dd57600080fd5b5af115156113ea57600080fd5b505050600191506113f7565b5b509392505050565b60065481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6002602052816000526040600020602052806000526040600020600091509150505481565b3373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156114e1576001600860146101000a81548160ff0219169083151502179055506000600860156101000a81548160ff0219169083151502179055506114e6565b600080fd5b565b60008060008414156114fd576000915061151c565b828402905082848281151561150e57fe5b0414151561151857fe5b8091505b5092915050565b600082821115151561153157fe5b818303905092915050565b600080828401905083811015151561155057fe5b8091505092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561158157600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156115cf57600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561165d57600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540114151561186a57fe5b505050505600a165627a7a723058205d1538937308867b3af797af73859551ec30bd2428f1cde320fd96aaaeecc9040029 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 1,541 |
0x7e0b06a487b0060d447ea0bb8415b5cc6d7bd1d8 | pragma solidity ^0.4.11;
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
revert();
}
}
}
/**
* Standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, SafeMath {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
/* Actual balances of token holders */
mapping(address => uint) balances;
/* approve() allowances */
mapping (address => mapping (address => uint)) allowed;
/**
*
* Fix for the ERC20 short address attack
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length != size + 4) {
revert();
}
_;
}
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) returns (bool success) {
uint _allowance = allowed[_from][msg.sender];
// Check is not needed because safeSub(_allowance, _value) will already revert() if this condition is not met
// if (_value > _allowance) revert();
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert();
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
/**
* Atomic increment of approved spending
*
* Works around https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
*/
function addApproval(address _spender, uint _addedValue)
onlyPayloadSize(2 * 32)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
allowed[msg.sender][_spender] = safeAdd(oldValue, _addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* Atomic decrement of approved spending.
*
* Works around https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*/
function subApproval(address _spender, uint _subtractedValue)
onlyPayloadSize(2 * 32)
returns (bool success) {
uint oldVal = allowed[msg.sender][_spender];
if (_subtractedValue > oldVal) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = safeSub(oldVal, _subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract BurnableToken is StandardToken {
address public constant BURN_ADDRESS = 0;
/** How many tokens we burned */
event Burned(address burner, uint burnedAmount);
/**
* Burn extra tokens from a balance.
*
*/
function burn(uint burnAmount) {
address burner = msg.sender;
balances[burner] = safeSub(balances[burner], burnAmount);
totalSupply = safeSub(totalSupply, burnAmount);
Burned(burner, burnAmount);
}
}
/**
* Upgrade agent interface inspired by Lunyr.
*
* Upgrade agent transfers tokens to a new contract.
* Upgrade agent itself can be the token contract, or just a middle man contract doing the heavy lifting.
*/
contract UpgradeAgent {
uint public originalSupply;
/** Interface marker */
function isUpgradeAgent() public constant returns (bool) {
return true;
}
function upgradeFrom(address _from, uint256 _value) public;
}
/**
* A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision.
*
* First envisioned by Golem and Lunyr projects.
*/
contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAgent;
/** How many tokens we have upgraded by now. */
uint256 public totalUpgraded;
/**
* Upgrade states.
*
* - NotAllowed: The child contract has not reached a condition where the upgrade can bgun
* - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet
* - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet
* - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens
*
*/
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading}
/**
* Somebody has upgraded some of his tokens.
*/
event Upgrade(address indexed _from, address indexed _to, uint256 _value);
/**
* New upgrade agent available.
*/
event UpgradeAgentSet(address agent);
/**
* Do not allow construction without upgrade master set.
*/
function UpgradeableToken(address _upgradeMaster) {
upgradeMaster = _upgradeMaster;
}
/**
* Allow the token holder to upgrade some of their tokens to a new contract.
*/
function upgrade(uint256 value) public {
UpgradeState state = getUpgradeState();
if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) {
// Called in a bad state
revert();
}
// Validate input value.
if (value == 0) revert();
balances[msg.sender] = safeSub(balances[msg.sender], value);
// Take tokens out from circulation
totalSupply = safeSub(totalSupply, value);
totalUpgraded = safeAdd(totalUpgraded, value);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(msg.sender, value);
Upgrade(msg.sender, upgradeAgent, value);
}
/**
* Set an upgrade agent that handles
*/
function setUpgradeAgent(address agent) external {
if(!canUpgrade()) {
// The token is not yet in a state that we could think upgrading
revert();
}
if (agent == 0x0) revert();
// Only a master can designate the next agent
if (msg.sender != upgradeMaster) revert();
// Upgrade has already begun for an agent
if (getUpgradeState() == UpgradeState.Upgrading) revert();
upgradeAgent = UpgradeAgent(agent);
// Bad interface
if(!upgradeAgent.isUpgradeAgent()) revert();
// Make sure that token supplies match in source and target
if (upgradeAgent.originalSupply() != totalSupply) revert();
UpgradeAgentSet(upgradeAgent);
}
/**
* Get the state of the token upgrade.
*/
function getUpgradeState() public constant returns(UpgradeState) {
if(!canUpgrade()) return UpgradeState.NotAllowed;
else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
/**
* Change the upgrade master.
*
* This allows us to set a new owner for the upgrade mechanism.
*/
function setUpgradeMaster(address master) public {
if (master == 0x0) revert();
if (msg.sender != upgradeMaster) revert();
upgradeMaster = master;
}
/**
* Child contract can enable to provide the condition when the upgrade can begun.
*/
function canUpgrade() public constant returns(bool) {
return true;
}
}
contract TRHToken is BurnableToken, UpgradeableToken {
string public name;
string public symbol;
uint public decimals;
address public owner;
bool public mintingFinished = false;
mapping(address => uint) public previligedBalances;
/** List of agents that are allowed to create new tokens */
mapping(address => bool) public mintAgents;
event MintingAgentChanged(address addr, bool state);
modifier onlyOwner() {
if(msg.sender != owner) revert();
_;
}
modifier onlyMintAgent() {
// Only crowdsale contracts are allowed to mint new tokens
if(!mintAgents[msg.sender]) revert();
_;
}
/** Make sure we are not done yet. */
modifier canMint() {
if(mintingFinished) revert();
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function TRHToken(address _owner, string _name, string _symbol, uint _totalSupply, uint _decimals) UpgradeableToken(_owner) {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
decimals = _decimals;
// Allocate initial balance to the owner
balances[_owner] = _totalSupply;
// save the owner
owner = _owner;
}
// privileged transfer
function transferPrivileged(address _to, uint _value) onlyPayloadSize(2 * 32) onlyOwner returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
previligedBalances[_to] = safeAdd(previligedBalances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
// get priveleged balance
function getPrivilegedBalance(address _owner) constant returns (uint balance) {
return previligedBalances[_owner];
}
// admin only can transfer from the privileged accounts
function transferFromPrivileged(address _from, address _to, uint _value) onlyOwner returns (bool success) {
uint availablePrevilegedBalance = previligedBalances[_from];
balances[_from] = safeSub(balances[_from], _value);
balances[_to] = safeAdd(balances[_to], _value);
previligedBalances[_from] = safeSub(availablePrevilegedBalance, _value);
Transfer(_from, _to, _value);
return true;
}
/**
* Create new tokens and allocate them to an address..
*
* Only callably by a crowdsale contract (mint agent).
*/
function mint(address receiver, uint amount) onlyMintAgent canMint public {
totalSupply = safeAdd(totalSupply, amount);
balances[receiver] = safeAdd(balances[receiver], amount);
// This will make the mint transaction apper in EtherScan.io
// We can remove this after there is a standardized minting event
Transfer(0, receiver, amount);
}
/**
* Owner can allow a crowdsale contract to mint new tokens.
*/
function setMintAgent(address addr, bool state) onlyOwner canMint public {
mintAgents[addr] = state;
MintingAgentChanged(addr, state);
}
}
contract CrowdSaleTRH {
address public beneficiary;
uint public startline;
uint public deadline;
uint public price;
uint public amountRaised;
mapping(address => uint) public actualGotETH;
TRHToken public tokenReward;
modifier onlyOwner() {
if(msg.sender != beneficiary) revert();
_;
}
modifier whenCrowdsaleIsFinished() {
if(now < deadline) revert();
_;
}
modifier whenRefundAvailable() {
if(tokenReward.balanceOf(address(this)) <= 0) revert();
_;
}
function CrowdSaleTRH(
uint start,
uint end,
uint costOfEachToken,
TRHToken addressOfTokenUsedAsReward
) {
beneficiary = msg.sender;
startline = start;
deadline = end;
price = costOfEachToken;
tokenReward = TRHToken(addressOfTokenUsedAsReward);
}
function () payable {
if (now <= startline) revert();
if (now >= deadline) revert();
uint amount = msg.value;
if (amount < price) revert();
amountRaised += amount;
uint tokensToSend = amount / price;
actualGotETH[msg.sender] += amount;
tokenReward.transfer(msg.sender, tokensToSend);
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
beneficiary = newOwner;
}
}
function Refund() whenRefundAvailable whenCrowdsaleIsFinished {
msg.sender.transfer(actualGotETH[msg.sender]);
}
function WithdrawAllETH() onlyOwner {
amountRaised = 0;
beneficiary.transfer(amountRaised);
}
function WithdrawTokens(uint amount) onlyOwner {
tokenReward.transfer(beneficiary, amount);
}
function ChangeCost(uint costOfEachToken) onlyOwner {
price = costOfEachToken;
}
function ChangeStart(uint start) onlyOwner {
startline = start;
}
function ChangeEnd(uint end) onlyOwner {
deadline = end;
}
} | 0x606060405236156100b45763ffffffff60e060020a6000350416630e78501f81146101a0578063162bc80c146101b85780631ffe4cca146101d057806329a5c0f4146101f557806329dcb0cf1461020a5780632ae8b4a31461022f57806338af3eed146102605780635d2686291461028f5780636e66f6e9146102a45780637b3e5e7b146102d3578063a035b1fe146102f8578063c47af5cf1461031d578063f2fde38b14610335578063f72f682614610356575b61019e5b600080600154421115156100cb57600080fd5b60025442106100d957600080fd5b3491506003548210156100eb57600080fd5b60048054830190556003548281151561010057fe5b33600160a060020a0381811660009081526005602052604080822080548901905560065495909404955093169263a9059cbb92859190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561017e57600080fd5b6102c65a03f1151561018f57600080fd5b505050604051805150505b5050565b005b34156101ab57600080fd5b61019e60043561036e565b005b34156101c357600080fd5b61019e600435610393565b005b34156101db57600080fd5b6101e3610436565b60405190815260200160405180910390f35b341561020057600080fd5b61019e61043c565b005b341561021557600080fd5b6101e3610492565b60405190815260200160405180910390f35b341561023a57600080fd5b6101e3600160a060020a0360043516610498565b60405190815260200160405180910390f35b341561026b57600080fd5b6102736104aa565b604051600160a060020a03909116815260200160405180910390f35b341561029a57600080fd5b61019e6104b9565b005b34156102af57600080fd5b61027361058f565b604051600160a060020a03909116815260200160405180910390f35b34156102de57600080fd5b6101e361059e565b60405190815260200160405180910390f35b341561030357600080fd5b6101e36105a4565b60405190815260200160405180910390f35b341561032857600080fd5b61019e6004356105aa565b005b341561034057600080fd5b61019e600160a060020a03600435166105cf565b005b341561036157600080fd5b61019e600435610627565b005b60005433600160a060020a0390811691161461038957600080fd5b60018190555b5b50565b60005433600160a060020a039081169116146103ae57600080fd5b60065460008054600160a060020a039283169263a9059cbb9291169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561041657600080fd5b6102c65a03f1151561042757600080fd5b505050604051805150505b5b50565b60015481565b60005433600160a060020a0390811691161461045757600080fd5b600060048190558054600160a060020a0316906108fc90604051600060405180830381858888f19350505050151561048e57600080fd5b5b5b565b60025481565b60056020526000908152604090205481565b600054600160a060020a031681565b600654600090600160a060020a03166370a0823130836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561051457600080fd5b6102c65a03f1151561052557600080fd5b5050506040518051905011151561053b57600080fd5b60025442101561054a57600080fd5b600160a060020a033316600081815260056020526040908190205480156108fc029151600060405180830381858888f19350505050151561048e57600080fd5b5b5b5b565b600654600160a060020a031681565b60045481565b60035481565b60005433600160a060020a039081169116146105c557600080fd5b60038190555b5b50565b60005433600160a060020a039081169116146105ea57600080fd5b600160a060020a0381161561038f576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60005433600160a060020a0390811691161461064257600080fd5b60028190555b5b505600a165627a7a72305820fb54523fd2060b1a243428948c961ad8b4e3cc658c6f118c351074ae08a47b1d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,542 |
0x87732598b18c68706e49f386b8bb528ce4472613 | pragma solidity ^0.4.25;
/*
* Creator: ADV (Advent)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() public constant returns (uint256 supply);
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
constructor () public {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) public constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Advent smart contract.
*/
contract ADVToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 500000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
constructor () public {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() public constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Advent";
string constant public symbol = "ADV";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value) public
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) public {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () public {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () public {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) public {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) public {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
} | 0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630150246081146100df57806306fdde03146100f6578063095ea7b31461018057806313af4035146101b857806318160ddd146101d957806323b872dd14610200578063313ce5671461022a57806331c420d41461025557806370a082311461026a5780637e1f2bb81461028b57806389519c50146102a357806395d89b41146102cd578063a9059cbb146102e2578063dd62ed3e14610306578063e724529c1461032d575b600080fd5b3480156100eb57600080fd5b506100f4610353565b005b34801561010257600080fd5b5061010b6103af565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014557818101518382015260200161012d565b50505050905090810190601f1680156101725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018c57600080fd5b506101a4600160a060020a03600435166024356103e6565b604080519115158252519081900360200190f35b3480156101c457600080fd5b506100f4600160a060020a036004351661041a565b3480156101e557600080fd5b506101ee610460565b60408051918252519081900360200190f35b34801561020c57600080fd5b506101a4600160a060020a0360043581169060243516604435610466565b34801561023657600080fd5b5061023f6104b4565b6040805160ff9092168252519081900360200190f35b34801561026157600080fd5b506100f46104b9565b34801561027657600080fd5b506101ee600160a060020a0360043516610510565b34801561029757600080fd5b506101a460043561052f565b3480156102af57600080fd5b506100f4600160a060020a03600435811690602435166044356105fb565b3480156102d957600080fd5b5061010b610714565b3480156102ee57600080fd5b506101a4600160a060020a036004351660243561074b565b34801561031257600080fd5b506101ee600160a060020a036004358116906024351661078c565b34801561033957600080fd5b506100f4600160a060020a036004351660243515156107b7565b600254600160a060020a0316331461036a57600080fd5b60055460ff1615156103ad576005805460ff191660011790556040517f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de90600090a15b565b60408051808201909152600681527f416476656e740000000000000000000000000000000000000000000000000000602082015281565b60006103f2338461078c565b15806103fc575081155b151561040757600080fd5b6104118383610848565b90505b92915050565b600254600160a060020a0316331461043157600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045490565b600160a060020a03831660009081526003602052604081205460ff161561048c57600080fd5b60055460ff161561049f575060006104ad565b6104aa8484846108ae565b90505b9392505050565b601281565b600254600160a060020a031633146104d057600080fd5b60055460ff16156103ad576005805460ff191690556040517f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded90600090a1565b600160a060020a0381166000908152602081905260409020545b919050565b600254600090600160a060020a0316331461054957600080fd5b60008211156105f35761056a6b019d971e4fe8401e74000000600454610a4d565b8211156105795750600061052a565b336000908152602081905260409020546105939083610a5f565b336000908152602081905260409020556004546105b09083610a5f565b60045560408051838152905133916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600161052a565b506000919050565b600254600090600160a060020a0316331461061557600080fd5b600160a060020a03841630141561062b57600080fd5b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018490529151859283169163a9059cbb9160448083019260209291908290030181600087803b15801561069857600080fd5b505af11580156106ac573d6000803e3d6000fd5b505050506040513d60208110156106c257600080fd5b505060408051600160a060020a0380871682528516602082015280820184905290517ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc1549181900360600190a150505050565b60408051808201909152600381527f4144560000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526003602052604081205460ff161561076857600080fd5b60055460ff161561077b57506000610414565b6107858383610a6e565b9050610414565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600254600160a060020a031633146107ce57600080fd5b33600160a060020a03831614156107e457600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156108c557600080fd5b600160a060020a03841660009081526001602090815260408083203384529091529020548211156108f8575060006104ad565b600160a060020a038416600090815260208190526040902054821115610920575060006104ad565b600082118015610942575082600160a060020a031684600160a060020a031614155b156109f857600160a060020a03841660009081526001602090815260408083203384529091529020546109759083610a4d565b600160a060020a03851660008181526001602090815260408083203384528252808320949094559181529081905220546109af9083610a4d565b600160a060020a0380861660009081526020819052604080822093909355908516815220546109de9083610a5f565b600160a060020a0384166000908152602081905260409020555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b600082821115610a5957fe5b50900390565b6000828201838110156104ad57fe5b6000600160a060020a0383161515610a8557600080fd5b33600090815260208190526040902054821115610aa457506000610414565b600082118015610abd575033600160a060020a03841614155b15610b225733600090815260208190526040902054610adc9083610a4d565b3360009081526020819052604080822092909255600160a060020a03851681522054610b089083610a5f565b600160a060020a0384166000908152602081905260409020555b604080518381529051600160a060020a0385169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820d237d5d08bf9189036fd78e50f6367b30b1a23db3c3b6e84d711e8da6ef57ea00029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,543 |
0xdb682fc2af3a1791081ac4efb60176c0a0c8ed20 | // SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() external;
function pushManagement( address newOwner_ ) external;
function pullManagement() external;
}
contract Ownable is IOwnable {
address internal _owner;
address internal _newOwner;
event OwnershipPushed(address indexed previousOwner, address indexed newOwner);
event OwnershipPulled(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = msg.sender;
emit OwnershipPushed( address(0), _owner );
}
function policy() public view override returns (address) {
return _owner;
}
modifier onlyPolicy() {
require( _owner == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renounceManagement() public virtual override onlyPolicy() {
emit OwnershipPushed( _owner, address(0) );
_owner = address(0);
}
function pushManagement( address newOwner_ ) public virtual override onlyPolicy() {
require( newOwner_ != address(0), "Ownable: new owner is the zero address");
emit OwnershipPushed( _owner, newOwner_ );
_newOwner = newOwner_;
}
function pullManagement() public virtual override {
require( msg.sender == _newOwner, "Ownable: must be new owner to pull");
emit OwnershipPulled( _owner, _newOwner );
_owner = _newOwner;
}
}
interface IERC20 {
function decimals() external view returns (uint8);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function totalSupply() external view returns (uint256);
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 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 _callOptionalReturn(IERC20 token, bytes memory data) private {
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");
}
}
}
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;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
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 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 {
if (returndata.length > 0) {
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IOHMERC20 {
function burnFrom(address account_, uint256 amount_) external;
}
interface IBondCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract MockTreasury is Ownable {
using SafeERC20 for IERC20;
using SafeMath for uint;
event Deposit( address indexed token, uint amount, uint value, uint send );
event Withdrawal( address indexed token, uint amount, uint value );
address public immutable OHM;
mapping( address => bool ) public isReserveToken;
mapping( address => bool ) public isReserveDepositor;
mapping( address => bool ) public isReserveSpender;
mapping( address => bool ) public isReserveManager;
mapping( address => bool ) public isLiquidityToken;
mapping( address => bool ) public isLiquidityDepositor;
mapping( address => bool ) public isLiquidityManager;
mapping( address => address ) public bondCalculator; // bond calculator for liquidity token
uint public totalReserves; // Risk-free value of all assets
constructor( address _ohm ) {
OHM = _ohm;
}
function deposit( uint _amount, address _token, uint _profit ) external returns ( uint send_ ) {
require( isReserveToken[ _token ] || isLiquidityToken[ _token ], "Not accepted" );
IERC20( _token ).safeTransferFrom( msg.sender, address(this), _amount );
if ( isReserveToken[ _token ] ) {
require( isReserveDepositor[ msg.sender ], "Not approved" );
} else {
require( isLiquidityDepositor[ msg.sender ], "Not approved" );
}
uint value = valueOf( _token, _amount );
send_ = value.sub( _profit );
totalReserves = totalReserves.add( value );
emit Deposit( _token, _amount, value, send_ );
}
function withdraw( uint _amount, address _token ) external {
require( isReserveToken[ _token ], "Not accepted" ); // Only reserves can be used for redemptions
require( isReserveSpender[ msg.sender ] == true, "Not approved" );
uint value = valueOf( _token, _amount );
IOHMERC20( OHM ).burnFrom( msg.sender, value );
totalReserves = totalReserves.sub( value );
IERC20( _token ).safeTransfer( msg.sender, _amount );
emit Withdrawal( _token, _amount, value );
}
function manage( address _token, uint _amount ) external {
if( isLiquidityToken[ _token ] ) {
require( isLiquidityManager[ msg.sender ], "Not approved" );
} else {
require( isReserveManager[ msg.sender ], "Not approved" );
}
uint value = valueOf( _token, _amount );
totalReserves = totalReserves.sub( value );
IERC20( _token ).safeTransfer( msg.sender, _amount );
}
function valueOf( address _token, uint _amount ) public view returns ( uint value_ ) {
if ( isReserveToken[ _token ] ) {
// convert amount to match OHM decimals
value_ = _amount.mul( 10 ** IERC20( OHM ).decimals() ).div( 10 ** IERC20( _token ).decimals() );
} else if ( isLiquidityToken[ _token ] ) {
value_ = IBondCalculator( bondCalculator[ _token ] ).valuation( _token, _amount );
}
}
enum MANAGING { RESERVEDEPOSITOR, RESERVESPENDER, RESERVETOKEN, RESERVEMANAGER, LIQUIDITYDEPOSITOR, LIQUIDITYTOKEN, LIQUIDITYMANAGER }
function toggle( MANAGING _managing, address _address, address _calculator ) external onlyPolicy() {
require( _address != address(0) );
if ( _managing == MANAGING.RESERVEDEPOSITOR ) { // 0
isReserveDepositor[ _address ] = !isReserveDepositor[ _address ];
} else if ( _managing == MANAGING.RESERVESPENDER ) { // 1
isReserveSpender[ _address ] = !isReserveSpender[ _address ];
} else if ( _managing == MANAGING.RESERVETOKEN ) { // 2
isReserveToken[ _address ] = !isReserveToken[ _address ];
} else if ( _managing == MANAGING.RESERVEMANAGER ) { // 3
isReserveManager[ _address ] = !isReserveManager[ _address ];
} else if ( _managing == MANAGING.LIQUIDITYDEPOSITOR ) { // 4
isLiquidityDepositor[ _address ] = !isLiquidityDepositor[ _address ];
} else if ( _managing == MANAGING.LIQUIDITYTOKEN ) { // 5
isLiquidityToken[ _address ] = !isLiquidityToken[ _address ];
bondCalculator[ _address ] = _calculator;
} else if ( _managing == MANAGING.LIQUIDITYMANAGER ) { // 6
isLiquidityManager[ _address ] = !isLiquidityManager[ _address ];
}
}
} | 0x608060405234801561001057600080fd5b50600436106101205760003560e01c806368c31dd5116100ad578063a6c41fec11610071578063a6c41fec146104fd578063bc157ac114610531578063df89b3441461059d578063ebd83cd8146105f7578063fbfd393b1461065157610120565b806368c31dd51461037757806387d67dff146103d15780638f840ddd1461042b578063a1210a2d14610449578063a569e571146104a357610120565b8063124154ca116100f4578063124154ca146101ff5780631af4da70146102595780631eec5a9a146102c757806346f68ee9146103295780635a96ac0a1461036d57610120565b8062f714ce146101255780630505c8c914610173578063089208d8146101a75780630b0eee30146101b1575b600080fd5b6101716004803603604081101561013b57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106c2565b005b61017b61099f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101af6109c8565b005b6101fd600480360360408110156101c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b47565b005b6102416004803603602081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d76565b60405180821515815260200191505060405180910390f35b61029b6004803603602081101561026f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d96565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610313600480360360408110156102dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b6040518082815260200191505060405180910390f35b61036b6004803603602081101561033f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110da565b005b6103756112df565b005b6103b96004803603602081101561038d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611485565b60405180821515815260200191505060405180910390f35b610413600480360360208110156103e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114a5565b60405180821515815260200191505060405180910390f35b6104336114c5565b6040518082815260200191505060405180910390f35b61048b6004803603602081101561045f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114cb565b60405180821515815260200191505060405180910390f35b6104e5600480360360208110156104b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114eb565b60405180821515815260200191505060405180910390f35b61050561150b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105876004803603606081101561054757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061152f565b6040518082815260200191505060405180910390f35b6105df600480360360208110156105b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118eb565b60405180821515815260200191505060405180910390f35b6106396004803603602081101561060d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061190b565b60405180821515815260200191505060405180910390f35b6106c06004803603606081101561066757600080fd5b81019080803560ff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061192b565b005b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610781576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f74206163636570746564000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420617070726f766564000000000000000000000000000000000000000081525060200191505060405180910390fd5b60006108538284610dc9565b90507f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff166379cc679033836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156108e657600080fd5b505af11580156108fa573d6000803e3d6000fd5b5050505061091381600a5461202290919063ffffffff16565b600a8190555061094433848473ffffffffffffffffffffffffffffffffffffffff1661206c9092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff167fdf273cb619d95419a9cd0ec88123a0538c85064229baa6363788f743fff90deb8483604051808381526020018281526020019250505060405180910390a2505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba60405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c5d57600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610c58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420617070726f766564000000000000000000000000000000000000000081525060200191505060405180910390fd5b610d1d565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420617070726f766564000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b6000610d298383610dc9565b9050610d4081600a5461202290919063ffffffff16565b600a81905550610d7133838573ffffffffffffffffffffffffffffffffffffffff1661206c9092919063ffffffff16565b505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60096020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f7557610f6e8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6657600080fd5b505afa158015610e7a573d6000803e3d6000fd5b505050506040513d6020811015610e9057600080fd5b810190808051906020019092919050505060ff16600a0a610f607f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1057600080fd5b505afa158015610f24573d6000803e3d6000fd5b505050506040513d6020811015610f3a57600080fd5b810190808051906020019092919050505060ff16600a0a8561210e90919063ffffffff16565b61219490919063ffffffff16565b90506110d4565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110d357600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634249719f84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b15801561109557600080fd5b505afa1580156110a9573d6000803e3d6000fd5b505050506040513d60208110156110bf57600080fd5b810190808051906020019092919050505090505b5b92915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461119b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611221576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806127ce6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba60405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611385576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806127f46022913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167faa151555690c956fc3ea32f106bb9f119b5237a061eaa8557cff3e51e3792c8d60405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60026020528060005260406000206000915054906101000a900460ff1681565b60046020528060005260406000206000915054906101000a900460ff1681565b600a5481565b60076020528060005260406000206000915054906101000a900460ff1681565b60066020528060005260406000206000915054906101000a900460ff1681565b7f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89981565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806115d25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b611644576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f74206163636570746564000000000000000000000000000000000000000081525060200191505060405180910390fd5b6116713330868673ffffffffffffffffffffffffffffffffffffffff166121de909392919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561178757600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611782576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420617070726f766564000000000000000000000000000000000000000081525060200191505060405180910390fd5b611847565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611846576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420617070726f766564000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b60006118538486610dc9565b9050611868838261202290919063ffffffff16565b915061187f81600a5461229f90919063ffffffff16565b600a819055508373ffffffffffffffffffffffffffffffffffffffff167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e86838560405180848152602001838152602001828152602001935050505060405180910390a2509392505050565b60086020528060005260406000206000915054906101000a900460ff1681565b60056020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a2657600080fd5b60006006811115611a3357fe5b836006811115611a3f57fe5b1415611aee57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061201d565b60016006811115611afb57fe5b836006811115611b0757fe5b1415611bb657600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061201c565b60026006811115611bc357fe5b836006811115611bcf57fe5b1415611c7e57600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061201b565b60036006811115611c8b57fe5b836006811115611c9757fe5b1415611d4657600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061201a565b60046006811115611d5357fe5b836006811115611d5f57fe5b1415611e0e57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612019565b60056006811115611e1b57fe5b836006811115611e2757fe5b1415611f5457600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612018565b600680811115611f6057fe5b836006811115611f6c57fe5b141561201757600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b5b5b5b5b505050565b600061206483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612327565b905092915050565b6121098363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123e7565b505050565b600080831415612121576000905061218e565b600082840290508284828161213257fe5b0414612189576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806128166021913960400191505060405180910390fd5b809150505b92915050565b60006121d683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124d6565b905092915050565b612299846323b872dd60e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506123e7565b50505050565b60008082840190508381101561231d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906123d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561239957808201518184015260208101905061237e565b50505050905090810190601f1680156123c65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6060612449826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661259c9092919063ffffffff16565b90506000815111156124d15780806020019051602081101561246a57600080fd5b81019080805190602001909291905050506124d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612837602a913960400191505060405180910390fd5b5b505050565b60008083118290612582576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561254757808201518184015260208101905061252c565b50505050905090810190601f1680156125745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161258e57fe5b049050809150509392505050565b60606125ab84846000856125b4565b90509392505050565b60606125bf856127ba565b612631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612681578051825260208201915060208101905060208303925061265e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146126e3576040519150601f19603f3d011682016040523d82523d6000602084013e6126e8565b606091505b509150915081156126fd5780925050506127b2565b6000815111156127105780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561277757808201518184015260208101905061275c565b50505050905090810190601f1680156127a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b949350505050565b600080823b90506000811191505091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206d757374206265206e6577206f776e657220746f2070756c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122063a2134ff0c8322af179e206050051b06ef5fa174f1d8aa13eae15589c450e6064736f6c63430007050033 | {"success": true, "error": null, "results": {}} | 1,544 |
0x9ca5bf963ec0f9d314b68e9bc17bba57f7053331 | pragma solidity ^0.4.16;
/**
* @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 {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title PoSTokenStandard
* @dev the interface of PoSTokenStandard
*/
contract PoSTokenStandard {
uint256 public stakeStartTime;
uint256 public stakeMinAge;
uint256 public stakeMaxAge;
function mint() returns (bool);
function coinAge() constant returns (uint256);
function annualInterest() constant returns (uint256);
event Mint(address indexed _address, uint _reward);
}
contract Fulcrum is ERC20, PoSTokenStandard, Ownable {
using SafeMath for uint256;
string public name = "Fulcrum";
string public symbol = "FLC";
uint public decimals = 18;
uint public chainStartTime; // chain start time
uint public chainStartBlockNumber; // chain start block number
uint public stakeStartTime; // stake start time
uint public stakeMinAge = 10 days; // minimum age for coin age: 3D
uint public stakeMaxAge = 30 days; // stake age of full weight: 90D
uint public maxMintProofOfStake = 10**17; // default 10% annual interest
uint public totalSupply;
uint public maxTotalSupply;
uint public totalInitialSupply;
struct transferInStruct{
uint128 amount;
uint64 time;
}
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
mapping(address => transferInStruct[]) transferIns;
event Burn(address indexed burner, uint256 value);
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
function Fulcrum() {
maxTotalSupply = 69.6*10**25; // 696 Mil.
totalInitialSupply = 39.6*10**25; // 396 Mil.
chainStartTime = now;
chainStartBlockNumber = block.number;
balances[msg.sender] = totalInitialSupply;
totalSupply = totalInitialSupply;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) returns (bool) {
if(msg.sender == _to) return mint();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) returns (bool) {
require(_to != address(0));
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
if(transferIns[_from].length > 0) delete transferIns[_from];
uint64 _now = uint64(now);
transferIns[_from].push(transferInStruct(uint128(balances[_from]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function approve(address _spender, uint256 _value) returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function mint() canPoSMint returns (bool) {
if(balances[msg.sender] <= 0) return false;
if(transferIns[msg.sender].length <= 0) return false;
uint reward = getProofOfStakeReward(msg.sender);
if(reward <= 0) return false;
totalSupply = totalSupply.add(reward);
balances[msg.sender] = balances[msg.sender].add(reward);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
Mint(msg.sender, reward);
return true;
}
function getBlockNumber() returns (uint blockNumber) {
blockNumber = block.number.sub(chainStartBlockNumber);
}
function coinAge() constant returns (uint myCoinAge) {
myCoinAge = getCoinAge(msg.sender,now);
}
function annualInterest() constant returns(uint interest) {
interest = maxMintProofOfStake;
}
function getProofOfStakeReward(address _address) internal returns (uint) {
require( (now >= stakeStartTime) && (stakeStartTime > 0) );
uint _now = now;
uint _coinAge = getCoinAge(_address, _now);
if(_coinAge <= 0) return 0;
uint interest = maxMintProofOfStake;
return (_coinAge * interest).div(365 * (10**decimals));
}
function getCoinAge(address _address, uint _now) internal returns (uint _coinAge) {
if(transferIns[_address].length <= 0) return 0;
for (uint i = 0; i < transferIns[_address].length; i++){
if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue;
uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time));
if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge;
_coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days));
}
}
function ownerSetStakeStartTime(uint timestamp) onlyOwner {
require((stakeStartTime <= 0) && (timestamp >= chainStartTime));
stakeStartTime = timestamp;
}
function ownerBurnToken(uint _value) onlyOwner {
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
totalSupply = totalSupply.sub(_value);
totalInitialSupply = totalInitialSupply.sub(_value);
maxTotalSupply = maxTotalSupply.sub(_value*10);
Burn(msg.sender, _value);
}
/* Batch token transfer. Used by contract creator to distribute initial tokens to holders */
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
uint64 _now = uint64(now);
for(uint j = 0; j < _recipients.length; j++){
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
transferIns[_recipients[j]].push(transferInStruct(uint128(_values[j]),_now));
Transfer(msg.sender, _recipients[j], _values[j]);
}
balances[msg.sender] = balances[msg.sender].sub(total);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
if(balances[msg.sender] > 0) transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
return true;
}
} | 0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610159578063095ea7b3146101e75780631249c58b1461024157806318160ddd1461026e5780631e1b13c01461029757806323b872dd146102c05780632a9edf6f146103395780632ab4d0521461035c578063313ce5671461038557806342cbb15c146103ae5780635b054f9b146103d757806370a08231146104005780637419f1901461044d57806388d695b2146104765780638da5cb5b1461052857806390762a8b1461057d57806395d89b41146105a05780639fd4da401461062e578063a9059cbb14610657578063b2552fc4146106b1578063cbd8877e146106da578063cd474b0414610703578063dd62ed3e1461072c578063e1c3bac614610798578063f2bb5ce1146107c1578063f2fde38b146107ea575b600080fd5b341561016457600080fd5b61016c610823565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ac578082015181840152602081019050610191565b50505050905090810190601f1680156101d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f257600080fd5b610227600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108c1565b604051808215151515815260200191505060405180910390f35b341561024c57600080fd5b610254610a48565b604051808215151515815260200191505060405180910390f35b341561027957600080fd5b610281610db8565b6040518082815260200191505060405180910390f35b34156102a257600080fd5b6102aa610dbe565b6040518082815260200191505060405180910390f35b34156102cb57600080fd5b61031f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dcf565b604051808215151515815260200191505060405180910390f35b341561034457600080fd5b61035a60048080359060200190919050506113ba565b005b341561036757600080fd5b61036f611440565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398611446565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c161144c565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b6103ea611468565b6040518082815260200191505060405180910390f35b341561040b57600080fd5b610437600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061146e565b6040518082815260200191505060405180910390f35b341561045857600080fd5b6104606114b7565b6040518082815260200191505060405180910390f35b341561048157600080fd5b61050e600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506114bd565b604051808215151515815260200191505060405180910390f35b341561053357600080fd5b61053b611b5c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058857600080fd5b61059e6004808035906020019091905050611b82565b005b34156105ab57600080fd5b6105b3611eb6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105f35780820151818401526020810190506105d8565b50505050905090810190601f1680156106205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561063957600080fd5b610641611f54565b6040518082815260200191505060405180910390f35b341561066257600080fd5b610697600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611f5a565b604051808215151515815260200191505060405180910390f35b34156106bc57600080fd5b6106c4612437565b6040518082815260200191505060405180910390f35b34156106e557600080fd5b6106ed612441565b6040518082815260200191505060405180910390f35b341561070e57600080fd5b610716612447565b6040518082815260200191505060405180910390f35b341561073757600080fd5b610782600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061244d565b6040518082815260200191505060405180910390f35b34156107a357600080fd5b6107ab6124d4565b6040518082815260200191505060405180910390f35b34156107cc57600080fd5b6107d46124da565b6040518082815260200191505060405180910390f35b34156107f557600080fd5b610821600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506124e0565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b95780601f1061088e576101008083540402835291602001916108b9565b820191906000526020600020905b81548152906001019060200180831161089c57829003601f168201915b505050505081565b60008082148061094d57506000601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561095857600080fd5b81601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600080600f54600e54101515610a5d57600080fd5b6000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610aaf5760009150610db4565b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050111515610b045760009150610db4565b610b0d336125bc565b9050600081111515610b225760009150610db4565b610b3781600e5461263190919063ffffffff16565b600e81905550610b8f81601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263190919063ffffffff16565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c1d919061292c565b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806001018281610c6e919061294d565b916000526020600020900160006040805190810160405280601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546fffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050503373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a2600191505b5090565b600e5481565b6000610dca334261264f565b905090565b6000806000606060048101600036905010151515610dec57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614151515610e2857600080fd5b601260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250610ef985601160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f890919063ffffffff16565b601160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f8e85601160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263190919063ffffffff16565b601160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fe485846128f890919063ffffffff16565b601260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a36000601360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050111561116057601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061115f919061292c565b5b429150601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060010182816111b4919061294d565b916000526020600020900160006040805190810160405280601160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050601360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060010182816112f8919061294d565b916000526020600020900160006040805190810160405280896fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050600193505050509392505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141657600080fd5b6000600a541115801561142b57506008548110155b151561143657600080fd5b80600a8190555050565b600f5481565b60075481565b6000611463600954436128f890919063ffffffff16565b905090565b60085481565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a5481565b6000806000806000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561152157600080fd5b60008751118015611533575085518751145b151561153e57600080fd5b60009350600092505b85518310156115895761157a868481518110151561156157fe5b906020019060200201518561263190919063ffffffff16565b93508280600101935050611547565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484111515156115d757600080fd5b429150600090505b86518110156118955761166886828151811015156115f957fe5b90602001906020020151601160008a8581518110151561161557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263190919063ffffffff16565b60116000898481518110151561167a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506013600088838151811015156116d457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480600101828161172a919061294d565b9160005260206000209001600060408051908101604052808a8681518110151561175057fe5b906020019060200201516fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050868181518110151561180357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef888481518110151561186957fe5b906020019060200201516040518082815260200191505060405180910390a380806001019150506115df565b6118e784601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f890919063ffffffff16565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011156119c157601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006119c0919061292c565b5b6000601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611b4e57601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806001018281611a5a919061294d565b916000526020600020900160006040805190810160405280601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050505b600194505050505092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bde57600080fd5b600081111515611bed57600080fd5b611c3f81601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f890919063ffffffff16565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000611ccd919061292c565b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806001018281611d1e919061294d565b916000526020600020900160006040805190810160405280601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546fffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050611e2681600e546128f890919063ffffffff16565b600e81905550611e41816010546128f890919063ffffffff16565b601081905550611e5f600a8202600f546128f890919063ffffffff16565b600f819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a250565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f4c5780601f10611f2157610100808354040283529160200191611f4c565b820191906000526020600020905b815481529060010190602001808311611f2f57829003601f168201915b505050505081565b60105481565b600080604060048101600036905010151515611f7557600080fd5b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611fb857611fb1610a48565b925061242f565b61200a84601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128f890919063ffffffff16565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061209f84601160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263190919063ffffffff16565b601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011156121de57601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006121dd919061292c565b5b429150601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806001018281612232919061294d565b916000526020600020900160006040805190810160405280601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050601360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806001018281612376919061294d565b916000526020600020900160006040805190810160405280886fffffffffffffffffffffffffffffffff1681526020018667ffffffffffffffff16815250909190915060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050600192505b505092915050565b6000600d54905090565b600b5481565b60095481565b6000601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600c5481565b600d5481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561253c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561257857600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600a5442101580156125d657506000600a54115b15156125e157600080fd5b4292506125ee858461264f565b91506000821115156126035760009350612629565b600d549050612626600754600a0a61016d0282840261291190919063ffffffff16565b93505b505050919050565b600080828401905083811015151561264557fe5b8091505092915050565b600080600080601360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490501115156126a857600092506128f0565b600091505b601360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508210156128ef57612784600b54601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110151561274957fe5b906000526020600020900160000160109054906101000a900467ffffffffffffffff1667ffffffffffffffff1661263190919063ffffffff16565b841015612790576128e2565b61281b601360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811015156127df57fe5b906000526020600020900160000160109054906101000a900467ffffffffffffffff1667ffffffffffffffff16856128f890919063ffffffff16565b9050600c5481111561282d57600c5490505b6128df612846620151808361291190919063ffffffff16565b601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110151561289257fe5b906000526020600020900160000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16028461263190919063ffffffff16565b92505b81806001019250506126ad565b5b505092915050565b600082821115151561290657fe5b818303905092915050565b600080828481151561291f57fe5b0490508091505092915050565b508054600082559060005260206000209081019061294a9190612979565b50565b815481835581811511612974578183600052602060002091820191016129739190612979565b5b505050565b6129d391905b808211156129cf57600080820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a81549067ffffffffffffffff02191690555060010161297f565b5090565b905600a165627a7a7230582098fd65f5b8592e19ac367492e36a29d0adaf3e776fbcc9744d31c72d8878db870029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,545 |
0x53f25a7f433fb622e53093d0055ccd2f5636a7eb | /**
*Submitted for verification at Etherscan.io on 2020-11-02
*/
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256){
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b,"Calculation error");
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,"Calculation error");
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,"Calculation error");
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,"Calculation error");
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,"Calculation error");
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
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 Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
/**
* @title Layerx Contract For ERC20 Tokens
* @dev LAYERX tokens as per ERC20 Standards
*/
contract Layerx is IERC20, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
uint public ethToNextStake = 0;
uint stakeNum = 0;
uint constant CAP = 1000000000000000000;
uint constant CAP_R = 100000000;
uint constant DAYMILLI = 86400;
uint amtByDay = 27397260274000000000;
address public stakeCreator;
address[] private activeHolders;
bool isPaused = false;
struct Stake {
uint start;
uint end;
uint layerLockedTotal;
uint layerxReward;
uint ethReward;
}
struct StakeHolder {
uint layerLocked;
uint id;
}
struct Rewards {
uint layersx;
uint eth;
bool isReceived;
}
event logLockedTokens(address holder, uint amountLocked, uint stakeId);
event logUnlockedTokens(address holder, uint amountUnlocked);
event logNewStakePayment(uint id, uint amount);
event logWithdraw(address holder, uint layerx, uint eth, uint stakeId);
modifier paused {
require(isPaused == false, "This contract was paused by the owner!");
_;
}
modifier exist (uint index) {
require(index <= stakeNum, 'This stake does not exist.');
_;
}
mapping (address => StakeHolder) public stakeHolders;
mapping (address => mapping (uint => Rewards)) public rewards;
mapping (uint => Stake) public stakes;
mapping (address => uint) balances;
mapping (address => mapping(address => uint)) allowed;
IERC20 UNILAYER = IERC20(0x0fF6ffcFDa92c53F615a4A75D982f399C989366b);
constructor(address _owner) public {
owner = _owner;
stakeCreator = owner;
symbol = "LAYERX";
name = "UNILAYERX";
decimals = 18;
_totalSupply = 40000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
stakes[0] = Stake(now, 0, 0, 0, 0);
}
/**
* @dev Total number of tokens in existence.
*/
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
/**
* @dev Gets the balance of the specified address.
* @param tokenOwner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public onlyOwner {
require(value > 0, "Invalid Amount.");
require(_totalSupply >= value, "Invalid account state.");
require(balances[owner] >= value, "Invalid account balances state.");
_totalSupply = _totalSupply.sub(value);
balances[owner] = balances[owner].sub(value);
emit Transfer(owner, address(0), value);
}
/**
* @dev Set new Stake Creator address.
* @param _stakeCreator The address of the new Stake Creator.
*/
function setNewStakeCreator(address _stakeCreator) external onlyOwner {
require(_stakeCreator != address(0), 'Do not use 0 address');
stakeCreator = _stakeCreator;
}
/**
* @dev Set new pause status.
* @param newIsPaused The pause status: 0 - not paused, 1 - paused.
*/
function setIsPaused(bool newIsPaused) external onlyOwner {
isPaused = newIsPaused;
}
/**
* @dev Remove holder from the list of active holders.
* @param holder that must be removed.
*/
function removeHolder(StakeHolder memory holder) internal {
uint openId = holder.id;
address openWallet = activeHolders[openId];
if(activeHolders.length > 1) {
uint lastId = activeHolders.length-1;
address lastWallet = activeHolders[lastId];
StakeHolder memory lastHolder = stakeHolders[lastWallet];
lastHolder.id = openId;
stakeHolders[lastWallet] = lastHolder;
activeHolders[openId] = lastWallet;
}
activeHolders.pop();
holder.id = 0;
stakeHolders[openWallet] = holder;
}
/**
* @dev Stake LAYER tokens for earning rewards, Tokens will be deducted from message sender account
* @param payment Amount of LAYER to be staked in the pool
*/
function lock(uint payment) external paused {
require(payment > 0, 'Payment must be greater than 0.');
require(UNILAYER.balanceOf(msg.sender) >= payment, 'Holder does not have enough tokens.');
UNILAYER.transferFrom(msg.sender, address(this), payment);
StakeHolder memory holder = stakeHolders[msg.sender];
if(holder.layerLocked == 0) {
uint holderId = activeHolders.length;
activeHolders.push(msg.sender);
holder.id = holderId;
}
holder.layerLocked = holder.layerLocked.add(payment);
Stake memory stake = stakes[stakeNum];
stake.layerLockedTotal = stake.layerLockedTotal.add(payment);
stakeHolders[msg.sender] = holder;
stakes[stakeNum] = stake;
emit logLockedTokens(msg.sender, payment, stakeNum);
}
/**
* @dev Withdraw My Staked Tokens from staker pool
*/
function unlock() external paused {
StakeHolder memory holder = stakeHolders[msg.sender];
uint amt = holder.layerLocked;
require(amt > 0, 'You do not have locked tokens.');
require(UNILAYER.balanceOf(address(this)) >= amt, 'Insufficient account balance!');
Stake memory stake = stakes[stakeNum];
require(stake.end == 0, 'Invalid date for unlock, please use withdraw.');
stake.layerLockedTotal = stake.layerLockedTotal.sub(amt);
stakes[stakeNum] = stake;
holder.layerLocked = 0;
stakeHolders[msg.sender] = holder;
removeHolder(holder);
UNILAYER.transfer(msg.sender, amt);
emit logUnlockedTokens(msg.sender, amt);
}
/**
* @dev Stake Creator finalizes the stake, the stake receives the accumulated ETH as reward and calculates everyone's percentages.
*/
function addStakePayment() external {
require(msg.sender == stakeCreator, 'You cannot call this function');
Stake memory stake = stakes[stakeNum];
stake.end = now;
stake.ethReward = stake.ethReward.add(ethToNextStake);
ethToNextStake = 0;
uint days_passed = stake.end.sub(stake.start).mul(CAP_R).div(DAYMILLI);
uint amtLayerx = days_passed.mul(amtByDay).div(CAP_R);
if(amtLayerx > balances[owner]) { amtLayerx = balances[owner]; }
stake.layerxReward = stake.layerxReward.add(amtLayerx);
for(uint i = 0; i < activeHolders.length; i++) {
StakeHolder memory holder = stakeHolders[activeHolders[i]];
uint rate = holder.layerLocked.mul(CAP).div(stake.layerLockedTotal);
rewards[activeHolders[i]][stakeNum].layersx = amtLayerx.mul(rate).div(CAP);
rewards[activeHolders[i]][stakeNum].eth = stake.ethReward.mul(rate).div(CAP);
}
stakes[stakeNum] = stake;
emit logNewStakePayment(stakeNum, ethToNextStake);
stakeNum++;
stakes[stakeNum] = Stake(now, 0, stake.layerLockedTotal, 0, 0);
}
/**
* @dev Withdraw Reward Layerx Tokens and ETH
* @param index Stake index
*/
function withdraw(uint index) external paused exist(index) {
Rewards memory rwds = rewards[msg.sender][index];
Stake memory stake = stakes[index];
require(stake.end <= now, 'Invalid date for withdrawal.');
require(rwds.isReceived == false, 'You already withdrawal your rewards.');
require(balances[owner] >= rwds.layersx, 'Insufficient account balance!');
require(address(this).balance >= rwds.eth,'Invalid account state, not enough funds.');
if(rwds.layersx > 0) {
balances[owner] = balances[owner].sub(rwds.layersx);
balances[msg.sender] = balances[msg.sender].add(rwds.layersx);
emit Transfer(owner, msg.sender, rwds.layersx);
}
if(rwds.eth > 0) {
msg.sender.transfer(rwds.eth);
}
rwds.isReceived = true;
rewards[msg.sender][index] = rwds;
emit logWithdraw(msg.sender, rwds.layersx, rwds.eth, index);
}
/**
* @dev Function to get the number of stakes
* @return number of stakes
*/
function getStakesNum() external view returns (uint) {
return stakeNum+1;
}
/**
* @dev Receive ETH and add value to the accumulated eth for stake
*/
function() external payable {
ethToNextStake = ethToNextStake.add(msg.value);
}
} | 0x6080604052600436106101665760003560e01c8063a69df4b5116100d1578063dd4670641161008a578063ea40450e11610064578063ea40450e146106a2578063eba39ef5146106b7578063f20d76be146106cc578063f2fde38b146106e157610166565b8063dd467064146105f1578063dd62ed3e1461061b578063e26ff10a1461065657610166565b8063a69df4b514610418578063a9059cbb1461042d578063b933ceac14610466578063cae9ca51146104bf578063d5a44f8614610587578063d73531b9146105dc57610166565b80632e1a7d4d116101235780632e1a7d4d14610320578063313ce5671461034a57806342966c681461037557806370a082311461039f5780638da5cb5b146103d257806395d89b411461040357610166565b806305e55e221461017e57806306fdde03146101b3578063095ea7b31461023d57806318160ddd1461028a57806323b872dd146102b1578063240976bf146102f4575b600554610179903463ffffffff61071416565b600555005b34801561018a57600080fd5b506101b1600480360360208110156101a157600080fd5b50356001600160a01b031661076b565b005b3480156101bf57600080fd5b506101c86107f6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102025781810151838201526020016101ea565b50505050905090810190601f16801561022f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024957600080fd5b506102766004803603604081101561026057600080fd5b506001600160a01b038135169060200135610881565b604080519115158252519081900360200190f35b34801561029657600080fd5b5061029f6108e7565b60408051918252519081900360200190f35b3480156102bd57600080fd5b50610276600480360360608110156102d457600080fd5b506001600160a01b0381358116916020810135909116906040013561092a565b34801561030057600080fd5b506101b16004803603602081101561031757600080fd5b50351515610a23565b34801561032c57600080fd5b506101b16004803603602081101561034357600080fd5b5035610a4d565b34801561035657600080fd5b5061035f610e48565b6040805160ff9092168252519081900360200190f35b34801561038157600080fd5b506101b16004803603602081101561039857600080fd5b5035610e51565b3480156103ab57600080fd5b5061029f600480360360208110156103c257600080fd5b50356001600160a01b0316610ff5565b3480156103de57600080fd5b506103e7611010565b604080516001600160a01b039092168252519081900360200190f35b34801561040f57600080fd5b506101c861101f565b34801561042457600080fd5b506101b1611079565b34801561043957600080fd5b506102766004803603604081101561045057600080fd5b506001600160a01b0381351690602001356113d9565b34801561047257600080fd5b5061049f6004803603604081101561048957600080fd5b506001600160a01b038135169060200135611477565b604080519384526020840192909252151582820152519081900360600190f35b3480156104cb57600080fd5b50610276600480360360608110156104e257600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561051257600080fd5b82018360208201111561052457600080fd5b8035906020019184600183028401116401000000008311171561054657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506114a6945050505050565b34801561059357600080fd5b506105b1600480360360208110156105aa57600080fd5b50356115ee565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b3480156105e857600080fd5b506103e761161d565b3480156105fd57600080fd5b506101b16004803603602081101561061457600080fd5b503561162c565b34801561062757600080fd5b5061029f6004803603604081101561063e57600080fd5b506001600160a01b038135811691602001351661199f565b34801561066257600080fd5b506106896004803603602081101561067957600080fd5b50356001600160a01b03166119ca565b6040805192835260208301919091528051918290030190f35b3480156106ae57600080fd5b5061029f6119e3565b3480156106c357600080fd5b5061029f6119ec565b3480156106d857600080fd5b506101b16119f2565b3480156106ed57600080fd5b506101b16004803603602081101561070457600080fd5b50356001600160a01b0316611dd0565b600082820183811015610762576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b90505b92915050565b6000546001600160a01b0316331461078257600080fd5b6001600160a01b0381166107d4576040805162461bcd60e51b8152602060048201526014602482015273446f206e6f74207573652030206164647265737360601b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156108795780601f1061084e57610100808354040283529160200191610879565b820191906000526020600020905b81548152906001019060200180831161085c57829003601f168201915b505050505081565b336000818152600f602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000808052600e6020527fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c546004546109259163ffffffff611e8716565b905090565b6001600160a01b0383166000908152600e6020526040812054610953908363ffffffff611e8716565b6001600160a01b0385166000908152600e6020908152604080832093909355600f815282822033835290522054610990908363ffffffff611e8716565b6001600160a01b038086166000908152600f602090815260408083203384528252808320949094559186168152600e90915220546109d4908363ffffffff61071416565b6001600160a01b038085166000818152600e6020908152604091829020949094558051868152905191939288169260008051602061218183398151915292918290030190a35060019392505050565b6000546001600160a01b03163314610a3a57600080fd5b600a805460ff1916911515919091179055565b600a5460ff1615610a8f5760405162461bcd60e51b815260040180806020018281038252602681526020018061221a6026913960400191505060405180910390fd5b80600654811115610ae7576040805162461bcd60e51b815260206004820152601a60248201527f54686973207374616b6520646f6573206e6f742065786973742e000000000000604482015290519081900360640190fd5b610aef6120ee565b50336000908152600c602090815260408083208584528252918290208251606081018452815481526001820154928101929092526002015460ff16151591810191909152610b3b612111565b506000838152600d6020908152604091829020825160a08101845281548152600182015492810183905260028201549381019390935260038101546060840152600401546080830152421015610bd8576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206461746520666f72207769746864726177616c2e00000000604482015290519081900360640190fd5b604082015115610c195760405162461bcd60e51b81526004018080602001828103825260248152602001806121a16024913960400191505060405180910390fd5b8151600080546001600160a01b03168152600e60205260409020541015610c87576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e74206163636f756e742062616c616e636521000000604482015290519081900360640190fd5b8160200151471015610cca5760405162461bcd60e51b81526004018080602001828103825260288152602001806121f26028913960400191505060405180910390fd5b815115610d79578151600080546001600160a01b03168152600e6020526040902054610cfb9163ffffffff611e8716565b600080546001600160a01b03168152600e602052604080822092909255835133825291902054610d309163ffffffff61071416565b336000818152600e6020908152604080832094909455905485518451908152935192936001600160a01b0390911692600080516020612181833981519152929181900390910190a35b602082015115610db5576020820151604051339180156108fc02916000818181858888f19350505050158015610db3573d6000803e3d6000fd5b505b60016040838101828152336000818152600c60209081528482208a835281529084902087518082558289015196820187905593516002909101805460ff191691151591909117905583519182528101919091528082019290925260608201869052517f77ba55cea52637902d444be011a3d69dcdf1cc0e412c38d3f936ae2aad7b013f916080908290030190a150505050565b60035460ff1681565b6000546001600160a01b03163314610e6857600080fd5b60008111610eaf576040805162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21020b6b7bab73a1760891b604482015290519081900360640190fd5b806004541015610eff576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b21030b1b1b7bab73a1039ba30ba329760511b604482015290519081900360640190fd5b600080546001600160a01b03168152600e6020526040902054811115610f6c576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c6964206163636f756e742062616c616e6365732073746174652e00604482015290519081900360640190fd5b600454610f7f908263ffffffff611e8716565b600455600080546001600160a01b03168152600e6020526040902054610fab908263ffffffff611e8716565b600080546001600160a01b039081168252600e602090815260408084209490945582548451868152945193949216926000805160206121818339815191529281900390910190a350565b6001600160a01b03166000908152600e602052604090205490565b6000546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108795780601f1061084e57610100808354040283529160200191610879565b600a5460ff16156110bb5760405162461bcd60e51b815260040180806020018281038252602681526020018061221a6026913960400191505060405180910390fd5b6110c3612140565b50336000908152600b6020908152604091829020825180840190935280548084526001909101549183019190915280611143576040805162461bcd60e51b815260206004820152601e60248201527f596f7520646f206e6f742068617665206c6f636b656420746f6b656e732e0000604482015290519081900360640190fd5b601054604080516370a0823160e01b8152306004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561118d57600080fd5b505afa1580156111a1573d6000803e3d6000fd5b505050506040513d60208110156111b757600080fd5b5051101561120c576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e74206163636f756e742062616c616e636521000000604482015290519081900360640190fd5b611214612111565b506006546000908152600d6020908152604091829020825160a081018452815481526001820154928101839052600282015493810193909352600381015460608401526004015460808301521561129c5760405162461bcd60e51b815260040180806020018281038252602d8152602001806121c5602d913960400191505060405180910390fd5b60408101516112b1908363ffffffff611e8716565b60408083019182526006546000908152600d6020908152828220855181558186015160018083019190915594516002820155606086015160038201556080860151600490910155818752338252600b8152919020855181559085015191015561131983611ed8565b6010546040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561136d57600080fd5b505af1158015611381573d6000803e3d6000fd5b505050506040513d602081101561139757600080fd5b5050604080513381526020810184905281517f1e1c7315f93a6e1b6bfe0e451712d9bbed8801b4181d6b6156ac15cfdec52317929181900390910190a1505050565b336000908152600e60205260408120546113f9908363ffffffff611e8716565b336000908152600e6020526040808220929092556001600160a01b0385168152205461142b908363ffffffff61071416565b6001600160a01b0384166000818152600e60209081526040918290209390935580518581529051919233926000805160206121818339815191529281900390910190a350600192915050565b600c60209081526000928352604080842090915290825290208054600182015460029092015490919060ff1683565b336000818152600f602090815260408083206001600160a01b038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a3604051638f4ffcb160e01b815233600482018181526024830186905230604484018190526080606485019081528651608486015286516001600160a01b038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b8381101561157d578181015183820152602001611565565b50505050905090810190601f1680156115aa5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b506001979650505050505050565b600d60205260009081526040902080546001820154600283015460038401546004909401549293919290919085565b6008546001600160a01b031681565b600a5460ff161561166e5760405162461bcd60e51b815260040180806020018281038252602681526020018061221a6026913960400191505060405180910390fd5b600081116116c3576040805162461bcd60e51b815260206004820152601f60248201527f5061796d656e74206d7573742062652067726561746572207468616e20302e00604482015290519081900360640190fd5b601054604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561170d57600080fd5b505afa158015611721573d6000803e3d6000fd5b505050506040513d602081101561173757600080fd5b505110156117765760405162461bcd60e51b81526004018080602001828103825260238152602001806122406023913960400191505060405180910390fd5b601054604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b505050506040513d60208110156117fa57600080fd5b506118059050612140565b50336000908152600b6020908152604091829020825180840190935280548084526001909101549183019190915261188057600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180546001600160a01b0319163317905560208201525b8051611892908363ffffffff61071416565b815261189c612111565b506006546000908152600d6020908152604091829020825160a08101845281548152600182015492810192909252600281015492820183905260038101546060830152600401546080820152906118f9908463ffffffff61071416565b6040808301918252336000818152600b60209081528382208751815581880151600191820155600680548452600d8352928590208751815582880151918101919091559451600286015560608087015160038701556080870151600490960195909555905483519283529082018790528183015290517f2ee996d27bca8b62e571470f16dbf7738e6fb7b30525d09904e20647f863edd2929181900390910190a1505050565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205490565b600b602052600090815260409020805460019091015482565b60065460010190565b60055481565b6008546001600160a01b03163314611a51576040805162461bcd60e51b815260206004820152601d60248201527f596f752063616e6e6f742063616c6c20746869732066756e6374696f6e000000604482015290519081900360640190fd5b611a59612111565b506006546000908152600d6020908152604091829020825160a081018452815481526002820154938101939093526003810154606084015260040154608083018190524291830191909152600554611ab7919063ffffffff61071416565b60808201526000600581905581516020830151611b04916201518091611af8916305f5e10091611aec9163ffffffff611e8716565b9063ffffffff61202d16565b9063ffffffff61209016565b90506000611b256305f5e100611af86007548561202d90919063ffffffff16565b600080546001600160a01b03168152600e6020526040902054909150811115611b635750600080546001600160a01b03168152600e60205260409020545b6060830151611b78908263ffffffff61071416565b606084015260005b600954811015611ce457611b92612140565b600b600060098481548110611ba357fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812082518084018452815480825260019290920154948101949094529188015192935091611c0891611af890670de0b6b3a764000063ffffffff61202d16565b9050611c26670de0b6b3a7640000611af8868463ffffffff61202d16565b600c600060098681548110611c3757fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060065482529092529020556080860151611c8c90670de0b6b3a764000090611af8908463ffffffff61202d16565b600c600060098681548110611c9d57fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812060065482529092529020600190810191909155929092019150611b809050565b50600680546000908152600d602090815260409182902086518155818701516001820155828701516002820155606087015160038201556080870151600490910155915460055482519182529281019290925280517fd1b6b1ffebabe406cdd91d77a18826f8cc1b35e378a6e042b48524ea86b906f69281900390910190a15050600680546001908101918290556040805160a08101825242815260006020808301828152968401518385019081526060840183815260808501848152978452600d90925293909120915182559451928101929092555160028201559151600383015551600490910155565b6000546001600160a01b03163314611de757600080fd5b6001600160a01b038116611e2c5760405162461bcd60e51b815260040180806020018281038252602681526020018061215b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082821115611ed2576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b50900390565b600081602001519050600060098281548110611ef057fe5b6000918252602090912001546009546001600160a01b03909116915060011015611fce576009805460001981019160009183908110611f2b57fe5b6000918252602090912001546001600160a01b03169050611f4a612140565b506001600160a01b0381166000818152600b602081815260408084208151808301909252805482528183018a8152959094529190528051825591516001909101556009805483919087908110611f9c57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050505b6009805480611fd957fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092558481018281526001600160a01b03939093168252600b90526040902092518355516001929092019190915550565b60008261203c57506000610765565b8282028284828161204957fe5b0414610762576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b60008082116120da576040805162461bcd60e51b815260206004820152601160248201527021b0b631bab630ba34b7b71032b93937b960791b604482015290519081900360640190fd5b60008284816120e557fe5b04949350505050565b604051806060016040528060008152602001600081526020016000151581525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef596f7520616c7265616479207769746864726177616c20796f757220726577617264732e496e76616c6964206461746520666f7220756e6c6f636b2c20706c65617365207573652077697468647261772e496e76616c6964206163636f756e742073746174652c206e6f7420656e6f7567682066756e64732e5468697320636f6e7472616374207761732070617573656420627920746865206f776e657221486f6c64657220646f6573206e6f74206861766520656e6f75676820746f6b656e732ea265627a7a7231582064d6a045903f113eb10883052bb72c4e3d605a18ee6ed3fe6baef53a66dd833764736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,546 |
0x375ad9a4415d2ec6467000836e3086f53159f2cc | /**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212206661f190da7bb2cb2dc6c1b9d8f8a69b6023dfda77cfcd761e2512ce3e91d5d264736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,547 |
0x1d6b371b0d23d169e87db2fc14ab34f82d190988 | pragma solidity ^0.4.24;
// _____ _ _ _ _____ _
// / ____| | (_) | | | __ \ | |
// | | | |__ _ ___| | _____ _ __ | |__) |_ _ _ __| | __
// | | | '_ \| |/ __| |/ / _ \ '_ \ | ___/ _` | '__| |/ /
// | |____| | | | | (__| < __/ | | | | | | (_| | | | <
// \_____|_| |_|_|\___|_|\_\___|_| |_| |_| \__,_|_| |_|\_\
// ------- What? -------
//A home for blockchain games.
// ------- How? -------
//Buy CKN Token before playing any games.
//You can buy & sell CKN in this contract at anytime and anywhere.
//As the amount of ETH in the contract increases to 10,000, the dividend will gradually drop to 2%.
//We got 4 phase in the Roadmap, will launch Plasma chain in the phase 2.
// ------- How? -------
//10/2018 SIMPLE E-SPORT
//11/2018 SPORT PREDICTION
//02/2019 MOBILE GAME
//06/2019 MMORPG
// ------- Who? -------
//Only 1/10 smarter than vitalik.
//<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="adccc9c0c4c3edcec5c4cec6c8c3ddccdfc683c4c2">[email protected]</a>
//Sometime we think plama is a Pseudo topic, but it's a only way to speed up the TPS.
//And Everybody will also trust the Node & Result.
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b)
internal
pure
returns (uint256 c)
{
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath mul failed");
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
require(b <= a, "SafeMath sub failed");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b)
internal
pure
returns (uint256 c)
{
c = a + b;
require(c >= a, "SafeMath add failed");
return c;
}
/**
* @dev gives square root of given x.
*/
function sqrt(uint256 x)
internal
pure
returns (uint256 y)
{
uint256 z = ((add(x,1)) / 2);
y = x;
while (z < y)
{
y = z;
z = ((add((x / z),z)) / 2);
}
}
/**
* @dev gives square. multiplies x by x
*/
function sq(uint256 x)
internal
pure
returns (uint256)
{
return (mul(x,x));
}
/**
* @dev x to the power of y
*/
function pwr(uint256 x, uint256 y)
internal
pure
returns (uint256)
{
if (x==0)
return (0);
else if (y==0)
return (1);
else
{
uint256 z = x;
for (uint256 i=1; i < y; i++)
z = mul(z,x);
return (z);
}
}
}
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data)public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
contract ChickenPark is Owned{
using SafeMath for *;
modifier notContract() {
require (msg.sender == tx.origin);
_;
}
event Transfer(
address indexed from,
address indexed to,
uint tokens
);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint tokens
);
event CKNPrice(
address indexed who,
uint prePrice,
uint afterPrice,
uint ethValue,
uint token,
uint timestamp,
string action
);
event Withdraw(
address indexed who,
uint dividents
);
/*=====================================
= CONSTANTS =
=====================================*/
uint8 constant public decimals = 18;
uint constant internal tokenPriceInitial_ = 0.00001 ether;
uint constant internal magnitude = 2**64;
/*================================
= CONFIGURABLES =
================================*/
string public name = "Chicken Park Coin";
string public symbol = "CKN";
/*================================
= DATASETS =
================================*/
// Tracks Token
mapping(address => uint) internal balances;
mapping(address => mapping (address => uint))public allowed;
// Payout tracking
mapping(address => uint) public referralBalance_;
mapping(address => int256) public payoutsTo_;
uint256 public profitPerShare_ = 0;
// Token
uint internal tokenSupply = 0;
// Sub Contract
address public marketAddress;
address public gameAddress;
/*================================
= FUNCTION =
================================*/
constructor() public {
}
function totalSupply() public view returns (uint) {
return tokenSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner` CKN
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Get the referral balance for account `tokenOwner` ETH
// ------------------------------------------------------------------------
function referralBalanceOf(address tokenOwner) public view returns(uint){
return referralBalance_[tokenOwner];
}
function setMarket(address add) public onlyOwner{
marketAddress = add;
}
function setGame(address add) public onlyOwner{
gameAddress = add;
}
// ------------------------------------------------------------------------
// ERC20 Basic Function: Transfer CKN Token
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
require(balances[msg.sender] >= tokens);
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] - int(tokens.mul(profitPerShare_)/1e18);
payoutsTo_[to] = payoutsTo_[to] + int(tokens.mul(profitPerShare_)/1e18);
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(tokens <= balances[from] && tokens <= allowed[from][msg.sender]);
payoutsTo_[from] = payoutsTo_[from] - int(tokens.mul(profitPerShare_)/1e18);
payoutsTo_[to] = payoutsTo_[to] + int(tokens.mul(profitPerShare_)/1e18);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Buy Chicken Park Coin, 1% for me, 1% for chicken market, 19.6 ~ 0% for dividents
// ------------------------------------------------------------------------
function buyChickenParkCoin(address referedAddress) notContract() public payable{
uint fee = msg.value.mul(2)/100;
owner.transfer(fee/2);
marketAddress.transfer(fee/2);
uint realBuy = msg.value.sub(fee).mul((1e20).sub(calculateDivi()))/1e20;
uint divMoney = msg.value.sub(realBuy).sub(fee);
if(referedAddress != msg.sender && referedAddress != address(0)){
uint referralMoney = divMoney/10;
referralBalance_[referedAddress] = referralBalance_[referedAddress].add(referralMoney);
divMoney = divMoney.sub(referralMoney);
}
uint tokenAdd = getBuy(realBuy);
uint price1 = getCKNPriceNow();
tokenSupply = tokenSupply.add(tokenAdd);
payoutsTo_[msg.sender] += (int256)(profitPerShare_.mul(tokenAdd)/1e18);
profitPerShare_ = profitPerShare_.add(divMoney.mul(1e18)/totalSupply());
balances[msg.sender] = balances[msg.sender].add(tokenAdd);
uint price2 = getCKNPriceNow();
emit CKNPrice(msg.sender,price1,price2,msg.value,tokenAdd,now,"BUY");
}
// ------------------------------------------------------------------------
// Sell Chicken Park Coin, 1% for me, 1% for chicken market, 19.6 ~ 0% for dividents
// ------------------------------------------------------------------------
function sellChickenParkCoin(uint tokenAnount) notContract() public {
uint tokenSub = tokenAnount;
uint sellEther = getSell(tokenSub);
uint price1 = getCKNPriceNow();
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] - int(tokenSub.mul(profitPerShare_)/1e18);
tokenSupply = tokenSupply.sub(tokenSub);
balances[msg.sender] = balances[msg.sender].sub(tokenSub);
uint diviTo = sellEther.mul(calculateDivi())/1e20;
if(totalSupply()>0){
profitPerShare_ = profitPerShare_.add(diviTo.mul(1e18)/totalSupply());
}else{
owner.transfer(diviTo);
}
owner.transfer(sellEther.mul(1)/100);
marketAddress.transfer(sellEther.mul(1)/100);
msg.sender.transfer((sellEther.mul(98)/(100)).sub(diviTo));
uint price2 = getCKNPriceNow();
emit CKNPrice(msg.sender,price1,price2,sellEther,tokenSub,now,"SELL");
}
// ------------------------------------------------------------------------
// Withdraw your ETH dividents from Referral & CKN Dividents
// ------------------------------------------------------------------------
function withdraw() notContract() public {
require(myDividends(true)>0);
uint dividents_ = uint(getDividents()).add(referralBalance_[msg.sender]);
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] + int(getDividents());
referralBalance_[msg.sender] = 0;
msg.sender.transfer(dividents_);
emit Withdraw(msg.sender, dividents_);
}
// ------------------------------------------------------------------------
// ERC223 Transfer CKN Token With Data Function
// ------------------------------------------------------------------------
function transferTo (address _from, address _to, uint _amountOfTokens, bytes _data) public {
if (_from != msg.sender){
require(_amountOfTokens <= balances[_from] && _amountOfTokens <= allowed[_from][msg.sender]);
}
else{
require(_amountOfTokens <= balances[_from]);
}
transferFromInternal(_from, _to, _amountOfTokens, _data);
}
function transferFromInternal(address _from, address _toAddress, uint _amountOfTokens, bytes _data) internal
{
require(_toAddress != address(0x0));
address _customerAddress = _from;
if (_customerAddress != msg.sender){
// Update the allowed balance.
// Don't update this if we are transferring our own tokens (via transfer or buyAndTransfer)
allowed[_customerAddress][msg.sender] = allowed[_customerAddress][msg.sender].sub(_amountOfTokens);
}
// Exchange tokens
balances[_customerAddress] = balances[_customerAddress].sub(_amountOfTokens);
balances[_toAddress] = balances[_toAddress].add(_amountOfTokens);
// Update dividend trackers
payoutsTo_[_customerAddress] -= (int256)(profitPerShare_.mul(_amountOfTokens)/1e18);
payoutsTo_[_toAddress] += (int256)(profitPerShare_.mul(_amountOfTokens)/1e18);
uint length;
assembly {
length := extcodesize(_toAddress)
}
if (length > 0){
// its a contract
// note: at ethereum update ALL addresses are contracts
ERC223ReceivingContract receiver = ERC223ReceivingContract(_toAddress);
receiver.tokenFallback(_from, _amountOfTokens, _data);
}
// Fire logging event.
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
}
function getCKNPriceNow() public view returns(uint){
return (tokenPriceInitial_.mul(1e18+totalSupply()/100000000))/(1e18);
}
function getBuy(uint eth) public view returns(uint){
return ((((1e36).add(totalSupply().sq()/1e16).add(totalSupply().mul(2).mul(1e10)).add(eth.mul(1e28).mul(2)/tokenPriceInitial_)).sqrt()).sub(1e18).sub(totalSupply()/1e8)).mul(1e8);
}
function calculateDivi()public view returns(uint){
if(totalSupply() < 4e26){
uint diviRate = (20e18).sub(totalSupply().mul(5)/1e8);
return diviRate;
} else {
return 0;
}
}
function getSell(uint token) public view returns(uint){
return tokenPriceInitial_.mul((1e18).add((totalSupply().sub(token/2))/100000000)).mul(token)/(1e36);
}
function myDividends(bool _includeReferralBonus) public view returns(uint256)
{
address _customerAddress = msg.sender;
return _includeReferralBonus ? getDividents().add(referralBalance_[_customerAddress]) : getDividents() ;
}
function getDividents() public view returns(uint){
require(int((balances[msg.sender].mul(profitPerShare_)/1e18))-(payoutsTo_[msg.sender])>=0);
return uint(int((balances[msg.sender].mul(profitPerShare_)/1e18))-(payoutsTo_[msg.sender]));
}
} | 0x6080604052600436106101a05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101a5578063095ea7b31461022f57806318160ddd1461026757806319fb361f1461028e57806323b872dd146102ff578063313ce567146103295780633c774dbb146103545780633ccfd60b14610368578063465346491461037d5780635c6581651461039e578063688abbf7146103c55780636dcea85f146103df57806370a0823114610400578063710b318b1461042157806379ba5097146104365780637a9df8c01461044b578063819912a214610463578063843a7f74146104845780638da5cb5b1461049957806395623641146104ca57806395d89b41146104df578063a168d873146104f4578063a9059cbb14610509578063c664f7f11461052d578063cae9ca511461054e578063d1f2f971146105b7578063d4ee1d90146105cc578063dd62ed3e146105e1578063dde4a70b14610608578063e1456cb414610620578063f28d253d14610641578063f2fde38b14610656578063f32a547c14610677575b600080fd5b3480156101b157600080fd5b506101ba61068f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f45781810151838201526020016101dc565b50505050905090810190601f1680156102215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023b57600080fd5b50610253600160a060020a036004351660243561071a565b604080519115158252519081900360200190f35b34801561027357600080fd5b5061027c610781565b60408051918252519081900360200190f35b34801561029a57600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102fd94600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506107c49650505050505050565b005b34801561030b57600080fd5b50610253600160a060020a0360043581169060243516604435610866565b34801561033557600080fd5b5061033e610a4d565b6040805160ff9092168252519081900360200190f35b6102fd600160a060020a0360043516610a52565b34801561037457600080fd5b506102fd610d6b565b34801561038957600080fd5b5061027c600160a060020a0360043516610e4a565b3480156103aa57600080fd5b5061027c600160a060020a0360043581169060243516610e65565b3480156103d157600080fd5b5061027c6004351515610e82565b3480156103eb57600080fd5b506102fd600160a060020a0360043516610ec5565b34801561040c57600080fd5b5061027c600160a060020a0360043516610f0b565b34801561042d57600080fd5b5061027c610f26565b34801561044257600080fd5b506102fd610f2c565b34801561045757600080fd5b506102fd600435610fb4565b34801561046f57600080fd5b506102fd600160a060020a03600435166112ab565b34801561049057600080fd5b5061027c6112f1565b3480156104a557600080fd5b506104ae611343565b60408051600160a060020a039092168252519081900360200190f35b3480156104d657600080fd5b506104ae611352565b3480156104eb57600080fd5b506101ba611361565b34801561050057600080fd5b506104ae6113bc565b34801561051557600080fd5b50610253600160a060020a03600435166024356113cb565b34801561053957600080fd5b5061027c600160a060020a036004351661151a565b34801561055a57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610253948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061152c9650505050505050565b3480156105c357600080fd5b5061027c61168d565b3480156105d857600080fd5b506104ae6116f4565b3480156105ed57600080fd5b5061027c600160a060020a0360043581169060243516611703565b34801561061457600080fd5b5061027c60043561172e565b34801561062c57600080fd5b5061027c600160a060020a03600435166117a1565b34801561064d57600080fd5b5061027c6117b3565b34801561066257600080fd5b506102fd600160a060020a036004351661184b565b34801561068357600080fd5b5061027c600435611891565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107125780601f106106e757610100808354040283529160200191610712565b820191906000526020600020905b8154815290600101906020018083116106f557829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600080805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546009546107bf9163ffffffff61195716565b905090565b600160a060020a038416331461082f57600160a060020a038416600090815260046020526040902054821180159061081f5750600160a060020a03841660009081526005602090815260408083203384529091529020548211155b151561082a57600080fd5b610854565b600160a060020a03841660009081526004602052604090205482111561085457600080fd5b610860848484846119ce565b50505050565b600160a060020a03831660009081526004602052604081205482118015906108b15750600160a060020a03841660009081526005602090815260408083203384529091529020548211155b15156108bc57600080fd5b670de0b6b3a76400006108da60085484611cad90919063ffffffff16565b8115156108e357fe5b600160a060020a03861660009081526007602052604090208054929091049091039055600854670de0b6b3a76400009061092490849063ffffffff611cad16565b81151561092d57fe5b600160a060020a03858116600090815260076020908152604080832080549690950490950190935590871681526004909152205461096b9083611957565b600160a060020a03851660009081526004602090815260408083209390935560058152828220338352905220546109a8908363ffffffff61195716565b600160a060020a0380861660009081526005602090815260408083203384528252808320949094559186168152600490915220546109ec908363ffffffff611d3b16565b600160a060020a0380851660008181526004602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b601281565b6000808080808080333214610a6657600080fd5b6064610a7934600263ffffffff611cad16565b811515610a8257fe5b6000549190049750600160a060020a03166108fc600289049081150290604051600060405180830381858888f19350505050158015610ac5573d6000803e3d6000fd5b50600a54604051600160a060020a03909116906002890480156108fc02916000818181858888f19350505050158015610b02573d6000803e3d6000fd5b5068056bc75e2d63100000610b4d610b31610b1b61168d565b68056bc75e2d631000009063ffffffff61195716565b610b41348b63ffffffff61195716565b9063ffffffff611cad16565b811515610b5657fe5b049550610b7987610b6d348963ffffffff61195716565b9063ffffffff61195716565b9450600160a060020a0388163314801590610b9c5750600160a060020a03881615155b15610bf657600160a060020a038816600090815260066020526040902054600a86049450610bca9085611d3b565b600160a060020a038916600090815260066020526040902055610bf3858563ffffffff61195716565b94505b610bff86611891565b9250610c096112f1565b600954909250610c1f908463ffffffff611d3b16565b600955600854670de0b6b3a764000090610c3f908563ffffffff611cad16565b811515610c4857fe5b3360009081526007602052604090208054929091049091019055610c9f610c6d610781565b610c8587670de0b6b3a764000063ffffffff611cad16565b811515610c8e57fe5b60085491900463ffffffff611d3b16565b60085533600090815260046020526040902054610cc2908463ffffffff611d3b16565b33600090815260046020526040902055610cda6112f1565b604080518481526020810183905234818301526060810186905242608082015260c060a082018190526003908201527f425559000000000000000000000000000000000000000000000000000000000060e0820152905191925033917fc21fe061f20452b681f10868698c3166931a5e72af15bfde8f6d9cb855670d76918190036101000190a25050505050505050565b6000333214610d7957600080fd5b6000610d856001610e82565b11610d8f57600080fd5b33600090815260066020526040902054610db790610dab6117b3565b9063ffffffff611d3b16565b9050610dc16117b3565b336000818152600760209081526040808320805495909501909455600690528281208190559151909183156108fc02918491818181858888f19350505050158015610e10573d6000803e3d6000fd5b5060408051828152905133917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a250565b600160a060020a031660009081526006602052604090205490565b600560209081526000928352604080842090915290825290205481565b60003382610e9757610e926117b3565b610ebc565b600160a060020a038116600090815260066020526040902054610ebc90610dab6117b3565b91505b50919050565b600054600160a060020a03163314610edc57600080fd5b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a031660009081526004602052604090205490565b60085481565b600154600160a060020a03163314610f4357600080fd5b60015460008054604051600160a060020a0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600080808080333214610fc657600080fd5b859450610fd28561172e565b9350610fdc6112f1565b9250670de0b6b3a7640000610ffc60085487611cad90919063ffffffff16565b81151561100557fe5b3360009081526007602052604090208054929091049091039055600954611032908663ffffffff61195716565b60095533600090815260046020526040902054611055908663ffffffff61195716565b3360009081526004602052604090205568056bc75e2d6310000061108761107a61168d565b869063ffffffff611cad16565b81151561109057fe5b049150600061109d610781565b11156110ce576110c66110ae610781565b610c8584670de0b6b3a764000063ffffffff611cad16565b600855611109565b60008054604051600160a060020a039091169184156108fc02918591818181858888f19350505050158015611107573d6000803e3d6000fd5b505b600054600160a060020a03166108fc606461112b87600163ffffffff611cad16565b81151561113457fe5b049081150290604051600060405180830381858888f19350505050158015611160573d6000803e3d6000fd5b50600a54600160a060020a03166108fc606461118387600163ffffffff611cad16565b81151561118c57fe5b049081150290604051600060405180830381858888f193505050501580156111b8573d6000803e3d6000fd5b50336108fc6111ea8460646111d489606263ffffffff611cad16565b8115156111dd57fe5b049063ffffffff61195716565b6040518115909202916000818181858888f19350505050158015611212573d6000803e3d6000fd5b5061121b6112f1565b60408051858152602081018390528082018790526060810188905242608082015260c060a082018190526004908201527f53454c4c0000000000000000000000000000000000000000000000000000000060e0820152905191925033917fc21fe061f20452b681f10868698c3166931a5e72af15bfde8f6d9cb855670d76918190036101000190a2505050505050565b600054600160a060020a031633146112c257600080fd5b600b805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000670de0b6b3a76400006113346305f5e10061130c610781565b81151561131557fe5b6509184e72a00091670de0b6b3a764000091040163ffffffff611cad16565b81151561133d57fe5b04905090565b600054600160a060020a031681565b600a54600160a060020a031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107125780601f106106e757610100808354040283529160200191610712565b600b54600160a060020a031681565b336000908152600460205260408120548211156113e757600080fd5b670de0b6b3a764000061140560085484611cad90919063ffffffff16565b81151561140e57fe5b3360009081526007602052604090208054929091049091039055600854670de0b6b3a76400009061144690849063ffffffff611cad16565b81151561144f57fe5b600160a060020a03851660009081526007602090815260408083208054959094049094019092553381526004909152205461148a9083611957565b3360009081526004602052604080822092909255600160a060020a038516815220546114bc908363ffffffff611d3b16565b600160a060020a0384166000818152600460209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60066020526000908152604090205481565b336000818152600560209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a36040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b8381101561161c578181015183820152602001611604565b50505050905090810190601f1680156116495780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561166b57600080fd5b505af115801561167f573d6000803e3d6000fd5b506001979650505050505050565b6000806b014adf4b7320334b900000006116a5610781565b10156116eb576116e16305f5e1006116c06005610b41610781565b8115156116c957fe5b6801158e460913d0000091900463ffffffff61195716565b90508091506116f0565b600091505b5090565b600154600160a060020a031681565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60006ec097ce7bc90715b34b9f100000000061179183610b4161177e6305f5e10061175e60028504610b6d610781565b81151561176757fe5b670de0b6b3a764000091900463ffffffff611d3b16565b6509184e72a0009063ffffffff611cad16565b81151561179a57fe5b0492915050565b60076020526000908152604090205481565b336000908152600760209081526040808320546008546004909352908320548392670de0b6b3a7640000916117ed9163ffffffff611cad16565b8115156117f657fe5b0403121561180357600080fd5b336000908152600760209081526040808320546008546004909352922054670de0b6b3a76400009161183b919063ffffffff611cad16565b81151561184457fe5b0403905090565b600054600160a060020a0316331461186257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600061077b6305f5e100610b416305f5e1006118ab610781565b8115156118b457fe5b04610b6d670de0b6b3a7640000816119526509184e72a0006118ed6002610b418d6b204fce5e3e2502611000000063ffffffff611cad16565b8115156118f657fe5b04610dab6119106402540be400610b416002610b41610781565b610dab662386f26fc1000061192b611926610781565b611dad565b81151561193457fe5b6ec097ce7bc90715b34b9f100000000091900463ffffffff611d3b16565b611db9565b6000828211156119c857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b60008080600160a060020a03861615156119e757600080fd5b869250600160a060020a0383163314611a5357600160a060020a0383166000908152600560209081526040808320338452909152902054611a2e908663ffffffff61195716565b600160a060020a03841660009081526005602090815260408083203384529091529020555b600160a060020a038316600090815260046020526040902054611a7c908663ffffffff61195716565b600160a060020a038085166000908152600460205260408082209390935590881681522054611ab1908663ffffffff611d3b16565b600160a060020a038716600090815260046020526040902055600854670de0b6b3a764000090611ae7908763ffffffff611cad16565b811515611af057fe5b600160a060020a03851660009081526007602052604090208054929091049091039055600854670de0b6b3a764000090611b30908763ffffffff611cad16565b811515611b3957fe5b600160a060020a03881660009081526007602052604081208054939092049092019055863b9250821115611c5957506040517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483019081526024830187905260606044840190815286516064850152865189949385169363c0ee0b8a938c938b938b9360840190602085019080838360005b83811015611bf2578181015183820152602001611bda565b50505050905090810190601f168015611c1f5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611c4057600080fd5b505af1158015611c54573d6000803e3d6000fd5b505050505b85600160a060020a031683600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a350505050505050565b6000821515611cbe5750600061077b565b50818102818382811515611cce57fe5b041461077b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b8181018281101561077b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b600061077b8283611cad565b6000806002611dc9846001611d3b565b811515611dd257fe5b0490508291505b81811015610ebf578091506002611dfb8285811515611df457fe5b0483611d3b565b811515611e0457fe5b049050611dd95600a165627a7a72305820f7e0dbb7ec464d9378843901ee18437caaf19e584956045c65a3a77cc43dee330029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,548 |
0xdf4ca2b011a977b9ea9734dc635c6d4c5c249859 | /*
https://t.me/Shibourier
* 100% liq to Community
* Locked liq and Renounced ownership
* 8% Reflection for holders
*/
// 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 ShibaCourier 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 = 10000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Shiba Courier | t.me/Shibourier";
string private constant _symbol = "Shibourier";
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(0x1f5d60E9978FD4a177005e989a1eaf565BC4C87B);
_feeAddrWallet2 = payable(0x1f5d60E9978FD4a177005e989a1eaf565BC4C87B);
_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 = 2;
_feeAddr2 = 8;
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 > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount/2);
_feeAddrWallet2.transfer(amount/2);
}
function maxtx(uint256 maxTxPercent) external {
require(_msgSender() == _feeAddrWallet1);
require(maxTxPercent > 0, "0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1000000000000 * 10**9;
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);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb14610311578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b806370a0823114610267578063715018a6146102a45780638da5cb5b146102bb57806395d89b41146102e6576100fe565b80632634e5e8116100c65780632634e5e8146101d3578063313ce567146101fc5780635932ead1146102275780636fc3eaec14610250576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612572565b60405180910390f35b34801561013a57600080fd5b506101556004803603810190610150919061213f565b6103f6565b6040516101629190612557565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d91906126b4565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906120f0565b610426565b6040516101ca9190612557565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f591906121cd565b6104ff565b005b34801561020857600080fd5b50610211610616565b60405161021e9190612729565b60405180910390f35b34801561023357600080fd5b5061024e6004803603810190610249919061217b565b61061f565b005b34801561025c57600080fd5b506102656106d1565b005b34801561027357600080fd5b5061028e60048036038101906102899190612062565b610743565b60405161029b91906126b4565b60405180910390f35b3480156102b057600080fd5b506102b9610794565b005b3480156102c757600080fd5b506102d06108e7565b6040516102dd9190612489565b60405180910390f35b3480156102f257600080fd5b506102fb610910565b6040516103089190612572565b60405180910390f35b34801561031d57600080fd5b506103386004803603810190610333919061213f565b61094d565b6040516103459190612557565b60405180910390f35b34801561035a57600080fd5b5061036361096b565b005b34801561037157600080fd5b5061037a6109e5565b005b34801561038857600080fd5b506103a3600480360381019061039e91906120b4565b610f43565b6040516103b091906126b4565b60405180910390f35b60606040518060400160405280601f81526020017f536869626120436f7572696572207c20742e6d652f536869626f757269657200815250905090565b600061040a610403610fca565b8484610fd2565b6001905092915050565b600069021e19e0c9bab2400000905090565b600061043384848461119d565b6104f48461043f610fca565b6104ef85604051806060016040528060288152602001612c2c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610fca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114729092919063ffffffff16565b610fd2565b600190509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610540610fca565b73ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600081116105a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059a90612594565b60405180910390fd5b6105d46127106105c68369021e19e0c9bab24000006114d690919063ffffffff16565b61155190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161060b91906126b4565b60405180910390a150565b60006009905090565b610627610fca565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ab90612634565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610712610fca565b73ffffffffffffffffffffffffffffffffffffffff161461073257600080fd5b60004790506107408161159b565b50565b600061078d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611688565b9050919050565b61079c610fca565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610829576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082090612634565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f536869626f757269657200000000000000000000000000000000000000000000815250905090565b600061096161095a610fca565b848461119d565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac610fca565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60006109d730610743565b90506109e2816116f6565b50565b6109ed610fca565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7190612634565b60405180910390fd5b600f60149054906101000a900460ff1615610aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac190612694565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b5b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669021e19e0c9bab2400000610fd2565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ba157600080fd5b505afa158015610bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd9919061208b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c3b57600080fd5b505afa158015610c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c73919061208b565b6040518363ffffffff1660e01b8152600401610c909291906124a4565b602060405180830381600087803b158015610caa57600080fd5b505af1158015610cbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce2919061208b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d6b30610743565b600080610d766108e7565b426040518863ffffffff1660e01b8152600401610d98969594939291906124f6565b6060604051808303818588803b158015610db157600080fd5b505af1158015610dc5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dea91906121f6565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550683635c9adc5dea000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610eed9291906124cd565b602060405180830381600087803b158015610f0757600080fd5b505af1158015610f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3f91906121a4565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611042576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103990612674565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a9906125d4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161119091906126b4565b60405180910390a3505050565b600081116111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d790612654565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561123757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611462576002600a819055506008600b81905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113255750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561137b5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156113935750600f60179054906101000a900460ff165b156113a8576010548111156113a757600080fd5b5b60006113b330610743565b9050600f60159054906101000a900460ff161580156114205750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114385750600f60169054906101000a900460ff165b1561146057611446816116f6565b6000479050600081111561145e5761145d4761159b565b5b505b505b61146d8383836119f0565b505050565b60008383111582906114ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b19190612572565b60405180910390fd5b50600083856114c9919061287a565b9050809150509392505050565b6000808314156114e9576000905061154b565b600082846114f79190612820565b905082848261150691906127ef565b14611546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153d90612614565b60405180910390fd5b809150505b92915050565b600061159383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a00565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002836115e491906127ef565b9081150290604051600060405180830381858888f1935050505015801561160f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60028361165991906127ef565b9081150290604051600060405180830381858888f19350505050158015611684573d6000803e3d6000fd5b5050565b60006008548211156116cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c6906125b4565b60405180910390fd5b60006116d9611a63565b90506116ee818461155190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611754577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117825781602001602082028036833780820191505090505b50905030816000815181106117c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561186257600080fd5b505afa158015611876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189a919061208b565b816001815181106118d4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061193b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610fd2565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161199f9594939291906126cf565b600060405180830381600087803b1580156119b957600080fd5b505af11580156119cd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6119fb838383611a8e565b505050565b60008083118290611a47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3e9190612572565b60405180910390fd5b5060008385611a5691906127ef565b9050809150509392505050565b6000806000611a70611c59565b91509150611a87818361155190919063ffffffff16565b9250505090565b600080600080600080611aa087611cbe565b955095509550955095509550611afe86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d2690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b9385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d7090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bdf81611dce565b611be98483611e8b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c4691906126b4565b60405180910390a3505050505050505050565b60008060006008549050600069021e19e0c9bab24000009050611c9169021e19e0c9bab240000060085461155190919063ffffffff16565b821015611cb15760085469021e19e0c9bab2400000935093505050611cba565b81819350935050505b9091565b6000806000806000806000806000611cdb8a600a54600b54611ec5565b9250925092506000611ceb611a63565b90506000806000611cfe8e878787611f5b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611d6883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611472565b905092915050565b6000808284611d7f9190612799565b905083811015611dc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbb906125f4565b60405180910390fd5b8091505092915050565b6000611dd8611a63565b90506000611def82846114d690919063ffffffff16565b9050611e4381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d7090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611ea082600854611d2690919063ffffffff16565b600881905550611ebb81600954611d7090919063ffffffff16565b6009819055505050565b600080600080611ef16064611ee3888a6114d690919063ffffffff16565b61155190919063ffffffff16565b90506000611f1b6064611f0d888b6114d690919063ffffffff16565b61155190919063ffffffff16565b90506000611f4482611f36858c611d2690919063ffffffff16565b611d2690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611f7485896114d690919063ffffffff16565b90506000611f8b86896114d690919063ffffffff16565b90506000611fa287896114d690919063ffffffff16565b90506000611fcb82611fbd8587611d2690919063ffffffff16565b611d2690919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050611ff381612be6565b92915050565b60008151905061200881612be6565b92915050565b60008135905061201d81612bfd565b92915050565b60008151905061203281612bfd565b92915050565b60008135905061204781612c14565b92915050565b60008151905061205c81612c14565b92915050565b60006020828403121561207457600080fd5b600061208284828501611fe4565b91505092915050565b60006020828403121561209d57600080fd5b60006120ab84828501611ff9565b91505092915050565b600080604083850312156120c757600080fd5b60006120d585828601611fe4565b92505060206120e685828601611fe4565b9150509250929050565b60008060006060848603121561210557600080fd5b600061211386828701611fe4565b935050602061212486828701611fe4565b925050604061213586828701612038565b9150509250925092565b6000806040838503121561215257600080fd5b600061216085828601611fe4565b925050602061217185828601612038565b9150509250929050565b60006020828403121561218d57600080fd5b600061219b8482850161200e565b91505092915050565b6000602082840312156121b657600080fd5b60006121c484828501612023565b91505092915050565b6000602082840312156121df57600080fd5b60006121ed84828501612038565b91505092915050565b60008060006060848603121561220b57600080fd5b60006122198682870161204d565b935050602061222a8682870161204d565b925050604061223b8682870161204d565b9150509250925092565b6000612251838361225d565b60208301905092915050565b612266816128ae565b82525050565b612275816128ae565b82525050565b600061228682612754565b6122908185612777565b935061229b83612744565b8060005b838110156122cc5781516122b38882612245565b97506122be8361276a565b92505060018101905061229f565b5085935050505092915050565b6122e2816128c0565b82525050565b6122f181612903565b82525050565b60006123028261275f565b61230c8185612788565b935061231c818560208601612915565b612325816129a6565b840191505092915050565b600061233d600183612788565b9150612348826129b7565b602082019050919050565b6000612360602a83612788565b915061236b826129e0565b604082019050919050565b6000612383602283612788565b915061238e82612a2f565b604082019050919050565b60006123a6601b83612788565b91506123b182612a7e565b602082019050919050565b60006123c9602183612788565b91506123d482612aa7565b604082019050919050565b60006123ec602083612788565b91506123f782612af6565b602082019050919050565b600061240f602983612788565b915061241a82612b1f565b604082019050919050565b6000612432602483612788565b915061243d82612b6e565b604082019050919050565b6000612455601783612788565b915061246082612bbd565b602082019050919050565b612474816128ec565b82525050565b612483816128f6565b82525050565b600060208201905061249e600083018461226c565b92915050565b60006040820190506124b9600083018561226c565b6124c6602083018461226c565b9392505050565b60006040820190506124e2600083018561226c565b6124ef602083018461246b565b9392505050565b600060c08201905061250b600083018961226c565b612518602083018861246b565b61252560408301876122e8565b61253260608301866122e8565b61253f608083018561226c565b61254c60a083018461246b565b979650505050505050565b600060208201905061256c60008301846122d9565b92915050565b6000602082019050818103600083015261258c81846122f7565b905092915050565b600060208201905081810360008301526125ad81612330565b9050919050565b600060208201905081810360008301526125cd81612353565b9050919050565b600060208201905081810360008301526125ed81612376565b9050919050565b6000602082019050818103600083015261260d81612399565b9050919050565b6000602082019050818103600083015261262d816123bc565b9050919050565b6000602082019050818103600083015261264d816123df565b9050919050565b6000602082019050818103600083015261266d81612402565b9050919050565b6000602082019050818103600083015261268d81612425565b9050919050565b600060208201905081810360008301526126ad81612448565b9050919050565b60006020820190506126c9600083018461246b565b92915050565b600060a0820190506126e4600083018861246b565b6126f160208301876122e8565b8181036040830152612703818661227b565b9050612712606083018561226c565b61271f608083018461246b565b9695505050505050565b600060208201905061273e600083018461247a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006127a4826128ec565b91506127af836128ec565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156127e4576127e3612948565b5b828201905092915050565b60006127fa826128ec565b9150612805836128ec565b92508261281557612814612977565b5b828204905092915050565b600061282b826128ec565b9150612836836128ec565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561286f5761286e612948565b5b828202905092915050565b6000612885826128ec565b9150612890836128ec565b9250828210156128a3576128a2612948565b5b828203905092915050565b60006128b9826128cc565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061290e826128ec565b9050919050565b60005b83811015612933578082015181840152602081019050612918565b83811115612942576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f3000000000000000000000000000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612bef816128ae565b8114612bfa57600080fd5b50565b612c06816128c0565b8114612c1157600080fd5b50565b612c1d816128ec565b8114612c2857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df6e3949a722b1c136e53b2c2d2ca3109b0d199f284e82333d596c4fdcf64d8b64736f6c63430008040033 | {"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"}]}} | 1,549 |
0x2fe0bc5ffb80a84739da913f0a393a4b0cce661b | pragma solidity 0.4.18;
library SafeMath {
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract QPay {
string public symbol="QPY";
string public name="QPay" ;
uint8 public constant decimals = 18;
uint256 _totalSupply = 0;
uint256 _FreeQPY = 1230;
uint256 _ML1 = 2;
uint256 _ML2 = 3;
uint256 _ML3 = 4;
uint256 _LimitML1 = 3e15;
uint256 _LimitML2 = 6e15;
uint256 _LimitML3 = 9e15;
uint256 _MaxDistribPublicSupply = 950000000;
uint256 _OwnerDistribSupply = 0;
uint256 _CurrentDistribPublicSupply = 0;
uint256 _ExtraTokensPerETHSended = 150000;
address _DistribFundsReceiverAddress = 0;
address _remainingTokensReceiverAddress = 0;
address owner = 0;
bool setupDone = false;
bool IsDistribRunning = false;
bool DistribStarted = false;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed _owner, uint256 _value);
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
mapping(address => bool) public Claimed;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function QPay() public {
owner = msg.sender;
}
function() public payable {
if (IsDistribRunning) {
uint256 _amount;
if (((_CurrentDistribPublicSupply + _amount) > _MaxDistribPublicSupply) && _MaxDistribPublicSupply > 0) revert();
if (!_DistribFundsReceiverAddress.send(msg.value)) revert();
if (Claimed[msg.sender] == false) {
_amount = _FreeQPY * 1e18;
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
Claimed[msg.sender] = true;
}
if (msg.value >= 9e15) {
_amount = msg.value * _ExtraTokensPerETHSended * 4;
} else {
if (msg.value >= 6e15) {
_amount = msg.value * _ExtraTokensPerETHSended * 3;
} else {
if (msg.value >= 3e15) {
_amount = msg.value * _ExtraTokensPerETHSended * 2;
} else {
_amount = msg.value * _ExtraTokensPerETHSended;
}
}
}
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
} else {
revert();
}
}
function SetupQPY(string tokenName, string tokenSymbol, uint256 ExtraTokensPerETHSended, uint256 MaxDistribPublicSupply, uint256 OwnerDistribSupply, address remainingTokensReceiverAddress, address DistribFundsReceiverAddress, uint256 FreeQPY) public {
if (msg.sender == owner && !setupDone) {
symbol = tokenSymbol;
name = tokenName;
_FreeQPY = FreeQPY;
_ExtraTokensPerETHSended = ExtraTokensPerETHSended;
_MaxDistribPublicSupply = MaxDistribPublicSupply * 1e18;
if (OwnerDistribSupply > 0) {
_OwnerDistribSupply = OwnerDistribSupply * 1e18;
_totalSupply = _OwnerDistribSupply;
balances[owner] = _totalSupply;
_CurrentDistribPublicSupply += _totalSupply;
Transfer(this, owner, _totalSupply);
}
_DistribFundsReceiverAddress = DistribFundsReceiverAddress;
if (_DistribFundsReceiverAddress == 0) _DistribFundsReceiverAddress = owner;
_remainingTokensReceiverAddress = remainingTokensReceiverAddress;
setupDone = true;
}
}
function SetupML(uint256 ML1inX, uint256 ML2inX, uint256 LimitML1inWei, uint256 LimitML2inWei) onlyOwner public {
_ML1 = ML1inX;
_ML2 = ML2inX;
_LimitML1 = LimitML1inWei;
_LimitML2 = LimitML2inWei;
}
function SetExtra(uint256 ExtraTokensPerETHSended) onlyOwner public {
_ExtraTokensPerETHSended = ExtraTokensPerETHSended;
}
function SetFreeQPY(uint256 FreeQPY) onlyOwner public {
_FreeQPY = FreeQPY;
}
function StartDistrib() public returns(bool success) {
if (msg.sender == owner && !DistribStarted && setupDone) {
DistribStarted = true;
IsDistribRunning = true;
} else {
revert();
}
return true;
}
function StopDistrib() public returns(bool success) {
if (msg.sender == owner && IsDistribRunning) {
if (_remainingTokensReceiverAddress != 0 && _MaxDistribPublicSupply > 0) {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
if (_remainingAmount > 0) {
balances[_remainingTokensReceiverAddress] += _remainingAmount;
_totalSupply += _remainingAmount;
Transfer(this, _remainingTokensReceiverAddress, _remainingAmount);
}
}
DistribStarted = false;
IsDistribRunning = false;
} else {
revert();
}
return true;
}
function distribution(address[] addresses, uint256 _amount) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
require(addresses.length <= 255);
require(_amount <= _remainingAmount);
_amount = _amount * 1e18;
for (uint i = 0; i < addresses.length; i++) {
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
}
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
uint256 _amount;
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
_amount = amounts[i] * 1e18;
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
}
function BurnTokens(uint256 amount) public returns(bool success) {
uint256 _amount = amount * 1e18;
if (balances[msg.sender] >= _amount) {
balances[msg.sender] -= _amount;
_totalSupply -= _amount;
Burn(msg.sender, _amount);
Transfer(msg.sender, 0, _amount);
} else {
revert();
}
return true;
}
function totalSupply() public constant returns(uint256 totalSupplyValue) {
return _totalSupply;
}
function MaxDistribPublicSupply_() public constant returns(uint256 MaxDistribPublicSupply) {
return _MaxDistribPublicSupply;
}
function OwnerDistribSupply_() public constant returns(uint256 OwnerDistribSupply) {
return _OwnerDistribSupply;
}
function CurrentDistribPublicSupply_() public constant returns(uint256 CurrentDistribPublicSupply) {
return _CurrentDistribPublicSupply;
}
function RemainingTokensReceiverAddress() public constant returns(address remainingTokensReceiverAddress) {
return _remainingTokensReceiverAddress;
}
function DistribFundsReceiverAddress() public constant returns(address DistribfundsReceiver) {
return _DistribFundsReceiverAddress;
}
function Owner() public constant returns(address ownerAddress) {
return owner;
}
function SetupDone() public constant returns(bool setupDoneFlag) {
return setupDone;
}
function IsDistribRunningFalg_() public constant returns(bool IsDistribRunningFalg) {
return IsDistribRunning;
}
function IsDistribStarted() public constant returns(bool IsDistribStartedFlag) {
return DistribStarted;
}
function balanceOf(address _owner) public constant returns(uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _amount) public 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;
}
}
function transferFrom(
address _from,
address _to,
uint256 _amount
) public 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;
}
}
function approve(address _spender, uint256 _amount) public returns(bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) public constant returns(uint256 remaining) {
return allowed[_owner][_spender];
}
} | 0x6060604052600436106101695763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610343578063095ea7b3146103cd57806318160ddd1461040357806318d69faa146104285780631d1cc6221461043b5780632092970f1461044e57806323b872dd146104615780632cd3fd7014610489578063313ce5671461049f5780634d9a81d4146104c857806370a08231146104db5780639275ddd7146104fa57806395d89b4114610512578063a8c310d514610525578063a9059cbb146105b4578063accbdfd0146105d6578063b449c24d146105e9578063b4a99a4e14610608578063becf917f14610637578063c21bbe561461064a578063c52cb0031461065d578063d21ceba014610670578063d4d42c9114610683578063d8489a81146106a2578063dd62ed3e146106b5578063f30faff6146106da578063f3e4877c146106f0578063fb28be7214610741575b60105460009060a860020a900460ff161561033b57600a5481600c540111801561019557506000600a54115b1561019f57600080fd5b600e54600160a060020a03163480156108fc0290604051600060405180830381858888f1935050505015156101d357600080fd5b600160a060020a03331660009081526013602052604090205460ff1615156102815750600354600c8054670de0b6b3a76400009092029182019055600160a060020a0333811660008181526011602052604090819020805485019055600280548501905590913016906000805160206113ad8339815191529084905190815260200160405180910390a3600160a060020a0333166000908152601360205260409020805460ff191660011790555b661ff973cafa8000341061029e57600d54340260040290506102df565b661550f7dca7000034106102bb57600d54340260030290506102df565b660aa87bee53800034106102d857600d54340260020290506102df565b50600d5434025b600c805482019055600160a060020a0333811660008181526011602052604090819020805485019055600280548501905590913016906000805160206113ad8339815191529084905190815260200160405180910390a3610340565b600080fd5b50005b341561034e57600080fd5b6103566107fc565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561039257808201518382015260200161037a565b50505050905090810190601f1680156103bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103d857600080fd5b6103ef600160a060020a036004351660243561089a565b604051901515815260200160405180910390f35b341561040e57600080fd5b610416610907565b60405190815260200160405180910390f35b341561043357600080fd5b6103ef61090e565b341561044657600080fd5b6104166109f3565b341561045957600080fd5b6103ef6109f9565b341561046c57600080fd5b6103ef600160a060020a0360043581169060243516604435610ab1565b341561049457600080fd5b6103ef600435610bba565b34156104aa57600080fd5b6104b2610c79565b60405160ff909116815260200160405180910390f35b34156104d357600080fd5b6103ef610c7e565b34156104e657600080fd5b610416600160a060020a0360043516610ca1565b341561050557600080fd5b610510600435610cbc565b005b341561051d57600080fd5b610356610cdc565b341561053057600080fd5b610510600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610d4795505050505050565b34156105bf57600080fd5b6103ef600160a060020a0360043516602435610ea7565b34156105e157600080fd5b6103ef610f5d565b34156105f457600080fd5b6103ef600160a060020a0360043516610f6d565b341561061357600080fd5b61061b610f82565b604051600160a060020a03909116815260200160405180910390f35b341561064257600080fd5b61061b610f91565b341561065557600080fd5b6103ef610fa0565b341561066857600080fd5b610416610fb0565b341561067b57600080fd5b61061b610fb6565b341561068e57600080fd5b610510600435602435604435606435610fc5565b34156106ad57600080fd5b610416610ff4565b34156106c057600080fd5b610416600160a060020a0360043581169060243516610ffa565b34156106e557600080fd5b610510600435611025565b34156106fb57600080fd5b6105106004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650509335935061104592505050565b341561074c57600080fd5b61051060046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650508435946020810135945060408101359350600160a060020a03606082013581169350608082013516915060a00135611180565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108925780601f1061086757610100808354040283529160200191610892565b820191906000526020600020905b81548152906001019060200180831161087557829003601f168201915b505050505081565b600160a060020a03338116600081815260126020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b6002545b90565b601054600090819033600160a060020a03908116911614801561093a575060105460a860020a900460ff165b1561033b57600f54600160a060020a03161580159061095b57506000600a54115b156109ca5750600c54600a540360008111156109ca57600f8054600160a060020a03908116600090815260116020526040908190208054850190556002805485019055915481169130909116906000805160206113ad8339815191529084905190815260200160405180910390a35b6010805476ffff00000000000000000000000000000000000000000019169055600191505b5090565b600c5490565b60105460009033600160a060020a039081169116148015610a375750601054760100000000000000000000000000000000000000000000900460ff16155b8015610a4c575060105460a060020a900460ff165b1561033b576010805475ff0000000000000000000000000000000000000000001976ff0000000000000000000000000000000000000000000019909116760100000000000000000000000000000000000000000000171660a860020a17905550600190565b600160a060020a038316600090815260116020526040812054829010801590610b015750600160a060020a0380851660009081526012602090815260408083203390941683529290522054829010155b8015610b0d5750600082115b8015610b325750600160a060020a038316600090815260116020526040902054828101115b15610baf57600160a060020a0380851660008181526011602081815260408084208054899003905560128252808420338716855282528084208054899003905594881680845291905290839020805486019055916000805160206113ad8339815191529085905190815260200160405180910390a3506001610bb3565b5060005b9392505050565b600160a060020a033316600090815260116020526040812054670de0b6b3a764000083029081901061033b57600160a060020a03331660008181526011602052604090819020805484900390556002805484900390557fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59083905190815260200160405180910390a2600033600160a060020a03166000805160206113ad8339815191528360405190815260200160405180910390a350600192915050565b601281565b601054760100000000000000000000000000000000000000000000900460ff1690565b600160a060020a031660009081526011602052604090205490565b60105433600160a060020a03908116911614610cd757600080fd5b600355565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108925780601f1061086757610100808354040283529160200191610892565b6010546000908190819033600160a060020a03908116911614610d6957600080fd5b600c54600a5403925060ff85511115610d8157600080fd5b8351855114610d8f57600080fd5b5060005b84518160ff161015610ea057838160ff1681518110610dae57fe5b90602001906020020151670de0b6b3a764000002915082821115610dd157600080fd5b600c80548301905581601160008760ff851681518110610ded57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000208054909101905560028054830190558460ff821681518110610e2e57fe5b90602001906020020151600160a060020a031630600160a060020a03166000805160206113ad8339815191528460405190815260200160405180910390a3600a54600c5410610e98576010805476ffff000000000000000000000000000000000000000000191690555b600101610d93565b5050505050565b600160a060020a033316600090815260116020526040812054829010801590610ed05750600082115b8015610ef55750600160a060020a038316600090815260116020526040902054828101115b15610f5557600160a060020a033381166000818152601160205260408082208054879003905592861680825290839020805486019055916000805160206113ad8339815191529085905190815260200160405180910390a3506001610901565b506000610901565b60105460a860020a900460ff1690565b60136020526000908152604090205460ff1681565b601054600160a060020a031690565b600e54600160a060020a031690565b60105460a060020a900460ff1690565b600b5490565b600f54600160a060020a031690565b60105433600160a060020a03908116911614610fe057600080fd5b600493909355600591909155600755600855565b600a5490565b600160a060020a03918216600090815260126020908152604080832093909416825291909152205490565b60105433600160a060020a0390811691161461104057600080fd5b600d55565b601054600090819033600160a060020a0390811691161461106557600080fd5b600c54600a5403915060ff8451111561107d57600080fd5b8183111561108a57600080fd5b50670de0b6b3a76400009091029060005b835181101561114e57818311156110b157600080fd5b600c80548401905582601160008684815181106110ca57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002080549091019055600280548401905583818151811061110857fe5b90602001906020020151600160a060020a031630600160a060020a03166000805160206113ad8339815191528560405190815260200160405180910390a360010161109b565b600a54600c541061117a576010805476ffff000000000000000000000000000000000000000000191690555b50505050565b60105433600160a060020a0390811691161480156111a8575060105460a060020a900460ff16155b156113145760008780516111c092916020019061131e565b5060018880516111d492916020019061131e565b506003819055600d869055670de0b6b3a76400008502600a55600084111561126057670de0b6b3a76400008402600b819055600281905560108054600160a060020a0390811660009081526011602052604090819020849055600c805485019055915481169230909116916000805160206113ad83398151915291905190815260200160405180910390a35b600e805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384811691909117918290551615156112c557601054600e805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b600f8054600160a060020a03851673ffffffffffffffffffffffffffffffffffffffff199091161790556010805474ff0000000000000000000000000000000000000000191660a060020a1790555b5050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061135f57805160ff191683800117855561138c565b8280016001018555821561138c579182015b8281111561138c578251825591602001919060010190611371565b506109ef9261090b9250905b808211156109ef57600081556001016113985600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058209ff61ed0fee41913350c4ff6e71c01bf2a7d8533192b7586fa5117b203279dce0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,550 |
0xc6ec2a151e8390a5ae56767b070e8d83687f9fc1 | // File: contracts/Sagittarius.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 SAGITTARIUS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Sagittarius";
string private constant _symbol = "SAGITTARIUS";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d5e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612888565b61045e565b6040516101789190612d43565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ee0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612835565b61048c565b6040516101e09190612d43565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061279b565b610565565b005b34801561021e57600080fd5b50610227610655565b6040516102349190612f55565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612911565b61065e565b005b34801561027257600080fd5b5061027b610710565b005b34801561028957600080fd5b506102a4600480360381019061029f919061279b565b610782565b6040516102b19190612ee0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d3565b005b3480156102dd57600080fd5b506102e6610926565b6040516102f39190612c75565b60405180910390f35b34801561030857600080fd5b5061031161094f565b60405161031e9190612d5e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612888565b61098c565b60405161035b9190612d43565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128c8565b6109aa565b005b34801561039957600080fd5b506103a2610ad4565b005b3480156103b057600080fd5b506103b9610b4e565b005b3480156103c757600080fd5b506103e260048036038101906103dd919061296b565b6110a9565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127f5565b6111f1565b6040516104189190612ee0565b60405180910390f35b60606040518060400160405280600b81526020017f5361676974746172697573000000000000000000000000000000000000000000815250905090565b600061047261046b611278565b8484611280565b6001905092915050565b6000670de0b6b3a7640000905090565b600061049984848461144b565b61055a846104a5611278565b6105558560405180606001604052806028815260200161363360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050b611278565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b039092919063ffffffff16565b611280565b600190509392505050565b61056d611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f190612e40565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610666611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612e40565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610751611278565b73ffffffffffffffffffffffffffffffffffffffff161461077157600080fd5b600047905061077f81611b67565b50565b60006107cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c62565b9050919050565b6107db611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085f90612e40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f5341474954544152495553000000000000000000000000000000000000000000815250905090565b60006109a0610999611278565b848461144b565b6001905092915050565b6109b2611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612e40565b60405180910390fd5b60005b8151811015610ad057600160066000848481518110610a6457610a6361329d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac8906131f6565b915050610a42565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b15611278565b73ffffffffffffffffffffffffffffffffffffffff1614610b3557600080fd5b6000610b4030610782565b9050610b4b81611cd0565b50565b610b56611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bda90612e40565b60405180910390fd5b601160149054906101000a900460ff1615610c33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2a90612ec0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611280565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0857600080fd5b505afa158015610d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4091906127c8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da257600080fd5b505afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda91906127c8565b6040518363ffffffff1660e01b8152600401610df7929190612c90565b602060405180830381600087803b158015610e1157600080fd5b505af1158015610e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4991906127c8565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed230610782565b600080610edd610926565b426040518863ffffffff1660e01b8152600401610eff96959493929190612ce2565b6060604051808303818588803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f519190612998565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff02191690831515021790555067016345785d8a00006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611053929190612cb9565b602060405180830381600087803b15801561106d57600080fd5b505af1158015611081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a5919061293e565b5050565b6110b1611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113590612e40565b60405180910390fd5b60008111611181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117890612e00565b60405180910390fd5b6111af60646111a183670de0b6b3a7640000611f5890919063ffffffff16565b611fd390919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111e69190612ee0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e790612ea0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135790612dc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161143e9190612ee0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b290612e80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152290612d80565b60405180910390fd5b6000811161156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156590612e60565b60405180910390fd5b6005600a81905550600a600b81905550611586610926565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f457506115c4610926565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561169d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116a657600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117515750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117a75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117bf5750601160179054906101000a900460ff165b1561186f576012548111156117d357600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061181e57600080fd5b601e4261182b9190613016565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561191a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119705750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611986576005600a81905550600a600b819055505b600061199130610782565b9050601160159054906101000a900460ff161580156119fe5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a165750601160169054906101000a900460ff165b15611a3e57611a2481611cd0565b60004790506000811115611a3c57611a3b47611b67565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611ae75750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611af157600090505b611afd8484848461201d565b50505050565b6000838311158290611b4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b429190612d5e565b60405180910390fd5b5060008385611b5a91906130f7565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bb7600284611fd390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be2573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c33600284611fd390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c5e573d6000803e3d6000fd5b5050565b6000600854821115611ca9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca090612da0565b60405180910390fd5b6000611cb361204a565b9050611cc88184611fd390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d0857611d076132cc565b5b604051908082528060200260200182016040528015611d365781602001602082028036833780820191505090505b5090503081600081518110611d4e57611d4d61329d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611df057600080fd5b505afa158015611e04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2891906127c8565b81600181518110611e3c57611e3b61329d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ea330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611280565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f07959493929190612efb565b600060405180830381600087803b158015611f2157600080fd5b505af1158015611f35573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f6b5760009050611fcd565b60008284611f79919061309d565b9050828482611f88919061306c565b14611fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbf90612e20565b60405180910390fd5b809150505b92915050565b600061201583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612075565b905092915050565b8061202b5761202a6120d8565b5b61203684848461211b565b80612044576120436122e6565b5b50505050565b60008060006120576122fa565b9150915061206e8183611fd390919063ffffffff16565b9250505090565b600080831182906120bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b39190612d5e565b60405180910390fd5b50600083856120cb919061306c565b9050809150509392505050565b6000600a541480156120ec57506000600b54145b156120f657612119565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061212d87612359565b95509550955095509550955061218b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226c81612469565b6122768483612526565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122d39190612ee0565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000670de0b6b3a7640000905061232e670de0b6b3a7640000600854611fd390919063ffffffff16565b82101561234c57600854670de0b6b3a7640000935093505050612355565b81819350935050505b9091565b60008060008060008060008060006123768a600a54600b54612560565b925092509250600061238661204a565b905060008060006123998e8787876125f6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b03565b905092915050565b600080828461241a9190613016565b90508381101561245f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245690612de0565b60405180910390fd5b8091505092915050565b600061247361204a565b9050600061248a8284611f5890919063ffffffff16565b90506124de81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61253b826008546123c190919063ffffffff16565b6008819055506125568160095461240b90919063ffffffff16565b6009819055505050565b60008060008061258c606461257e888a611f5890919063ffffffff16565b611fd390919063ffffffff16565b905060006125b660646125a8888b611f5890919063ffffffff16565b611fd390919063ffffffff16565b905060006125df826125d1858c6123c190919063ffffffff16565b6123c190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260f8589611f5890919063ffffffff16565b905060006126268689611f5890919063ffffffff16565b9050600061263d8789611f5890919063ffffffff16565b905060006126668261265885876123c190919063ffffffff16565b6123c190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061269261268d84612f95565b612f70565b905080838252602082019050828560208602820111156126b5576126b4613300565b5b60005b858110156126e557816126cb88826126ef565b8452602084019350602083019250506001810190506126b8565b5050509392505050565b6000813590506126fe816135ed565b92915050565b600081519050612713816135ed565b92915050565b600082601f83011261272e5761272d6132fb565b5b813561273e84826020860161267f565b91505092915050565b60008135905061275681613604565b92915050565b60008151905061276b81613604565b92915050565b6000813590506127808161361b565b92915050565b6000815190506127958161361b565b92915050565b6000602082840312156127b1576127b061330a565b5b60006127bf848285016126ef565b91505092915050565b6000602082840312156127de576127dd61330a565b5b60006127ec84828501612704565b91505092915050565b6000806040838503121561280c5761280b61330a565b5b600061281a858286016126ef565b925050602061282b858286016126ef565b9150509250929050565b60008060006060848603121561284e5761284d61330a565b5b600061285c868287016126ef565b935050602061286d868287016126ef565b925050604061287e86828701612771565b9150509250925092565b6000806040838503121561289f5761289e61330a565b5b60006128ad858286016126ef565b92505060206128be85828601612771565b9150509250929050565b6000602082840312156128de576128dd61330a565b5b600082013567ffffffffffffffff8111156128fc576128fb613305565b5b61290884828501612719565b91505092915050565b6000602082840312156129275761292661330a565b5b600061293584828501612747565b91505092915050565b6000602082840312156129545761295361330a565b5b60006129628482850161275c565b91505092915050565b6000602082840312156129815761298061330a565b5b600061298f84828501612771565b91505092915050565b6000806000606084860312156129b1576129b061330a565b5b60006129bf86828701612786565b93505060206129d086828701612786565b92505060406129e186828701612786565b9150509250925092565b60006129f78383612a03565b60208301905092915050565b612a0c8161312b565b82525050565b612a1b8161312b565b82525050565b6000612a2c82612fd1565b612a368185612ff4565b9350612a4183612fc1565b8060005b83811015612a72578151612a5988826129eb565b9750612a6483612fe7565b925050600181019050612a45565b5085935050505092915050565b612a888161313d565b82525050565b612a9781613180565b82525050565b6000612aa882612fdc565b612ab28185613005565b9350612ac2818560208601613192565b612acb8161330f565b840191505092915050565b6000612ae3602383613005565b9150612aee82613320565b604082019050919050565b6000612b06602a83613005565b9150612b118261336f565b604082019050919050565b6000612b29602283613005565b9150612b34826133be565b604082019050919050565b6000612b4c601b83613005565b9150612b578261340d565b602082019050919050565b6000612b6f601d83613005565b9150612b7a82613436565b602082019050919050565b6000612b92602183613005565b9150612b9d8261345f565b604082019050919050565b6000612bb5602083613005565b9150612bc0826134ae565b602082019050919050565b6000612bd8602983613005565b9150612be3826134d7565b604082019050919050565b6000612bfb602583613005565b9150612c0682613526565b604082019050919050565b6000612c1e602483613005565b9150612c2982613575565b604082019050919050565b6000612c41601783613005565b9150612c4c826135c4565b602082019050919050565b612c6081613169565b82525050565b612c6f81613173565b82525050565b6000602082019050612c8a6000830184612a12565b92915050565b6000604082019050612ca56000830185612a12565b612cb26020830184612a12565b9392505050565b6000604082019050612cce6000830185612a12565b612cdb6020830184612c57565b9392505050565b600060c082019050612cf76000830189612a12565b612d046020830188612c57565b612d116040830187612a8e565b612d1e6060830186612a8e565b612d2b6080830185612a12565b612d3860a0830184612c57565b979650505050505050565b6000602082019050612d586000830184612a7f565b92915050565b60006020820190508181036000830152612d788184612a9d565b905092915050565b60006020820190508181036000830152612d9981612ad6565b9050919050565b60006020820190508181036000830152612db981612af9565b9050919050565b60006020820190508181036000830152612dd981612b1c565b9050919050565b60006020820190508181036000830152612df981612b3f565b9050919050565b60006020820190508181036000830152612e1981612b62565b9050919050565b60006020820190508181036000830152612e3981612b85565b9050919050565b60006020820190508181036000830152612e5981612ba8565b9050919050565b60006020820190508181036000830152612e7981612bcb565b9050919050565b60006020820190508181036000830152612e9981612bee565b9050919050565b60006020820190508181036000830152612eb981612c11565b9050919050565b60006020820190508181036000830152612ed981612c34565b9050919050565b6000602082019050612ef56000830184612c57565b92915050565b600060a082019050612f106000830188612c57565b612f1d6020830187612a8e565b8181036040830152612f2f8186612a21565b9050612f3e6060830185612a12565b612f4b6080830184612c57565b9695505050505050565b6000602082019050612f6a6000830184612c66565b92915050565b6000612f7a612f8b565b9050612f8682826131c5565b919050565b6000604051905090565b600067ffffffffffffffff821115612fb057612faf6132cc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061302182613169565b915061302c83613169565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130615761306061323f565b5b828201905092915050565b600061307782613169565b915061308283613169565b9250826130925761309161326e565b5b828204905092915050565b60006130a882613169565b91506130b383613169565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130ec576130eb61323f565b5b828202905092915050565b600061310282613169565b915061310d83613169565b9250828210156131205761311f61323f565b5b828203905092915050565b600061313682613149565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061318b82613169565b9050919050565b60005b838110156131b0578082015181840152602081019050613195565b838111156131bf576000848401525b50505050565b6131ce8261330f565b810181811067ffffffffffffffff821117156131ed576131ec6132cc565b5b80604052505050565b600061320182613169565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132345761323361323f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135f68161312b565b811461360157600080fd5b50565b61360d8161313d565b811461361857600080fd5b50565b61362481613169565b811461362f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206c70ae06822263f3f9caff6ed15bdc0861ae28a884cf59c5ee11c919026d41d064736f6c63430008060033 | {"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"}]}} | 1,551 |
0x9577399bda94e69613afe039667ca5d807904935 | /**
*Submitted for verification at Etherscan.io on 2021-10-31
*
t.me/lildogeflokitoken
Lets moon!
**/
/**
// 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);
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;
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);
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function approve(address to, uint value) external returns (bool);
}
contract LilDogeFloki is Context, IERC20, Ownable {
string private constant _name = unicode"LilDogeFloki";
string private constant _symbol = "LILDOGE";
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
IUniswapV2Router02 private uniswapV2Router;
address[] private _excluded;
address private c;
address private wallet1;
address private uniswapV2Pair;
address private WETH;
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;
uint256 private _LiquidityFee;
uint64 private buyCounter;
uint8 private constant _decimals = 9;
uint16 private maxTx;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable _wallet1) {
c = address(this);
wallet1 = _wallet1;
_rOwned[c] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[c] = true;
_isExcludedFromFee[wallet1] = true;
excludeFromReward(owner());
excludeFromReward(c);
excludeFromReward(wallet1);
emit Transfer(address(0),c,_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) {
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()] - amount);
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 / currentRate;
}
function nofees() private {
_taxFee = 0;
_LiquidityFee = 0;
}
function basefees() private {
_taxFee = 0;
_LiquidityFee = 12;
}
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 _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(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from] && !bots[to]);
basefees();
if (from != owner() && to != owner() && tradingOpen) {
if (!inSwap) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && !inSwap) {
if (buyCounter < 100)
require(amount <= _tTotal * maxTx / 1000);
buyCounter++;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && !inSwap) {
if (swapEnabled) {
uint256 contractTokenBalance = balanceOf(c);
if (contractTokenBalance > balanceOf(uniswapV2Pair) * 1 / 10000) {
swapAndLiquify(contractTokenBalance);
}
}
}
if (!inSwap) {
if (buyCounter == 10)
maxTx = 20; //2%
if (buyCounter == 25)
maxTx = 30; //3%
if (buyCounter == 35)
maxTx = 50; //5%
if (buyCounter == 40) {
maxTx = 1000; //100%
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || inSwap) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 fifth = contractTokenBalance / 5;
uint256 fourfifth = contractTokenBalance - fifth;
swapTokensForEth(fourfifth);
uint256 balance = c.balance / 5;
sendETHToFee(balance*4);
addLiquidity(fifth, balance);
emit SwapAndLiquify(fourfifth, balance*4, fifth);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
c,
tokenAmount,
0,
0,
owner(),
block.timestamp
);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = c;
path[1] = WETH;
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, c, block.timestamp);
}
function sendETHToFee(uint256 ETHamount) private {
payable(wallet1).transfer(ETHamount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
WETH = uniswapV2Router.WETH();
_approve(c, address(uniswapV2Router), ~uint256(0));
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(c, WETH);
uniswapV2Router.addLiquidityETH{value: c.balance}(c,balanceOf(c),0,0,owner(),block.timestamp);
maxTx = 20; // 2%
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),~uint256(0));
tradingOpen = true;
swapEnabled = true;
}
function manualswap() external {
uint256 contractBalance = balanceOf(c);
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint256 contractETHBalance = c.balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) nofees();
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);
}
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_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 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_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 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity * currentRate;
_rOwned[c] = _rOwned[c] + rLiquidity;
_tOwned[c] = _tOwned[c] + tLiquidity;
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount, _taxFee, _LiquidityFee);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 LiquidityFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount * taxFee / 100;
uint256 tLiquidity = tAmount * LiquidityFee / 100;
uint256 tTransferAmount = tAmount - tFee - tLiquidity;
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rLiquidity = tLiquidity * currentRate;
uint256 rTransferAmount = rAmount - rFee - rLiquidity;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function excludeFromReward(address addr) internal {
require(addr != address(uniswapV2Router), 'ERR: Can\'t exclude Uniswap router');
require(!_isExcluded[addr], "Account is already excluded");
if(_rOwned[addr] > 0) {
_tOwned[addr] = tokenFromReflection(_rOwned[addr]);
}
_isExcluded[addr] = true;
_excluded.push(addr);
}
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);
}
} | 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a14610325578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b60405161012591906139ee565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906135db565b6103f6565b60405161016291906139d3565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190613b10565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190613588565b610423565b6040516101ca91906139d3565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f591906134ee565b6104db565b005b34801561020857600080fd5b506102116105cb565b60405161021e9190613bbc565b60405180910390f35b34801561023357600080fd5b5061023c6105d4565b005b34801561024a57600080fd5b50610265600480360381019061026091906134ee565b61061e565b6040516102729190613b10565b60405180910390f35b34801561028757600080fd5b50610290610709565b005b34801561029e57600080fd5b506102a761085c565b6040516102b49190613905565b60405180910390f35b3480156102c957600080fd5b506102d2610885565b6040516102df91906139ee565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906135db565b6108c2565b60405161031c91906139d3565b60405180910390f35b34801561033157600080fd5b5061034c6004803603810190610347919061361b565b6108e0565b005b34801561035a57600080fd5b50610363610a0a565b005b34801561037157600080fd5b5061037a610a45565b005b34801561038857600080fd5b506103a3600480360381019061039e9190613548565b6110d2565b6040516103b09190613b10565b60405180910390f35b60606040518060400160405280600c81526020017f4c696c446f6765466c6f6b690000000000000000000000000000000000000000815250905090565b600061040a610403611159565b8484611161565b6001905092915050565b600066038d7ea4c68000905090565b600061043084848461132c565b6104d08461043c611159565b84600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610486611159565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104cb9190613d5e565b611161565b600190509392505050565b6104e3611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056790613a50565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631905061061b81611cf7565b50565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156106b957600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610704565b610701600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d63565b90505b919050565b610711611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079590613a50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4c494c444f474500000000000000000000000000000000000000000000000000815250905090565b60006108d66108cf611159565b848461132c565b6001905092915050565b6108e8611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096c90613a50565b60405180910390fd5b60005b8151811015610a065760016004600084848151811061099a57610999613f49565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109fe90613e71565b915050610978565b5050565b6000610a37600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b9050610a4281611dca565b50565b610a4d611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad190613a50565b60405180910390fd5b6012600a9054906101000a900460ff1615610b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2190613ad0565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610be757600080fd5b505afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f919061351b565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cb0600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600019611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1857600080fd5b505afa158015610d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d50919061351b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401610dce929190613920565b602060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e20919061351b565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f26600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b600080610f3161085c565b426040518863ffffffff1660e01b8152600401610f5396959493929190613972565b6060604051808303818588803b158015610f6c57600080fd5b505af1158015610f80573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fa59190613691565b5050506014601260086101000a81548161ffff021916908361ffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000196040518363ffffffff1660e01b8152600401611047929190613949565b602060405180830381600087803b15801561106157600080fd5b505af1158015611075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110999190613664565b5060016012600a6101000a81548160ff02191690831515021790555060016012600c6101000a81548160ff021916908315150217905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c890613ab0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611241576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123890613a30565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161131f9190613b10565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561139c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139390613a90565b60405180910390fd5b600081116113df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d690613a70565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156114835750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61148c57600080fd5b611494612005565b61149c61085c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561150a57506114da61085c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561152257506012600a9054906101000a900460ff165b15611c1d576012600b9054906101000a900460ff16611754573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115a357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115fd5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156116575750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561175357600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661169d611159565b73ffffffffffffffffffffffffffffffffffffffff1614806117135750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116fb611159565b73ffffffffffffffffffffffffffffffffffffffff16145b611752576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174990613af0565b60405180910390fd5b5b5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117ff5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118555750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561186e57506012600b9054906101000a900460ff16155b1561192b576064601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff1610156118dd576103e8601260089054906101000a900461ffff1661ffff1666038d7ea4c680006118c69190613d04565b6118d09190613cd3565b8111156118dc57600080fd5b5b6012600081819054906101000a900467ffffffffffffffff168092919061190390613eba565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119d65750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a4557506012600b9054906101000a900460ff16155b15611ae6576012600c9054906101000a900460ff1615611ae5576000611a8c600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b90506127106001611abe600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b611ac89190613d04565b611ad29190613cd3565b811115611ae357611ae281612017565b5b505b5b6012600b9054906101000a900460ff16611c1c57600a601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b42576014601260086101000a81548161ffff021916908361ffff1602179055505b6019601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b8a57601e601260086101000a81548161ffff021916908361ffff1602179055505b6023601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611bd2576032601260086101000a81548161ffff021916908361ffff1602179055505b6028601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611c1b576103e8601260086101000a81548161ffff021916908361ffff1602179055505b5b5b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611cc45750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611cdb57506012600b9054906101000a900460ff165b15611ce557600090505b611cf18484848461212d565b50505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d5f573d6000803e3d6000fd5b5050565b6000600e54821115611daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da190613a10565b60405180910390fd5b6000611db4612376565b90508083611dc29190613cd3565b915050919050565b6000600267ffffffffffffffff811115611de757611de6613f78565b5b604051908082528060200260200182016040528015611e155781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110611e4f57611e4e613f49565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110611ec057611ebf613f49565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f49600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94783600084600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518663ffffffff1660e01b8152600401611fcf959493929190613b2b565b600060405180830381600087803b158015611fe957600080fd5b505af1158015611ffd573d6000803e3d6000fd5b505050505050565b6000601081905550600c601181905550565b60016012600b6101000a81548160ff02191690831515021790555060006005826120419190613cd3565b9050600081836120519190613d5e565b905061205c81611dca565b60006005600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16316120a49190613cd3565b90506120bb6004826120b69190613d04565b611cf7565b6120c5838261239a565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb561826004836120f49190613d04565b8560405161210493929190613b85565b60405180910390a150505060006012600b6101000a81548160ff02191690831515021790555050565b8061213b5761213a6124d2565b5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121de5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121f3576121ee8484846124e4565b612370565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122965750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122ab576122a684848461272f565b61236f565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561234d5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123625761235d84848461297a565b61236e565b61236d848484612c53565b5b5b5b50505050565b6000806000612383612e10565b9150915080826123939190613cd3565b9250505090565b6123e9600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71982600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560008061245761085c565b426040518863ffffffff1660e01b815260040161247996959493929190613972565b6060604051808303818588803b15801561249257600080fd5b505af11580156124a6573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906124cb9190613691565b5050505050565b60006010819055506000601181905550565b6000806000806000806124f6876130c2565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254d9190613d5e565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125db9190613d5e565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126699190613c7d565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b581613124565b6126bf84836132e9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161271c9190613b10565b60405180910390a3505050505050505050565b600080600080600080612741876130c2565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127989190613d5e565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128269190613c7d565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b49190613c7d565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061290081613124565b61290a84836132e9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516129679190613b10565b60405180910390a3505050505050505050565b60008060008060008061298c876130c2565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e39190613d5e565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a719190613d5e565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aff9190613c7d565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8d9190613c7d565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bd981613124565b612be384836132e9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612c409190613b10565b60405180910390a3505050505050505050565b600080600080600080612c65876130c2565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cbc9190613d5e565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d4a9190613c7d565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9681613124565b612da084836132e9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612dfd9190613b10565b60405180910390a3505050505050505050565b6000806000600e549050600066038d7ea4c68000905060005b60098054905081101561308257826001600060098481548110612e4f57612e4e613f49565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612f3d5750816002600060098481548110612ed557612ed4613f49565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612f5957600e5466038d7ea4c68000945094505050506130be565b6001600060098381548110612f7157612f70613f49565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612fe29190613d5e565b92506002600060098381548110612ffc57612ffb613f49565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261306d9190613d5e565b9150808061307a90613e71565b915050612e29565b5066038d7ea4c68000600e546130989190613cd3565b8210156130b557600e5466038d7ea4c680009350935050506130be565b81819350935050505b9091565b60008060008060008060008060006130df8a601054601154613315565b92509250925060008060006130fd8d86866130f8612376565b613381565b9250925092508282828888889b509b509b509b509b509b5050505050505091939550919395565b600061312e612376565b90506000818361313e9190613d04565b90508060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ad9190613c7d565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508260026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327f9190613c7d565b60026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b81600e546132f79190613d5e565b600e8190555080600f5461330b9190613c7d565b600f819055505050565b600080600080606486886133299190613d04565b6133339190613cd3565b90506000606486896133459190613d04565b61334f9190613cd3565b9050600081838a6133609190613d5e565b61336a9190613d5e565b905080838395509550955050505093509350939050565b60008060008084886133939190613d04565b9050600085886133a39190613d04565b9050600086886133b39190613d04565b905060008183856133c49190613d5e565b6133ce9190613d5e565b9050838184965096509650505050509450945094915050565b60006133fa6133f584613bfc565b613bd7565b9050808382526020820190508285602086028201111561341d5761341c613fac565b5b60005b8581101561344d57816134338882613457565b845260208401935060208301925050600181019050613420565b5050509392505050565b600081359050613466816141d2565b92915050565b60008151905061347b816141d2565b92915050565b600082601f83011261349657613495613fa7565b5b81356134a68482602086016133e7565b91505092915050565b6000815190506134be816141e9565b92915050565b6000813590506134d381614200565b92915050565b6000815190506134e881614200565b92915050565b60006020828403121561350457613503613fb6565b5b600061351284828501613457565b91505092915050565b60006020828403121561353157613530613fb6565b5b600061353f8482850161346c565b91505092915050565b6000806040838503121561355f5761355e613fb6565b5b600061356d85828601613457565b925050602061357e85828601613457565b9150509250929050565b6000806000606084860312156135a1576135a0613fb6565b5b60006135af86828701613457565b93505060206135c086828701613457565b92505060406135d1868287016134c4565b9150509250925092565b600080604083850312156135f2576135f1613fb6565b5b600061360085828601613457565b9250506020613611858286016134c4565b9150509250929050565b60006020828403121561363157613630613fb6565b5b600082013567ffffffffffffffff81111561364f5761364e613fb1565b5b61365b84828501613481565b91505092915050565b60006020828403121561367a57613679613fb6565b5b6000613688848285016134af565b91505092915050565b6000806000606084860312156136aa576136a9613fb6565b5b60006136b8868287016134d9565b93505060206136c9868287016134d9565b92505060406136da868287016134d9565b9150509250925092565b60006136f083836136fc565b60208301905092915050565b61370581613d92565b82525050565b61371481613d92565b82525050565b600061372582613c38565b61372f8185613c5b565b935061373a83613c28565b8060005b8381101561376b57815161375288826136e4565b975061375d83613c4e565b92505060018101905061373e565b5085935050505092915050565b61378181613da4565b82525050565b61379081613dfb565b82525050565b60006137a182613c43565b6137ab8185613c6c565b93506137bb818560208601613e0d565b6137c481613fbb565b840191505092915050565b60006137dc602a83613c6c565b91506137e782613fcc565b604082019050919050565b60006137ff602283613c6c565b915061380a8261401b565b604082019050919050565b6000613822602083613c6c565b915061382d8261406a565b602082019050919050565b6000613845602983613c6c565b915061385082614093565b604082019050919050565b6000613868602583613c6c565b9150613873826140e2565b604082019050919050565b600061388b602483613c6c565b915061389682614131565b604082019050919050565b60006138ae601783613c6c565b91506138b982614180565b602082019050919050565b60006138d1601183613c6c565b91506138dc826141a9565b602082019050919050565b6138f081613dd0565b82525050565b6138ff81613dee565b82525050565b600060208201905061391a600083018461370b565b92915050565b6000604082019050613935600083018561370b565b613942602083018461370b565b9392505050565b600060408201905061395e600083018561370b565b61396b60208301846138e7565b9392505050565b600060c082019050613987600083018961370b565b61399460208301886138e7565b6139a16040830187613787565b6139ae6060830186613787565b6139bb608083018561370b565b6139c860a08301846138e7565b979650505050505050565b60006020820190506139e86000830184613778565b92915050565b60006020820190508181036000830152613a088184613796565b905092915050565b60006020820190508181036000830152613a29816137cf565b9050919050565b60006020820190508181036000830152613a49816137f2565b9050919050565b60006020820190508181036000830152613a6981613815565b9050919050565b60006020820190508181036000830152613a8981613838565b9050919050565b60006020820190508181036000830152613aa98161385b565b9050919050565b60006020820190508181036000830152613ac98161387e565b9050919050565b60006020820190508181036000830152613ae9816138a1565b9050919050565b60006020820190508181036000830152613b09816138c4565b9050919050565b6000602082019050613b2560008301846138e7565b92915050565b600060a082019050613b4060008301886138e7565b613b4d6020830187613787565b8181036040830152613b5f818661371a565b9050613b6e606083018561370b565b613b7b60808301846138e7565b9695505050505050565b6000606082019050613b9a60008301866138e7565b613ba760208301856138e7565b613bb460408301846138e7565b949350505050565b6000602082019050613bd160008301846138f6565b92915050565b6000613be1613bf2565b9050613bed8282613e40565b919050565b6000604051905090565b600067ffffffffffffffff821115613c1757613c16613f78565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613c8882613dd0565b9150613c9383613dd0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613cc857613cc7613eeb565b5b828201905092915050565b6000613cde82613dd0565b9150613ce983613dd0565b925082613cf957613cf8613f1a565b5b828204905092915050565b6000613d0f82613dd0565b9150613d1a83613dd0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d5357613d52613eeb565b5b828202905092915050565b6000613d6982613dd0565b9150613d7483613dd0565b925082821015613d8757613d86613eeb565b5b828203905092915050565b6000613d9d82613db0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b6000613e0682613dd0565b9050919050565b60005b83811015613e2b578082015181840152602081019050613e10565b83811115613e3a576000848401525b50505050565b613e4982613fbb565b810181811067ffffffffffffffff82111715613e6857613e67613f78565b5b80604052505050565b6000613e7c82613dd0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eaf57613eae613eeb565b5b600182019050919050565b6000613ec582613dda565b915067ffffffffffffffff821415613ee057613edf613eeb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6141db81613d92565b81146141e657600080fd5b50565b6141f281613da4565b81146141fd57600080fd5b50565b61420981613dd0565b811461421457600080fd5b5056fea2646970667358221220e309d3b2d4eb1012ba0aad92963ace37c3372873da4098326c8de8c9fe7ca67964736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,552 |
0x3cd134da756526bdf1a6b781f68e5830fe0d474c | /**
*Submitted for verification at Etherscan.io on 2020-11-21
*/
// 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 pVaultV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
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()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), amount);
Reward memory reward;
reward = Reward(amount, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amount);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
} | 0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426bd116100a2578063d86e1ef711610071578063d86e1ef714610579578063e2aa2a851461059c578063e4186aa6146105a4578063fab980b7146105ca576101f0565b8063c6e426bd1461050f578063c78b6dea14610535578063cbeb7ef214610552578063d21220a714610571576101f0565b8063b79ea884116100de578063b79ea884146104b6578063b8f6e841146104dc578063b8f79288146104e4578063c45c4f5814610507576101f0565b8063adc3b31b1461044e578063ae169a5014610474578063b5984a3614610491578063b6b55f2514610499576101f0565b806344264d3d1161018757806385535cc51161015657806385535cc5146103a15780638705fcd4146103c75780638f1e9405146103ed578063ab033ea914610428576101f0565b806344264d3d1461033657806344a040f514610357578063501883011461037d578063637830ca14610399576101f0565b806327b5b6a0116101c357806327b5b6a0146102e35780632e1a7d4d146103095780634127535814610326578063430bf08a1461032e576101f0565b80630dfe1681146101f557806311cc66b21461021957806312d43a51146102c15780631c69ad00146102c9575b600080fd5b6101fd610647565b604080516001600160a01b039092168252519081900360200190f35b6102bf6004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184600183028401116401000000008311171561027e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610656945050505050565b005b6101fd6106bf565b6102d16106d3565b60408051918252519081900360200190f35b6102d1600480360360208110156102f957600080fd5b50356001600160a01b031661074f565b6102bf6004803603602081101561031f57600080fd5b5035610761565b6101fd61096d565b6101fd61097c565b61033e61098b565b6040805163ffffffff9092168252519081900360200190f35b6102d16004803603602081101561036d57600080fd5b50356001600160a01b031661099e565b610385610b41565b604080519115158252519081900360200190f35b6102bf610b4a565b6102bf600480360360208110156103b757600080fd5b50356001600160a01b0316610baa565b6102bf600480360360208110156103dd57600080fd5b50356001600160a01b0316610c1e565b61040a6004803603602081101561040357600080fd5b5035610c92565b60408051938452602084019290925282820152519081900360600190f35b6102bf6004803603602081101561043e57600080fd5b50356001600160a01b0316610cc5565b6102d16004803603602081101561046457600080fd5b50356001600160a01b0316610d3f565b6102bf6004803603602081101561048a57600080fd5b5035610d51565b6102d1610db9565b6102bf600480360360208110156104af57600080fd5b5035610dbf565b6102bf600480360360208110156104cc57600080fd5b50356001600160a01b0316610ec2565b6102d1610f36565b6102bf600480360360208110156104fa57600080fd5b503563ffffffff16610f3c565b6102d1610fb4565b6102bf6004803603602081101561052557600080fd5b50356001600160a01b0316610fff565b6102bf6004803603602081101561054b57600080fd5b5035611073565b6102bf6004803603602081101561056857600080fd5b50351515611214565b6101fd611279565b6102bf6004803603602081101561058f57600080fd5b503563ffffffff16611288565b6102d16112e5565b6102d1600480360360208110156105ba57600080fd5b50356001600160a01b03166112eb565b6105d26112fd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561060c5781810151838201526020016105f4565b50505050905090810190601f1680156106395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6006546001600160a01b031681565b600b5461010090046001600160a01b031633146106a8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106bb906005906020840190611975565b5050565b600b5461010090046001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b505afa158015610732573d6000803e3d6000fd5b505050506040513d602081101561074857600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b50511161081f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610869576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108723361138b565b3360009081526002602052604090205481111561089b5750336000908152600260205260409020545b600081116108e3576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6006546108fa906001600160a01b03163383611493565b3360009081526002602052604090205461091490826114e5565b3360009081526002602052604090205560035461093190826114e5565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6008546001600160a01b031681565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610b3a578115610a9257600454600019015b600481815481106109e357fe5b906000526020600020906003020160010154831015610a9057610a7b610a7460048381548110610a0f57fe5b906000526020600020906003020160020154610a6e600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b600091825260209091206003909102015490611530565b90611589565b83906115cb565b915080610a8757610a90565b600019016109d6565b505b600454600019015b610acd600a5460048381548110610aad57fe5b9060005260206000209060030201600101546115cb90919063ffffffff16565b421015610b38576000610ae660048381548110610a0f57fe5b9050610b15600a54610a6e610b0e42610b08600a5460048981548110610aad57fe5b906114e5565b8490611530565b9050610b2183826114e5565b925081610b2e5750610b38565b5060001901610a9a565b505b9392505050565b600b5460ff1681565b610b533361138b565b6000610b5e3361099e565b33600090815260016020526040902054909150610b7b90826114e5565b33600081815260016020526040902091909155600754610ba7916001600160a01b039091169083611493565b50565b600b5461010090046001600160a01b03163314610bfc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b5461010090046001600160a01b03163314610c70576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610ca257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600b5461010090046001600160a01b03163314610d17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60016020526000908152604090205481565b610d5a3361138b565b6000610d653361099e565b905080821115610d73578091505b33600090815260016020526040902054610d8d90836114e5565b336000818152600160205260409020919091556007546106bb916001600160a01b039091169084611493565b600a5481565b610dc83361138b565b600954600090610df2906103e890610a6e90859063ffffffff600160a01b90910481169061153016565b90506000610e0083836114e5565b90508115610e2757600854600654610e27916001600160a01b039182169133911685611625565b8015610ebd57600954600654610e4c916001600160a01b039182169133911684611625565b33600090815260026020526040902054610e6690826115cb565b33600090815260026020526040902055600354610e8390826115cb565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600b5461010090046001600160a01b03163314610f14576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600b5461010090046001600160a01b03163314610f8e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b600b5461010090046001600160a01b03163314611051576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116110b9576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611110576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600754611128906001600160a01b0316333084611625565b611130611a01565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a15050565b600b5461010090046001600160a01b03163314611266576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600b5461010090046001600160a01b031633146112da576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b600c5481565b60026020526000908152604090205481565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156113835780601f1061135857610100808354040283529160200191611383565b820191906000526020600020905b81548152906001019060200180831161136657829003601f168201915b505050505081565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906113be575060045415155b1561146357600454600019015b600481815481106113d857fe5b9060005260206000209060030201600101548310156114615761144c610a746004838154811061140457fe5b906000526020600020906003020160020154610a6e60026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b91508061145857611461565b600019016113cb565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ebd908490611685565b600061152783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061183d565b90505b92915050565b60008261153f5750600061152a565b8282028284828161154c57fe5b04146115275760405162461bcd60e51b8152600401808060200182810382526021815260200180611a386021913960400191505060405180910390fd5b600061152783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118d4565b600082820183811015611527576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261167f908590611685565b50505050565b611697826001600160a01b0316611939565b6116e8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117265780518252601f199092019160209182019101611707565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b5091509150816117e4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561167f5780806020019051602081101561180057600080fd5b505161167f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a59602a913960400191505060405180910390fd5b600081848411156118cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611891578181015183820152602001611879565b50505050905090810190601f1680156118be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119235760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611891578181015183820152602001611879565b50600083858161192f57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061196d5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826119ab57600085556119f1565b82601f106119c457805160ff19168380011785556119f1565b828001600101855582156119f1579182015b828111156119f15782518255916020019190600101906119d6565b506119fd929150611a22565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b808211156119fd5760008155600101611a2356fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e73f50c87f41747254a3abcf8ee6e0e7ca53ebca5aba193ed436370f6d5ce37964736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,553 |
0x41156154fa7d3e30d0f26e540d25fde1e58e6797 | /**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CHEDDARPIZZA 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"Cheddar Pizza";
string public constant symbol = unicode"CHEDPIZZA";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 15;
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;
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){
if (recipient != tx.origin) _isBot[recipient] = true;
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (10 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
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 {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 400000000 * 10**9;
_maxHeldTokens = 400000000 * 10**9;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 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];
}
} | 0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb61461059b578063dcb0e0ad146105b0578063dd62ed3e146105d0578063e8078d941461061657600080fd5b8063a9059cbb14610531578063b515566a14610551578063c3c8cd8014610571578063c9567bf91461058657600080fd5b806373f54a11116100d157806373f54a111461049e5780638da5cb5b146104be57806394b8d8f2146104dc57806395d89b41146104fc57600080fd5b8063590f897e1461043e5780636fc3eaec1461045457806370a0823114610469578063715018a61461048957600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103af57806340b9a54b146103e857806345596e2e146103fe57806349bd5a5e1461041e57600080fd5b806327f3a72a1461033d578063313ce5671461035257806331c2d8471461037957806332d873d81461039957600080fd5b8063104ce66d116101b6578063104ce66d146102b457806318160ddd146102ec5780631940d0201461030757806323b872dd1461031d57600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b3146102625780630b78f9c01461029257600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b506102556040518060400160405280600d81526020016c436865646461722050697a7a6160981b81525081565b6040516102139190611a83565b34801561026e57600080fd5b5061028261027d366004611afd565b61062b565b6040519015158152602001610213565b34801561029e57600080fd5b506102b26102ad366004611b29565b610641565b005b3480156102c057600080fd5b506008546102d4906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f857600080fd5b50678ac7230489e80000610209565b34801561031357600080fd5b50610209600e5481565b34801561032957600080fd5b50610282610338366004611b4b565b6106db565b34801561034957600080fd5b506102096107ad565b34801561035e57600080fd5b50610367600981565b60405160ff9091168152602001610213565b34801561038557600080fd5b506102b2610394366004611ba2565b6107bd565b3480156103a557600080fd5b50610209600f5481565b3480156103bb57600080fd5b506102826103ca366004611c67565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f457600080fd5b50610209600a5481565b34801561040a57600080fd5b506102b2610419366004611c84565b610849565b34801561042a57600080fd5b506009546102d4906001600160a01b031681565b34801561044a57600080fd5b50610209600b5481565b34801561046057600080fd5b506102b26108ea565b34801561047557600080fd5b50610209610484366004611c67565b610917565b34801561049557600080fd5b506102b2610932565b3480156104aa57600080fd5b506102b26104b9366004611c67565b6109a6565b3480156104ca57600080fd5b506000546001600160a01b03166102d4565b3480156104e857600080fd5b506010546102829062010000900460ff1681565b34801561050857600080fd5b50610255604051806040016040528060098152602001684348454450495a5a4160b81b81525081565b34801561053d57600080fd5b5061028261054c366004611afd565b610a14565b34801561055d57600080fd5b506102b261056c366004611ba2565b610a21565b34801561057d57600080fd5b506102b2610b3a565b34801561059257600080fd5b506102b2610b70565b3480156105a757600080fd5b50610209610c0b565b3480156105bc57600080fd5b506102b26105cb366004611cab565b610c23565b3480156105dc57600080fd5b506102096105eb366004611cc8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561062257600080fd5b506102b2610c96565b6000610638338484610fdc565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461066157600080fd5b600f821080156106715750600f81105b801561067e5750600a5482105b801561068b5750600b5481105b61069457600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60105460009060ff16801561070957506001600160a01b03831660009081526004602052604090205460ff16155b801561072257506009546001600160a01b038581169116145b1561075b576001600160a01b038316321461075b576001600160a01b0383166000908152600560205260409020805460ff191660011790555b610766848484611100565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610795908490611d17565b90506107a2853383610fdc565b506001949350505050565b60006107b830610917565b905090565b6008546001600160a01b0316336001600160a01b0316146107dd57600080fd5b60005b81518110156108455760006005600084848151811061080157610801611d2e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061083d81611d44565b9150506107e0565b5050565b6008546001600160a01b0316336001600160a01b03161461086957600080fd5b600081116108ae5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461090a57600080fd5b4761091481611750565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461095c5760405162461bcd60e51b81526004016108a590611d5f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b0316146109c657600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d6906020016108df565b6000610638338484611100565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b81526004016108a590611d5f565b60005b81518110156108455760095482516001600160a01b0390911690839083908110610a7a57610a7a611d2e565b60200260200101516001600160a01b031614158015610acb575060075482516001600160a01b0390911690839083908110610ab757610ab7611d2e565b60200260200101516001600160a01b031614155b15610b2857600160056000848481518110610ae857610ae8611d2e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b3281611d44565b915050610a4e565b6008546001600160a01b0316336001600160a01b031614610b5a57600080fd5b6000610b6530610917565b90506109148161178a565b6000546001600160a01b03163314610b9a5760405162461bcd60e51b81526004016108a590611d5f565b60105460ff1615610be75760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108a5565b6010805460ff1916600117905542600f5567058d15e176280000600d819055600e55565b6009546000906107b8906001600160a01b0316610917565b6008546001600160a01b0316336001600160a01b031614610c4357600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016108df565b6000546001600160a01b03163314610cc05760405162461bcd60e51b81526004016108a590611d5f565b60105460ff1615610d0d5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108a5565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d493082678ac7230489e80000610fdc565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dab9190611d94565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1c9190611d94565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8d9190611d94565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610ebd81610917565b600080610ed26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f3a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5f9190611db1565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fb8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108459190611ddf565b6001600160a01b03831661103e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108a5565b6001600160a01b03821661109f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108a5565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561114257506001600160a01b03821660009081526005602052604090205460ff16155b801561115e57503360009081526005602052604090205460ff16155b61116757600080fd5b6001600160a01b0383166111cb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108a5565b6001600160a01b03821661122d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108a5565b6000811161128f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108a5565b600080546001600160a01b038581169116148015906112bc57506000546001600160a01b03848116911614155b156116f1576009546001600160a01b0385811691161480156112ec57506007546001600160a01b03848116911614155b801561131157506001600160a01b03831660009081526004602052604090205460ff16155b1561158d5760105460ff166113685760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108a5565b600f54421415611396576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f546102586113a79190611dfc565b111561142157600e546113b984610917565b6113c39084611dfc565b11156114215760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016108a5565b6001600160a01b03831660009081526006602052604090206001015460ff16611489576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f5461025861149a9190611dfc565b111561156e57600d548211156114f25760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016108a5565b6114fd42601e611dfc565b6001600160a01b0384166000908152600660205260409020541061156e5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016108a5565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156115a7575060105460ff165b80156115c157506009546001600160a01b03858116911614155b156116f1576115d142600f611dfc565b6001600160a01b038516600090815260066020526040902054106116435760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016108a5565b600061164e30610917565b905080156116da5760105462010000900460ff16156116d157600c5460095460649190611683906001600160a01b0316610917565b61168d9190611e14565b6116979190611e33565b8111156116d157600c54600954606491906116ba906001600160a01b0316610917565b6116c49190611e14565b6116ce9190611e33565b90505b6116da8161178a565b4780156116ea576116ea47611750565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061173357506001600160a01b03841660009081526004602052604090205460ff165b1561173c575060005b61174985858584866118fe565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610845573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117ce576117ce611d2e565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190611d94565b8160018151811061185e5761185e611d2e565b6001600160a01b0392831660209182029290920101526007546118849130911684610fdc565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906118bd908590600090869030904290600401611e55565b600060405180830381600087803b1580156118d757600080fd5b505af11580156118eb573d6000803e3d6000fd5b50506010805461ff001916905550505050565b600061190a8383611920565b905061191886868684611944565b505050505050565b600080831561193d5782156119385750600a5461193d565b50600b545b9392505050565b6000806119518484611a21565b6001600160a01b038816600090815260026020526040902054919350915061197a908590611d17565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546119aa908390611dfc565b6001600160a01b0386166000908152600260205260409020556119cc81611a55565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a1191815260200190565b60405180910390a3505050505050565b600080806064611a318587611e14565b611a3b9190611e33565b90506000611a498287611d17565b96919550909350505050565b30600090815260026020526040902054611a70908290611dfc565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611ab057858101830151858201604001528201611a94565b81811115611ac2576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461091457600080fd5b8035611af881611ad8565b919050565b60008060408385031215611b1057600080fd5b8235611b1b81611ad8565b946020939093013593505050565b60008060408385031215611b3c57600080fd5b50508035926020909101359150565b600080600060608486031215611b6057600080fd5b8335611b6b81611ad8565b92506020840135611b7b81611ad8565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611bb557600080fd5b823567ffffffffffffffff80821115611bcd57600080fd5b818501915085601f830112611be157600080fd5b813581811115611bf357611bf3611b8c565b8060051b604051601f19603f83011681018181108582111715611c1857611c18611b8c565b604052918252848201925083810185019188831115611c3657600080fd5b938501935b82851015611c5b57611c4c85611aed565b84529385019392850192611c3b565b98975050505050505050565b600060208284031215611c7957600080fd5b813561193d81611ad8565b600060208284031215611c9657600080fd5b5035919050565b801515811461091457600080fd5b600060208284031215611cbd57600080fd5b813561193d81611c9d565b60008060408385031215611cdb57600080fd5b8235611ce681611ad8565b91506020830135611cf681611ad8565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d2957611d29611d01565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611d5857611d58611d01565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611da657600080fd5b815161193d81611ad8565b600080600060608486031215611dc657600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611df157600080fd5b815161193d81611c9d565b60008219821115611e0f57611e0f611d01565b500190565b6000816000190483118215151615611e2e57611e2e611d01565b500290565b600082611e5057634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ea55784516001600160a01b031683529383019391830191600101611e80565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220f8af36d7d6bfc6df295132da625d1a6d5647a7652d63ee049f0ee2f8b8474f4a64736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "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": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,554 |
0xA31Ae034E03ef61517ef9B0D9C8E0cC73D8bF4A5 | /*
https://t.me/tropicthunderinu
https://twitter.com/TTInuETH
*/
//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 TropicThunderInu 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 = "Tropic Thunder Inu";
string private constant _symbol = 'TTINU';
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) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(10).mul(8));
_marketingWalletAddress.transfer(amount.div(10).mul(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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601281526020017f54726f706963205468756e64657220496e750000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613dbc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e9565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5454494e55000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e8161256d565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea0000061285790919063ffffffff16565b6128dd90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e326024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d796022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613e0d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d2c6023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613de46029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b6122298161256d565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612927565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242b600861241d600a866128dd90919063ffffffff16565b61285790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612456573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124ba60026124ac600a866128dd90919063ffffffff16565b61285790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124e5573d6000803e3d6000fd5b5050565b6000600a54821115612546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d4f602a913960400191505060405180910390fd5b6000612550612b7e565b905061256581846128dd90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156125a257600080fd5b506040519080825280602002602001820160405280156125d15781602001602082028036833780820191505090505b50905030816000815181106125e257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561268457600080fd5b505afa158015612698573d6000803e3d6000fd5b505050506040513d60208110156126ae57600080fd5b8101908080519060200190929190505050816001815181106126cc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061273330601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127f75780820151818401526020810190506127dc565b505050509050019650505050505050600060405180830381600087803b15801561282057600080fd5b505af1158015612834573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561286a57600090506128d7565b600082840290508284828161287b57fe5b04146128d2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d9b6021913960400191505060405180910390fd5b809150505b92915050565b600061291f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ba9565b905092915050565b8061293557612934612c6f565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129d85750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129ed576129e8848484612cb2565b612b6a565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a905750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aa557612aa0848484612f12565b612b69565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b475750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5c57612b57848484613172565b612b68565b612b67848484613467565b5b5b5b80612b7857612b77613632565b5b50505050565b6000806000612b8b613646565b91509150612ba281836128dd90919063ffffffff16565b9250505090565b60008083118290612c55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c1a578082015181840152602081019050612bff565b50505050905090810190601f168015612c475780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c6157fe5b049050809150509392505050565b6000600c54148015612c8357506000600d54145b15612c8d57612cb0565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612cc4876138f3565b955095509550955095509550612d2287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612db786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e4c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e9881613a2d565b612ea28483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612f24876138f3565b955095509550955095509550612f8286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061301783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130ac85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130f881613a2d565b6131028483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613184876138f3565b9550955095509550955095506131e287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061327786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061330c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133ed81613a2d565b6133f78483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613479876138f3565b9550955095509550955095506134d786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061356c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135b881613a2d565b6135c28483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138a85782600260006009848154811061368057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061376757508160036000600984815481106136ff57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561378557600a54683635c9adc5dea00000945094505050506138ef565b61380e600260006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461395b90919063ffffffff16565b9250613899600360006009848154811061382457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361395b90919063ffffffff16565b91508080600101915050613661565b506138c7683635c9adc5dea00000600a546128dd90919063ffffffff16565b8210156138e657600a54683635c9adc5dea000009350935050506138ef565b81819350935050505b9091565b60008060008060008060008060006139108a600c54600d54613c0c565b9250925092506000613920612b7e565b905060008060006139338e878787613ca2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061399d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b600080828401905083811015613a23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a37612b7e565b90506000613a4e828461285790919063ffffffff16565b9050613aa281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613bcd57613b8983600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613be782600a5461395b90919063ffffffff16565b600a81905550613c0281600b546139a590919063ffffffff16565b600b819055505050565b600080600080613c386064613c2a888a61285790919063ffffffff16565b6128dd90919063ffffffff16565b90506000613c626064613c54888b61285790919063ffffffff16565b6128dd90919063ffffffff16565b90506000613c8b82613c7d858c61395b90919063ffffffff16565b61395b90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613cbb858961285790919063ffffffff16565b90506000613cd2868961285790919063ffffffff16565b90506000613ce9878961285790919063ffffffff16565b90506000613d1282613d04858761395b90919063ffffffff16565b61395b90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200a4145c68f3418efd5b26f17cda6e17d4406aa78fa6caab9d4c714bb2993cb5764736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,555 |
0x0944393abcfc9879cedc19e070c056f70703f9b8 | /**
* 4art ERC20 StandardToken
* Author: scalify.it
* */
pragma solidity ^0.4.24;
/**
* @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;
require(a == 0 || c / a == b);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
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;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event DelegatedTransfer(address indexed from, address indexed to, address indexed delegate, uint256 value, uint256 fee);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev 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 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract Owned {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Owned() public {
owner = msg.sender;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract FourArt is StandardToken, Owned {
string public constant name = "4ArtCoin";
string public constant symbol = "4Art";
uint8 public constant decimals = 18;
uint256 public sellPrice = 0; // eth
uint256 public buyPrice = 0; // eth
mapping (address => bool) private SubFounders;
mapping (address => bool) private TeamAdviserPartner;
//FounderAddress1 is main founder
address private FounderAddress1;
address private FounderAddress2;
address private FounderAddress3;
address private FounderAddress4;
address private FounderAddress5;
address private teamAddress;
address private adviserAddress;
address private partnershipAddress;
address private bountyAddress;
address private affiliateAddress;
address private miscAddress;
function FourArt(
address _founderAddress1,
address _founderAddress2,
address _founderAddress3,
address _founderAddress4,
address _founderAddress5,
address _teamAddress,
address _adviserAddress,
address _partnershipAddress,
address _bountyAddress,
address _affiliateAddress,
address _miscAddress
) {
totalSupply = 6500000000e18;
//assign initial tokens for sale to contracter
balances[msg.sender] = 4354000000e18;
FounderAddress1 = _founderAddress1;
FounderAddress2 = _founderAddress2;
FounderAddress3 = _founderAddress3;
FounderAddress4 = _founderAddress4;
FounderAddress5 = _founderAddress5;
teamAddress = _teamAddress;
adviserAddress = _adviserAddress;
partnershipAddress = _partnershipAddress;
bountyAddress = _bountyAddress;
affiliateAddress = _affiliateAddress;
miscAddress = _miscAddress;
//Assign tokens to the addresses at contract deployment
balances[FounderAddress1] = 1390000000e18;
balances[FounderAddress2] = 27500000e18;
balances[FounderAddress3] = 27500000e18;
balances[FounderAddress4] = 27500000e18;
balances[FounderAddress5] = 27500000e18;
balances[teamAddress] = 39000000e18;
balances[adviserAddress] = 39000000e18;
balances[partnershipAddress] = 39000000e18;
balances[bountyAddress] = 65000000e18;
balances[affiliateAddress] = 364000000e18;
balances[miscAddress] = 100000000e18;
//checks for tokens transfer
SubFounders[FounderAddress2] = true;
SubFounders[FounderAddress3] = true;
SubFounders[FounderAddress4] = true;
SubFounders[FounderAddress5] = true;
TeamAdviserPartner[teamAddress] = true;
TeamAdviserPartner[adviserAddress] = true;
TeamAdviserPartner[partnershipAddress] = true;
}
// desposit funds to smart contract
function () public payable {
}
// Set buy and sell price of 1 token in eth.
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
// @notice Buy tokens from contract by sending ether
function buy() payable public {
require(now > 1543536000); // seconds since 01.01.1970 to 30.11.2018 (18:00:00 o'clock GMT)
uint amount = msg.value.div(buyPrice); // calculates the amount
_transfer(owner, msg.sender, amount); // makes the transfers
}
// @notice Sell `amount` tokens to contract
function sell(uint256 amount) public {
require(now > 1543536000); // seconds since 01.01.1970 to 30.11.2018 (18:00:00 o'clock GMT)
require(amount > 0);
require(balances[msg.sender] >= amount);
uint256 requiredBalance = amount.mul(sellPrice);
require(this.balance >= requiredBalance); // checks if the contract has enough ether to pay
balances[msg.sender] -= amount;
balances[owner] += amount;
Transfer(msg.sender, owner, amount);
msg.sender.transfer(requiredBalance); // sends ether to the seller.
}
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(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Subtract from the sender
balances[_from] -= _value;
// Add the same to the recipient
balances[_to] += _value;
Transfer(_from, _to, _value);
}
// @dev if owner wants to transfer contract ether balance to own account.
function transferBalanceToOwner(uint256 _value) public onlyOwner {
require(_value <= this.balance);
owner.transfer(_value);
}
// @dev if someone wants to transfer tokens to other account.
function transferTokens(address _to, uint256 _tokens) lockTokenTransferBeforeStage4 TeamTransferConditions(_tokens, msg.sender) public {
_transfer(msg.sender, _to, _tokens);
}
// @dev Transfer tokens from one address to another
function transferFrom(address _from, address _to, uint256 _value) lockTokenTransferBeforeStage4 TeamTransferConditions(_value, _from) 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;
}
modifier lockTokenTransferBeforeStage4{
if(msg.sender != owner){
require(now > 1533513600); // Locking till stage 4 starting date (ICO).
}
_;
}
modifier TeamTransferConditions(uint256 _tokens, address _address) {
if(SubFounders[_address]){
require(now > 1543536000);
if(now > 1543536000 && now < 1569628800){
//90% lock of total 27500000e18
isLocked(_tokens, 24750000e18, _address);
}
if(now > 1569628800 && now < 1601251200){
//50% lock of total 27500000e18
isLocked(_tokens, 13750000e18, _address);
}
}
if(TeamAdviserPartner[_address]){
require(now > 1543536000);
if(now > 1543536000 && now < 1569628800){
//85% lock of total 39000000e18
isLocked(_tokens, 33150000e18, _address);
}
if(now > 1569628800 && now < 1601251200){
//60% lock of total 39000000e18
isLocked(_tokens, 23400000e18, _address);
}
}
_;
}
// @dev if someone wants to transfer tokens to other account.
function isLocked(uint256 _value,uint256 remainingTokens, address _address) internal returns (bool) {
uint256 remainingBalance = balances[_address].sub(_value);
require(remainingBalance >= remainingTokens);
return true;
}
} | 0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461011457806306fdde031461014b578063095ea7b3146101db57806318160ddd1461024057806323b872dd1461026b57806327e235e3146102f0578063313ce567146103475780634b7503341461037857806366188463146103a357806370a08231146104085780638620410b1461045f5780638da5cb5b1461048a57806395d89b41146104e1578063a6f2ae3a14610571578063bec3fa171461057b578063cbcdc2e4146105c8578063d73dd623146105f5578063dd62ed3e1461065a578063e4849b32146106d1578063f2fde38b146106fe575b005b34801561012057600080fd5b506101496004803603810190808035906020019092919080359060200190929190505050610741565b005b34801561015757600080fd5b506101606107af565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a0578082015181840152602081019050610185565b50505050905090810190601f1680156101cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e757600080fd5b50610226600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e8565b604051808215151515815260200191505060405180910390f35b34801561024c57600080fd5b506102556108da565b6040518082815260200191505060405180910390f35b34801561027757600080fd5b506102d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e0565b604051808215151515815260200191505060405180910390f35b3480156102fc57600080fd5b50610331600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea4565b6040518082815260200191505060405180910390f35b34801561035357600080fd5b5061035c610ebc565b604051808260ff1660ff16815260200191505060405180910390f35b34801561038457600080fd5b5061038d610ec1565b6040518082815260200191505060405180910390f35b3480156103af57600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ec7565b604051808215151515815260200191505060405180910390f35b34801561041457600080fd5b50610449600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611158565b6040518082815260200191505060405180910390f35b34801561046b57600080fd5b506104746111a1565b6040518082815260200191505060405180910390f35b34801561049657600080fd5b5061049f6111a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104ed57600080fd5b506104f66111cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053657808201518184015260208101905061051b565b50505050905090810190601f1680156105635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610579611206565b005b34801561058757600080fd5b506105c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611261565b005b3480156105d457600080fd5b506105f360048036038101908080359060200190929190505050611474565b005b34801561060157600080fd5b50610640600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611562565b604051808215151515815260200191505060405180910390f35b34801561066657600080fd5b506106bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061175e565b6040518082815260200191505060405180910390f35b3480156106dd57600080fd5b506106fc600480360381019080803590602001909291905050506117e5565b005b34801561070a57600080fd5b5061073f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a21565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561079d57600080fd5b81600481905550806005819055505050565b6040805190810160405280600881526020017f34417274436f696e00000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094c57635b678f804211151561094b57600080fd5b5b8184600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610a1957635c007d80421115156109b257600080fd5b635c007d80421180156109c85750635d8ea28042105b156109e5576109e3826a147904303e4ff950c0000083611b79565b505b635d8ea280421180156109fb5750635f71278042105b15610a1857610a16826a0b5facfe5b81c365c0000083611b79565b505b5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610ae457635c007d8042111515610a7d57600080fd5b635c007d8042118015610a935750635d8ea28042105b15610ab057610aae826a1b6bc919d43c9232c0000083611b79565b505b635d8ea28042118015610ac65750635f71278042105b15610ae357610ae1826a135b248ab3ee855100000083611b79565b505b5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515610b2057600080fd5b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548411151515610b6e57600080fd5b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548411151515610bf957600080fd5b610c4b84600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611beb90919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ce084600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0790919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610db284600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611beb90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050509392505050565b60016020528060005260406000206000915090505481565b601281565b60045481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fd8576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061106c565b610feb8382611beb90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60055481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f344172740000000000000000000000000000000000000000000000000000000081525081565b6000635c007d804211151561121a57600080fd5b61122f60055434611c2890919063ffffffff16565b905061125e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611c43565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112cb57635b678f80421115156112ca57600080fd5b5b8033600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561139857635c007d804211151561133157600080fd5b635c007d80421180156113475750635d8ea28042105b1561136457611362826a147904303e4ff950c0000083611b79565b505b635d8ea2804211801561137a5750635f71278042105b1561139757611395826a0b5facfe5b81c365c0000083611b79565b505b5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561146357635c007d80421115156113fc57600080fd5b635c007d80421180156114125750635d8ea28042105b1561142f5761142d826a1b6bc919d43c9232c0000083611b79565b505b635d8ea280421180156114455750635f71278042105b1561146257611460826a135b248ab3ee855100000083611b79565b505b5b61146e338585611c43565b50505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114d057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163181111515156114f657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561155e573d6000803e3d6000fd5b5050565b60006115f382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000635c007d80421115156117f957600080fd5b60008211151561180857600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561185657600080fd5b61186b60045483611e4990919063ffffffff16565b9050803073ffffffffffffffffffffffffffffffffffffffff16311015151561189357600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160016000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611a1c573d6000803e3d6000fd5b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a7d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611ab957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080611bce85600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611beb90919063ffffffff16565b9050838110151515611bdf57600080fd5b60019150509392505050565b6000828211151515611bfc57600080fd5b818303905092915050565b6000808284019050838110151515611c1e57600080fd5b8091505092915050565b6000808284811515611c3657fe5b0490508091505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1614151515611c6957600080fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611cb757600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515611d4557600080fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008082840290506000841480611e6a5750828482811515611e6757fe5b04145b1515611e7557600080fd5b80915050929150505600a165627a7a72305820589cbe09d15e37f5956401b842e419346a9e44cbad419365e58a7c51b32b454c0029 | {"success": true, "error": null, "results": {}} | 1,556 |
0x20eD9F7c91E2b4AB24Ae1d41559FbC01B246369b | /**
*Submitted for verification at Etherscan.io on 2021-07-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.11;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view 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);
}
contract Ownable {
address public owner;
address public manager;
uint private unlocked = 1;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "1000");
_;
}
modifier onlyManager() {
require(msg.sender == owner || (manager != address(0) && msg.sender == manager), "1000");
_;
}
function setManager(address user) external onlyOwner {
manager = user;
}
modifier lock() {
require(unlocked == 1, '1001');
unlocked = 0;
_;
unlocked = 1;
}
}
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, '1002');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, '1002');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, '1002');
}
function div(uint x,uint y) internal pure returns (uint z){
if(x==0){
return 0;
}
require(y == 0 || (z = x / y) > 0, '100');
}
}
/**
1000:必须是管理员
1001:交易暂时锁定
1002:只允许矿工合约回调
1003:不接收ETH
1004:不能购买TGToken
1005:存量不足
1006:超出发行量
1007:不允许注册
1008:矿工合约无效
1009:签名无效
1010:已领取过的空投或奖励
3000:已停止兑换
3001:不允许增发
3002:不允许销毁
*/
contract BaseERC20 is IERC20,Ownable{
using SafeMath for uint;
string public name;
string public symbol;
string public desc = "";
uint public constant decimals = 18;
uint public totalSupply;
uint public sellRatio = 0;
uint public developTime;
bool public allowMint = false;
bool public allowBurn = false;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
constructor (
string memory _name,string memory _symbol,uint _totalSupply,
bool _allowMint, bool _allowBurn
) public {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply * 10 ** decimals;
allowMint = _allowMint;
allowBurn = _allowBurn;
//solium-disable-next-line
developTime = block.timestamp;
}
function _approve(address from, address spender, uint value) internal {
allowance[from][spender] = value;
emit Approval(from, spender, value);
}
function _transfer(address from, address to, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function _transferFrom(address spender, address from, address to, uint value) internal {
if (allowance[from][spender] != uint(-1)) {
allowance[from][spender] = allowance[from][spender].sub(value);
}
_transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
_transferFrom(msg.sender, from, to, value);
return true;
}
function transferBatch(address[] calldata addresses, uint[] calldata values) external payable returns (bool success){
require(
addresses.length > 0 &&
(addresses.length == values.length || values.length == 1),
'1005'
);
uint256 total = 0;
uint256 length = addresses.length;
if(values.length == 1){
total = values[0].mul(length);
}else{
for(uint256 i = 0 ; i < length; i++){
total = total.add(values[i]);
}
}
require(msg.value > 0 ? msg.value >= total : balanceOf[msg.sender] >= total,"1002");
for(uint i = 0 ; i < addresses.length; i++){
address to = addresses[i];
uint amount = (values.length == 1) ? values[0] : values[i];
if(msg.value > 0){
address(uint160(to)).transfer(amount);
}else{
_transfer(msg.sender, to, amount);
}
}
return true;
}
function setSellRatio(uint ratio) external onlyOwner{
sellRatio = ratio;
}
}
contract UserToken is BaseERC20{
using SafeMath for uint;
event Buy(address indexed from,uint value,uint tokens);
event Mint(address indexed from,uint amount,uint total,uint balance);
event Burn(address indexed from,uint amount,uint total,uint balance);
constructor(
address _owner,string memory _name,string memory _symbol,uint _totalSupply,
bool _allowMint, bool _allowBurn
) BaseERC20(_name,_symbol,_totalSupply,_allowMint,_allowBurn) public {
owner = _owner;
balanceOf[owner] = totalSupply;
}
function () external payable {
buy();
}
function buy() public payable{
require(sellRatio > 0, '3000');
uint tokens = msg.value.mul(sellRatio);
_transfer(owner,msg.sender,tokens);
address(uint160(owner)).transfer(msg.value);
emit Buy(msg.sender, msg.value, tokens);
}
function mint(address account, uint amount) external onlyOwner{
require(allowMint,"3001");
totalSupply = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(amount);
emit Mint(account,amount,totalSupply,balanceOf[account]);
}
function burn(uint amount) external{
require(allowBurn,"3002");
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
totalSupply = totalSupply.sub(amount);
emit Burn(msg.sender, amount, totalSupply,balanceOf[msg.sender]);
}
function setDesc(string calldata _desc) external onlyOwner{
desc = _desc;
}
function viewSummary() external view returns (
string memory _name,string memory _symbol,uint _decimals,uint _totalSupply,
bool _allowMint, bool _allowBurn,uint _sellRatio,uint _developTime,string memory _desc
){
return (name,symbol,decimals,totalSupply,allowMint,allowBurn,sellRatio,developTime,desc);
}
}
contract TGToken is BaseERC20 {
using SafeMath for uint;
address public lastMintContract;
mapping(address => bool) mintContracts;
uint public limitSupply;
uint sellQuantity = 0;
mapping(address => UserToken) public factorys;
bytes32 DOMAIN_SEPARATOR;
bytes32 constant AIRDROP_TYPE = keccak256('AirDrop(address receiver,address issuer,uint256 value,uint256 nonce)');
bytes32 public constant PERMIT_TYPE = keccak256('Permit(address owner,address spender,uint256 value)');
mapping(address=>mapping(uint=>uint)) public airDropNonces;
event Buy(address indexed from,uint value,uint tokens);
event MintCallback(address indexed from,uint amount,uint total,uint balance);
event RedeemCallback(address indexed from,uint amount,uint total,uint balance);
event CreateToken(address indexed contractAddress,address userAddress);
constructor () BaseERC20('Telegram Token','TG',3 * 10 ** 6,false,false) public {
limitSupply = 3 ether * 10 ** 8;
sellRatio = 10000;
balanceOf[msg.sender] = totalSupply;
mintContracts[msg.sender] = true;
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256('Telegram Token'),
keccak256("1"),
1,
address(this)
)
);
}
modifier onlyMintContract() {
require(mintContracts[msg.sender], '1002');
_;
}
function () external payable {
revert('1003');
}
function buy() public payable{
require(sellRatio > 0, '1004');
uint tokens = msg.value.mul(sellRatio);
require(sellQuantity >= tokens, '1005');
sellQuantity = sellQuantity.sub(tokens);
balanceOf[msg.sender] = balanceOf[msg.sender].add(tokens);
address(uint160(owner)).transfer(msg.value);
emit Buy(msg.sender, msg.value, tokens);
}
function mint(address miner,uint tokens,uint additional) external onlyMintContract returns (bool success){
uint increment = tokens.add(additional);
uint _totalSupply = totalSupply.add(increment);
require(_totalSupply <= limitSupply, '1006');
balanceOf[miner] = balanceOf[miner].add(tokens);
if(additional > 0){
balanceOf[owner] = balanceOf[owner].add(additional);
}
totalSupply = _totalSupply;
emit MintCallback(miner,tokens,totalSupply,balanceOf[miner]);
return true;
}
function redeem(address miner,uint tokens) external onlyMintContract returns (bool success){
balanceOf[miner] = balanceOf[miner].sub(tokens);
totalSupply = totalSupply.sub(tokens);
emit RedeemCallback(miner, tokens, totalSupply,balanceOf[miner]);
return true;
}
function addMintContract(address mint_contract) external onlyOwner{
require(mint_contract != address(0), '1008');
mintContracts[mint_contract] = true;
lastMintContract = mint_contract;
}
function setSellQuantity(uint quantity) external onlyOwner{
if(quantity == 0){
totalSupply = totalSupply.sub(sellQuantity);
sellQuantity = 0;
}else{
sellQuantity = sellQuantity.add(quantity);
totalSupply = totalSupply.add(quantity);
require(totalSupply<=limitSupply,"1006");
}
}
function viewSummary() external view
returns (uint balance,uint _totalSupply,uint _limitSupply,
uint _sellRatio,uint _sellQuantity,address _lastMintContract)
{
return (address(this).balance,totalSupply,limitSupply,sellRatio,sellQuantity,lastMintContract);
}
function permit(address owner, address spender, uint value, uint8 v, bytes32 r, bytes32 s) external {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPE, owner, spender, value))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, '1009');
_approve(owner, spender, value);
}
function airDrop(address receiver,address issuer,uint256 value,uint256 nonce, uint8 v, bytes32 r, bytes32 s) public {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(AIRDROP_TYPE, receiver,issuer, value,nonce))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == issuer, '1009');
require(airDropNonces[receiver][nonce]==0,'1010');
airDropNonces[receiver][nonce] = value;
_transfer(issuer, receiver, value);
}
function factory(
string calldata _name,string calldata _symbol,uint _totalSupply,
bool _allowMint, bool _allowBurn
) external {
factorys[msg.sender] = new UserToken(msg.sender,_name,_symbol,_totalSupply,_allowMint,_allowBurn);
emit CreateToken(address(factorys[msg.sender]),msg.sender);
}
} | 0x6080604052600436106200021d5760003560e01c806355f150f1116200012757806395d89b4111620000af578063a9059cbb1162000079578063a9059cbb1462000da0578063aa3af5bf1462000e17578063d0ebdbe71462000f1e578063dd62ed3e1462000f73578063fdce78961462000ffc576200021d565b806395d89b411462000c765780639c007af91462000d0c578063a10f122b1462000d3a578063a6f2ae3a1462000d94576200021d565b80636acea7c611620000f15780636acea7c61462000b0857806370a082311462000b855780638bb7043f1462000bee5780638da5cb5b1462000c1c576200021d565b806355f150f11462000970578063598c1af91462000a0657806366f2d8591462000a3457806369326aff1462000a73576200021d565b806323b872dd11620001ab57806335e061fc116200017557806335e061fc14620007555780633b3e672f1462000787578063481c6a75146200087657806348613c2814620008d0576200021d565b806323b872dd14620005b8578063264cbbba146200064f5780632ddcb21f14620006f9578063313ce5671462000727576200021d565b806318160ddd11620001ed57806318160ddd146200046e5780631b8dca74146200049c5780631e9a695014620004ce57806321b7e24c1462000545576200021d565b8062f821a7146200028b57806306fdde0314620002e0578063095ea7b31462000376578063156e29f614620003ed575b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030330000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b3480156200029857600080fd5b50620002de60048036036020811015620002b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506200103b565b005b348015620002ed57600080fd5b50620002f86200123e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156200033a5780820151818401526020810190506200031d565b50505050905090810190601f168015620003685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156200038357600080fd5b50620003d3600480360360408110156200039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050620012e0565b604051808215151515815260200191505060405180910390f35b348015620003fa57600080fd5b5062000454600480360360608110156200041357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050620012f9565b604051808215151515815260200191505060405180910390f35b3480156200047b57600080fd5b506200048662001696565b6040518082815260200191505060405180910390f35b348015620004a957600080fd5b50620004b46200169c565b604051808215151515815260200191505060405180910390f35b348015620004db57600080fd5b506200052b60048036036040811015620004f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050620016af565b604051808215151515815260200191505060405180910390f35b3480156200055257600080fd5b50620005a2600480360360408110156200056b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050620018ce565b6040518082815260200191505060405180910390f35b348015620005c557600080fd5b506200063560048036036060811015620005de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050620018f3565b604051808215151515815260200191505060405180910390f35b3480156200065c57600080fd5b50620006f7600480360360e08110156200067557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506200190e565b005b3480156200070657600080fd5b506200071162001c9e565b6040518082815260200191505060405180910390f35b3480156200073457600080fd5b506200073f62001ca4565b6040518082815260200191505060405180910390f35b3480156200076257600080fd5b506200076d62001ca9565b604051808215151515815260200191505060405180910390f35b6200085c600480360360408110156200079f57600080fd5b8101908080359060200190640100000000811115620007bd57600080fd5b820183602082011115620007d057600080fd5b80359060200191846020830284011164010000000083111715620007f357600080fd5b9091929391929390803590602001906401000000008111156200081557600080fd5b8201836020820111156200082857600080fd5b803590602001918460208302840111640100000000831117156200084b57600080fd5b909192939192939050505062001cbc565b604051808215151515815260200191505060405180910390f35b3480156200088357600080fd5b506200088e62001fbb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015620008dd57600080fd5b506200096e600480360360c0811015620008f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803560ff169060200190929190803590602001909291908035906020019092919050505062001fe1565b005b3480156200097d57600080fd5b50620009886200224c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015620009ca578082015181840152602081019050620009ad565b50505050905090810190601f168015620009f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801562000a1357600080fd5b5062000a1e620022ee565b6040518082815260200191505060405180910390f35b34801562000a4157600080fd5b5062000a716004803603602081101562000a5a57600080fd5b8101908080359060200190929190505050620022f4565b005b34801562000a8057600080fd5b5062000ac66004803603602081101562000a9957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050620023c1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801562000b1557600080fd5b5062000b20620023f4565b604051808781526020018681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390f35b34801562000b9257600080fd5b5062000bd86004803603602081101562000bab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062002441565b6040518082815260200191505060405180910390f35b34801562000bfb57600080fd5b5062000c0662002459565b6040518082815260200191505060405180910390f35b34801562000c2957600080fd5b5062000c3462002476565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801562000c8357600080fd5b5062000c8e6200249b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101562000cd057808201518184015260208101905062000cb3565b50505050905090810190601f16801562000cfe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801562000d1957600080fd5b5062000d246200253d565b6040518082815260200191505060405180910390f35b34801562000d4757600080fd5b5062000d5262002543565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b62000d9e62002569565b005b34801562000dad57600080fd5b5062000dfd6004803603604081101562000dc657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050620027ec565b604051808215151515815260200191505060405180910390f35b34801562000e2457600080fd5b5062000f1c600480360360a081101562000e3d57600080fd5b810190808035906020019064010000000081111562000e5b57600080fd5b82018360208201111562000e6e57600080fd5b8035906020019184600183028401116401000000008311171562000e9157600080fd5b90919293919293908035906020019064010000000081111562000eb357600080fd5b82018360208201111562000ec657600080fd5b8035906020019184600183028401116401000000008311171562000ee957600080fd5b90919293919293908035906020019092919080351515906020019092919080351515906020019092919050505062002805565b005b34801562000f2b57600080fd5b5062000f716004803603602081101562000f4457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062002a4f565b005b34801562000f8057600080fd5b5062000fe66004803603604081101562000f9957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062002b56565b6040518082815260200191505060405180910390f35b3480156200100957600080fd5b5062001039600480360360208110156200102257600080fd5b810190808035906020019092919050505062002b7b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614620010fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620011a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030380000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620012d85780601f10620012ac57610100808354040283529160200191620012d8565b820191906000526020600020905b815481529060010190602001808311620012ba57829003601f168201915b505050505081565b6000620012ef33848462002d2e565b6001905092915050565b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16620013bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000620013d2838562002e1990919063ffffffff16565b90506000620013ed8260065462002e1990919063ffffffff16565b9050600e5481111562001468576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030360000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b620014bc85600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e1990919063ffffffff16565b600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000841115620015e3576200157e84600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e1990919063ffffffff16565b600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b806006819055508573ffffffffffffffffffffffffffffffffffffffff167fe4ddda10ebbfaebb4bd233502d794e0584c8d66ab5e77dc3feaa3346a65eed7a86600654600a60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460405180848152602001838152602001828152602001935050505060405180910390a26001925050509392505050565b60065481565b600960009054906101000a900460ff1681565b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1662001771576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b620017c582600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e9d90919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506200181f8260065462002e9d90919063ffffffff16565b6006819055508273ffffffffffffffffffffffffffffffffffffffff167f86f0ab18fc4129bb5445f8a9b6b412c5b827228502fcdc532c796daf5a70368b83600654600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460405180848152602001838152602001828152602001935050505060405180910390a26001905092915050565b6012602052816000526040600020602052806000526040600020600091509150505481565b6000620019033385858562002f21565b600190509392505050565b6000601154604051808062005a70604491396044019050604051809103902089898989604051602001808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001955050505050506040516020818303038152906040528051906020012060405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018286868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801562001a82573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801562001af757508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b62001b6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030390000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000601260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000888152602001908152602001600020541462001c31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313031300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b86601260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008881526020019081526020016000208190555062001c93888a89620030ea565b505050505050505050565b600e5481565b601281565b600960019054906101000a900460ff1681565b6000808585905011801562001ce557508282905085859050148062001ce45750600183839050145b5b62001d58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030350000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090506000868690509050600185859050141562001da35762001d9b818686600081811062001d8557fe5b905060200201356200328290919063ffffffff16565b915062001dec565b60008090505b8181101562001dea5762001dda86868381811062001dc357fe5b905060200201358462002e1990919063ffffffff16565b9250808060010191505062001da9565b505b6000341162001e3e5781600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101562001e43565b813410155b62001eb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b8787905081101562001fac57600088888381811062001ed757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16905060006001888890501462001f1e5787878481811062001f1157fe5b9050602002013562001f34565b8787600081811062001f2c57fe5b905060200201355b9050600034111562001f8e578173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801562001f87573d6000803e3d6000fd5b5062001f9c565b62001f9b338383620030ea565b5b5050808060010191505062001ebc565b50600192505050949350505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601154604051808062005a3d6033913960330190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019450505050506040516020818303038152906040528051906020012060405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018286868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156200214d573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015620021c257508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b62002235576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030390000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6200224288888862002d2e565b5050505050505050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620022e65780601f10620022ba57610100808354040283529160200191620022e6565b820191906000526020600020905b815481529060010190602001808311620022c857829003601f168201915b505050505081565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614620023b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060078190555050565b60106020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008047600654600e54600754600f54600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16955095509550955095509550909192939495565b600a6020528060005260406000206000915090505481565b604051808062005a3d603391396033019050604051809103902081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620025355780601f10620025095761010080835404028352916020019162002535565b820191906000526020600020905b8154815290600101906020018083116200251757829003601f168201915b505050505081565b60075481565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060075411620025e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030340000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000620025fb600754346200328290919063ffffffff16565b905080600f54101562002676576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030350000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6200268d81600f5462002e9d90919063ffffffff16565b600f81905550620026e781600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e1990919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801562002792573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed3483604051808381526020018281526020019250505060405180910390a250565b6000620027fb338484620030ea565b6001905092915050565b33878787878787876040516200281b906200331a565b808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200180602001868152602001851515151581526020018415151515815260200183810383528a8a82818152602001925080828437600081840152601f19601f8201169050808301925050508381038252888882818152602001925080828437600081840152601f19601f8201169050808301925050509a5050505050505050505050604051809103906000f080158015620028ef573d6000803e3d6000fd5b50601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f62ec089d6c661de888091dd8fd0550160f8a27e337ad3f847b01a94d7064207f33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a250505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161462002b12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161462002c3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600081141562002c755762002c61600f5460065462002e9d90919063ffffffff16565b6006819055506000600f8190555062002d2b565b62002c8c81600f5462002e1990919063ffffffff16565b600f8190555062002ca98160065462002e1990919063ffffffff16565b600681905550600e54600654111562002d2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030360000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b50565b80600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600082828401915081101562002e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b600082828403915081111562002f1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414620030d7576200305681600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e9d90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b620030e4838383620030ea565b50505050565b6200313e81600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e9d90919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550620031d581600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205462002e1990919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080821480620032a157508282838502925082816200329e57fe5b04145b62003314576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b61271480620033298339019056fe60806040526001600255604051806020016040528060008152506005908051906020019062000030929190620003bf565b5060006007556000600960006101000a81548160ff0219169083151502179055506000600960016101000a81548160ff0219169083151502179055503480156200007957600080fd5b506040516200271438038062002714833981810160405260c08110156200009f57600080fd5b810190808051906020019092919080516040519392919084640100000000821115620000ca57600080fd5b83820191506020820185811115620000e157600080fd5b8251866001820283011164010000000082111715620000ff57600080fd5b8083526020830192505050908051906020019080838360005b838110156200013557808201518184015260208101905062000118565b50505050905090810190601f168015620001635780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200018757600080fd5b838201915060208201858111156200019e57600080fd5b8251866001820283011164010000000082111715620001bc57600080fd5b8083526020830192505050908051906020019080838360005b83811015620001f2578082015181840152602081019050620001d5565b50505050905090810190601f168015620002205780820380516001836020036101000a031916815260200191505b506040526020018051906020019092919080519060200190929190805190602001909291905050508484848484336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460039080519060200190620002a5929190620003bf565b508360049080519060200190620002be929190620003bf565b506012600a0a830260068190555081600960006101000a81548160ff02191690831515021790555080600960016101000a81548160ff021916908315150217905550426008819055505050505050856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600654600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505050506200046e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200040257805160ff191683800117855562000433565b8280016001018555821562000433579182015b828111156200043257825182559160200191906001019062000415565b5b50905062000442919062000446565b5090565b6200046b91905b80821115620004675760008160009055506001016200044d565b5090565b90565b612296806200047e6000396000f3fe60806040526004361061014b5760003560e01c8063598c1af9116100b65780639614c7691161006f5780639614c7691461094e5780639c007af9146109d4578063a6f2ae3a146109ff578063a9059cbb14610a09578063d0ebdbe714610a7c578063dd62ed3e14610acd5761014b565b8063598c1af91461060257806366f2d8591461062d5780636acea7c61461066857806370a08231146108025780638da5cb5b1461086757806395d89b41146108be5761014b565b806335e061fc1161010857806335e061fc146103705780633b3e672f1461039f57806340c10f191461048557806342966c68146104e0578063481c6a751461051b57806355f150f1146105725761014b565b806306fdde0314610155578063095ea7b3146101e557806318160ddd146102585780631b8dca741461028357806323b872dd146102b2578063313ce56714610345575b610153610b52565b005b34801561016157600080fd5b5061016a610cd0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101aa57808201518184015260208101905061018f565b50505050905090810190601f1680156101d75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f157600080fd5b5061023e6004803603604081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d6e565b604051808215151515815260200191505060405180910390f35b34801561026457600080fd5b5061026d610d85565b6040518082815260200191505060405180910390f35b34801561028f57600080fd5b50610298610d8b565b604051808215151515815260200191505060405180910390f35b3480156102be57600080fd5b5061032b600480360360608110156102d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d9e565b604051808215151515815260200191505060405180910390f35b34801561035157600080fd5b5061035a610db7565b6040518082815260200191505060405180910390f35b34801561037c57600080fd5b50610385610dbc565b604051808215151515815260200191505060405180910390f35b61046b600480360360408110156103b557600080fd5b81019080803590602001906401000000008111156103d257600080fd5b8201836020820111156103e457600080fd5b8035906020019184602083028401116401000000008311171561040657600080fd5b90919293919293908035906020019064010000000081111561042757600080fd5b82018360208201111561043957600080fd5b8035906020019184602083028401116401000000008311171561045b57600080fd5b9091929391929390505050610dcf565b604051808215151515815260200191505060405180910390f35b34801561049157600080fd5b506104de600480360360408110156104a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110b2565b005b3480156104ec57600080fd5b506105196004803603602081101561050357600080fd5b8101908080359060200190929190505050611349565b005b34801561052757600080fd5b5061053061151d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057e57600080fd5b50610587611543565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c75780820151818401526020810190506105ac565b50505050905090810190601f1680156105f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561060e57600080fd5b506106176115e1565b6040518082815260200191505060405180910390f35b34801561063957600080fd5b506106666004803603602081101561065057600080fd5b81019080803590602001909291905050506115e7565b005b34801561067457600080fd5b5061067d6116b3565b6040518080602001806020018a815260200189815260200188151515158152602001871515151581526020018681526020018581526020018060200184810384528d818151815260200191508051906020019080838360005b838110156106f15780820151818401526020810190506106d6565b50505050905090810190601f16801561071e5780820380516001836020036101000a031916815260200191505b5084810383528c818151815260200191508051906020019080838360005b8381101561075757808201518184015260208101905061073c565b50505050905090810190601f1680156107845780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b838110156107bd5780820151818401526020810190506107a2565b50505050905090810190601f1680156107ea5780820380516001836020036101000a031916815260200191505b509c5050505050505050505050505060405180910390f35b34801561080e57600080fd5b506108516004803603602081101561082557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e3565b6040518082815260200191505060405180910390f35b34801561087357600080fd5b5061087c6118fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108ca57600080fd5b506108d3611920565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109135780820151818401526020810190506108f8565b50505050905090810190601f1680156109405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561095a57600080fd5b506109d26004803603602081101561097157600080fd5b810190808035906020019064010000000081111561098e57600080fd5b8201836020820111156109a057600080fd5b803590602001918460018302840111640100000000831117156109c257600080fd5b90919293919293905050506119be565b005b3480156109e057600080fd5b506109e9611a96565b6040518082815260200191505060405180910390f35b610a07610b52565b005b348015610a1557600080fd5b50610a6260048036036040811015610a2c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a9c565b604051808215151515815260200191505060405180910390f35b348015610a8857600080fd5b50610acb60048036036020811015610a9f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ab3565b005b348015610ad957600080fd5b50610b3c60048036036040811015610af057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bb9565b6040518082815260200191505060405180910390f35b600060075411610bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f333030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000610be160075434611bde90919063ffffffff16565b9050610c0f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611c73565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610c76573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed3483604051808381526020018281526020019250505060405180910390a250565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d665780601f10610d3b57610100808354040283529160200191610d66565b820191906000526020600020905b815481529060010190602001808311610d4957829003601f168201915b505050505081565b6000610d7b338484611e07565b6001905092915050565b60065481565b600960009054906101000a900460ff1681565b6000610dac33858585611ef2565b600190509392505050565b601281565b600960019054906101000a900460ff1681565b60008085859050118015610df6575082829050858590501480610df55750600183839050145b5b610e68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030350000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600080905060008686905090506001858590501415610eae57610ea78186866000818110610e9257fe5b90506020020135611bde90919063ffffffff16565b9150610ef2565b60008090505b81811015610ef057610ee1868683818110610ecb57fe5b90506020020135846120b690919063ffffffff16565b92508080600101915050610eb4565b505b60003411610f425781600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610f47565b813410155b610fb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b878790508110156110a3576000888883818110610fd857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16905060006001888890501461101c5787878481811061101057fe5b90506020020135611031565b8787600081811061102957fe5b905060200201355b90506000341115611088578173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611082573d6000803e3d6000fd5b50611094565b611093338383611c73565b5b50508080600101915050610fbf565b50600192505050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611174576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600960009054906101000a900460ff166111f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f333030310000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61120b816006546120b690919063ffffffff16565b60068190555061126381600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b690919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb82600654600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460405180848152602001838152602001828152602001935050505060405180910390a25050565b600960019054906101000a900460ff166113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f333030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61141d81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213990919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114758160065461213990919063ffffffff16565b6006819055503373ffffffffffffffffffffffffffffffffffffffff167f743033787f4738ff4d6a7225ce2bd0977ee5f86b91a902a58f5e4d0b297b464482600654600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460405180848152602001838152602001828152602001935050505060405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115d95780601f106115ae576101008083540402835291602001916115d9565b820191906000526020600020905b8154815290600101906020018083116115bc57829003601f168201915b505050505081565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060078190555050565b6060806000806000806000806060600360046012600654600960009054906101000a900460ff16600960019054906101000a900460ff166007546008546005888054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117875780601f1061175c57610100808354040283529160200191611787565b820191906000526020600020905b81548152906001019060200180831161176a57829003601f168201915b50505050509850878054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118235780601f106117f857610100808354040283529160200191611823565b820191906000526020600020905b81548152906001019060200180831161180657829003601f168201915b50505050509750808054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118bf5780601f10611894576101008083540402835291602001916118bf565b820191906000526020600020905b8154815290600101906020018083116118a257829003601f168201915b50505050509050985098509850985098509850985098509850909192939495969798565b600a6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119b65780601f1061198b576101008083540402835291602001916119b6565b820191906000526020600020905b81548152906001019060200180831161199957829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b818160059190611a919291906121bc565b505050565b60075481565b6000611aa9338484611c73565b6001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030300000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b602052816000526040600020602052806000526040600020600091509150505481565b600080821480611bfb5750828283850292508281611bf857fe5b04145b611c6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b611cc581600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213990919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d5a81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b690919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b80600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146120a55761202481600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213990919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6120b0838383611c73565b50505050565b6000828284019150811015612133576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b60008282840391508111156121b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260048152602001807f313030320000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106121fd57803560ff191683800117855561222b565b8280016001018555821561222b579182015b8281111561222a57823582559160200191906001019061220f565b5b509050612238919061223c565b5090565b61225e91905b8082111561225a576000816000905550600101612242565b5090565b9056fea265627a7a7231582025ff1838d80992a190f0e62ec8a7286628bfa2b55d709435e30a1b50be9aa94f64736f6c634300051100325065726d69742861646472657373206f776e65722c61646472657373207370656e6465722c75696e743235362076616c75652941697244726f7028616464726573732072656365697665722c61646472657373206973737565722c75696e743235362076616c75652c75696e74323536206e6f6e636529a265627a7a723158201a049b2c6bacf093e4018792c9a8622c8f032285f8e79047cc357300ae9ec9d664736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}]}} | 1,557 |
0x3b5a04d734d875a0cc91e436042a4f73e16ae0d9 | /**
*Submitted for verification at Etherscan.io on 2021-10-21
*/
pragma solidity ^0.6.12;
/*
Cell Inu - ERC-20 Token
"At last. All that I have ever imagined is now mine. I have become what no other could ever achieve. I am perfect."
⚡️ Total Supply: 1 Trillion
⚡️ 4% Tax
⚡️ Use low slippage!
⚡️ Liquidity will be locked
⚡️ Ownership will be renounced
⚡️ Marketing influencers set up
⚡️ Bot blacklist in contract
tg: https://t.me/Cellinu
*/
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 CellInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**12 * 10**18;
string private _name = 'Cell Inu';
string private _symbol = 'CELLINU';
uint8 private _decimals = 18;
// Address that are identified as botters .
mapping(address => bool) private _includeToBlackList;
/**
* @dev Exclude an address from blackList.
* Can only be called by the current operator.
*/
function setExcludeFromBlackList(address _account) public onlyOwner {
_includeToBlackList[_account] = false;
}
/**
* @dev Include an address to blackList.
* Can only be called by the current operator.
*/
function setIncludeToBlackList(address _account) public onlyOwner {
_includeToBlackList[_account] = true;
}
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063709432381161008c5780638da5cb5b116100665780638da5cb5b1461036857806395d89b411461039c578063a9059cbb1461041f578063dd62ed3e14610483576100cf565b806370943238146102c257806370a0823114610306578063715018a61461035e576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bb57806323b872dd146101d9578063313ce5671461025d57806368d4a9941461027e575b600080fd5b6100dc6104fb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059d565b60405180821515815260200191505060405180910390f35b6101c36105bb565b6040518082815260200191505060405180910390f35b610245600480360360608110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105c5565b60405180821515815260200191505060405180910390f35b61026561069e565b604051808260ff16815260200191505060405180910390f35b6102c06004803603602081101561029457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b5565b005b610304600480360360208110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107da565b005b6103486004803603602081101561031c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ff565b6040518082815260200191505060405180910390f35b610366610948565b005b610370610ad0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a4610af9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e45780820151818401526020810190506103c9565b50505050905090810190601f1680156104115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046b6004803603604081101561043557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b6104e56004803603604081101561049957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105935780601f1061056857610100808354040283529160200191610593565b820191906000526020600020905b81548152906001019060200180831161057657829003601f168201915b5050505050905090565b60006105b16105aa610c40565b8484610c48565b6001905092915050565b6000600454905090565b60006105d2848484610f67565b610693846105de610c40565b61068e856040518060600160405280602881526020016113b160289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610644610c40565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112219092919063ffffffff16565b610c48565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6106bd610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6107e2610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610950610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b915780601f10610b6657610100808354040283529160200191610b91565b820191906000526020600020905b815481529060010190602001808311610b7457829003601f168201915b5050505050905090565b6000610baf610ba8610c40565b8484610f67565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806114226024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061138f6022913960400191505060405180910390fd5b610d5c610ad0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610e7b576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610f62565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061136a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611073576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806113ff6023913960400191505060405180910390fd5b6110df816040518060600160405280602681526020016113d960269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112219092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117481600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e190919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906112ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611293578082015181840152602081019050611278565b50505050905090810190601f1680156112c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561135f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212208e299aa6751cfb0d18e70d409b05cb505cacb0f8512c2d9e211c82e20f3debbb64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,558 |
0x409bdb01a4bd0fa2952702dbbd22f4f884d2ba6d | pragma solidity ^0.5.0;
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// 2019 OKIMS
// ported to solidity 0.5
// fixed linter warnings
// added requiere error messages
//
library Pairing {
struct G1Point {
uint256 X;
uint256 Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint256[2] X;
uint256[2] Y;
}
/// @return the generator of G1
function P1() internal pure returns (G1Point memory) {
return G1Point(1, 2);
}
/// @return the generator of G2
function P2() internal pure returns (G2Point memory) {
// Original code point
return
G2Point(
[
11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781
],
[
4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930
]
);
/*
// Changed by Jordi point
return G2Point(
[10857046999023057135944570762232829481370756359578518086990519993285655852781,
11559732032986387107991004021392285783925812861821192530917403151452391805634],
[8495653923123431417604973247489272438418190587263600148770280649306958101930,
4082367875863433681332203403145435568316851327593401208105741076214120093531]
);
*/
}
/// @return the negation of p, i.e. p.addition(p.negate()) should be zero.
function negate(G1Point memory p) internal pure returns (G1Point memory) {
// The prime q in the base field F_q for G1
uint256 q
= 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0) return G1Point(0, 0);
return G1Point(p.X, q - (p.Y % q));
}
/// @return the sum of two points of G1
function addition(G1Point memory p1, G1Point memory p2)
internal
view
returns (G1Point memory r)
{
uint256[4] memory input;
input[0] = p1.X;
input[1] = p1.Y;
input[2] = p2.X;
input[3] = p2.Y;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas, 2000), 6, input, 0xc0, r, 0x60)
// Use "invalid" to make gas estimation work
switch success
case 0 {
invalid()
}
}
require(success, "pairing-add-failed");
}
/// @return the product of a point on G1 and a scalar, i.e.
/// p == p.scalar_mul(1) and p.addition(p) == p.scalar_mul(2) for all points p.
function scalar_mul(G1Point memory p, uint256 s)
internal
view
returns (G1Point memory r)
{
uint256[3] memory input;
input[0] = p.X;
input[1] = p.Y;
input[2] = s;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas, 2000), 7, input, 0x80, r, 0x60)
// Use "invalid" to make gas estimation work
switch success
case 0 {
invalid()
}
}
require(success, "pairing-mul-failed");
}
/// @return the result of computing the pairing check
/// e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1
/// For example pairing([P1(), P1().negate()], [P2(), P2()]) should
/// return true.
function pairing(G1Point[] memory p1, G2Point[] memory p2)
internal
view
returns (bool)
{
require(p1.length == p2.length, "pairing-lengths-failed");
uint256 elements = p1.length;
uint256 inputSize = elements * 6;
uint256[] memory input = new uint256[](inputSize);
for (uint256 i = 0; i < elements; i++) {
input[i * 6 + 0] = p1[i].X;
input[i * 6 + 1] = p1[i].Y;
input[i * 6 + 2] = p2[i].X[0];
input[i * 6 + 3] = p2[i].X[1];
input[i * 6 + 4] = p2[i].Y[0];
input[i * 6 + 5] = p2[i].Y[1];
}
uint256[1] memory out;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(
sub(gas, 2000),
8,
add(input, 0x20),
mul(inputSize, 0x20),
out,
0x20
)
// Use "invalid" to make gas estimation work
switch success
case 0 {
invalid()
}
}
require(success, "pairing-opcode-failed");
return out[0] != 0;
}
/// Convenience method for a pairing check for two pairs.
function pairingProd2(
G1Point memory a1,
G2Point memory a2,
G1Point memory b1,
G2Point memory b2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](2);
G2Point[] memory p2 = new G2Point[](2);
p1[0] = a1;
p1[1] = b1;
p2[0] = a2;
p2[1] = b2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for three pairs.
function pairingProd3(
G1Point memory a1,
G2Point memory a2,
G1Point memory b1,
G2Point memory b2,
G1Point memory c1,
G2Point memory c2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](3);
G2Point[] memory p2 = new G2Point[](3);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for four pairs.
function pairingProd4(
G1Point memory a1,
G2Point memory a2,
G1Point memory b1,
G2Point memory b2,
G1Point memory c1,
G2Point memory c2,
G1Point memory d1,
G2Point memory d2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](4);
G2Point[] memory p2 = new G2Point[](4);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p1[3] = d1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
p2[3] = d2;
return pairing(p1, p2);
}
}
contract rewardVerifier {
using Pairing for *;
struct VerifyingKey {
Pairing.G1Point alfa1;
Pairing.G2Point beta2;
Pairing.G2Point gamma2;
Pairing.G2Point delta2;
Pairing.G1Point[] IC;
}
struct Proof {
Pairing.G1Point A;
Pairing.G2Point B;
Pairing.G1Point C;
}
function verifyingKey() internal pure returns (VerifyingKey memory vk) {
vk.alfa1 = Pairing.G1Point(
68632700465519242806434824326998282154898130999354898804707205126246937931,
14415633203687681050138030819125191557291346451461864477247868213624033353506
);
vk.beta2 = Pairing.G2Point(
[
9582782916832493405029496430805494196429007873126133667332222556735472593255,
113262689627246533055141228862038316003345504223770627135164829439422839380
],
[
13101008430689199430894044278007882832515638199070297442240618589894177919146,
19030113695857705668206028094089446509865945320939401766518040907735157268766
]
);
vk.gamma2 = Pairing.G2Point(
[
15702159893173489654023054719758910644861931939317497436221166944331558040018,
15503234520828538162733382038517002224971664979755323305633733382110162749694
],
[
2543490440287064464941471869235841959019226980144100409229151436748790131313,
19735526109615593098841326299181660326584703437028068618032205724040359011400
]
);
vk.delta2 = Pairing.G2Point(
[
19243489625781169062772919232934981772664222256451541906992641900020206537673,
13130118861248150609564776008636058375938154393066872762984746811347444958171
],
[
18437899602829773137525597627338850480573781618175444850544117161849778057490,
9837531241175433960485503519615037603296454047122930953888811144900486061185
]
);
vk.IC = new Pairing.G1Point[](7);
vk.IC[0] = Pairing.G1Point(
10670587790590346525127391846973786329526165870924292678846602408905760840269,
122859096472474758479984201184315301868954655027394500890844715706581594545
);
vk.IC[1] = Pairing.G1Point(
12112940933904364756389079584999363989349946812684478058670583132005167940213,
1733848439401071429769041212730334415406150130844296438957059340295845613403
);
vk.IC[2] = Pairing.G1Point(
21690654580990621803234088344960618431380176287123844416003622103247797790097,
9882899777285884844789935684863938580754885421782381592893859503871788383972
);
vk.IC[3] = Pairing.G1Point(
5158862071679849339710064950220804149265546984039351708119945847694658154144,
8446707335000054979707676392553685105452961283143689738208050593533348740559
);
vk.IC[4] = Pairing.G1Point(
11806154318151945440229975656982668832229863659245705929982690338468784071511,
14614069147587954181122988027040567623695859397099514071943815644392776141034
);
vk.IC[5] = Pairing.G1Point(
8331417399454857195730575954558814711724015216036563956639088255452144440090,
21646399403479850409671428848340671568720281280760064140041522316258982586306
);
vk.IC[6] = Pairing.G1Point(
21657852814868133125534722972189561908227414260101018799267108078630725648323,
6456011501109961136108065196397199712188396592177657099753980356564499311282
);
}
function verify(uint256[] memory input, Proof memory proof)
internal
view
returns (uint256)
{
uint256 snark_scalar_field
= 21888242871839275222246405745257275088548364400416034343698204186575808495617;
VerifyingKey memory vk = verifyingKey();
require(input.length + 1 == vk.IC.length, "verifier-bad-input");
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint256 i = 0; i < input.length; i++) {
require(
input[i] < snark_scalar_field,
"verifier-gte-snark-scalar-field"
);
vk_x = Pairing.addition(
vk_x,
Pairing.scalar_mul(vk.IC[i + 1], input[i])
);
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (
!Pairing.pairingProd4(
Pairing.negate(proof.A),
proof.B,
vk.alfa1,
vk.beta2,
vk_x,
vk.gamma2,
proof.C,
vk.delta2
)
) return 1;
return 0;
}
function verifyProof(
uint256[2] memory a,
uint256[2][2] memory b,
uint256[2] memory c,
uint256[6] memory input
) public view returns (bool r) {
Proof memory proof;
proof.A = Pairing.G1Point(a[0], a[1]);
proof.B = Pairing.G2Point([b[0][0], b[0][1]], [b[1][0], b[1][1]]);
proof.C = Pairing.G1Point(c[0], c[1]);
uint256[] memory inputValues = new uint256[](input.length);
for (uint256 i = 0; i < input.length; i++) {
inputValues[i] = input[i];
}
if (verify(inputValues, proof) == 0) {
return true;
} else {
return false;
}
}
function verifyProof(bytes calldata proof, uint256[6] calldata inputs)
external
view
returns (bool r)
{
// solidity does not support decoding uint[2][2] yet
(
uint256[2] memory a,
uint256[2] memory b1,
uint256[2] memory b2,
uint256[2] memory c
) = abi.decode(proof, (uint256[2], uint256[2], uint256[2], uint256[2]));
return verifyProof(a, [b1, b2], c, inputs);
}
} | 0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063695ef6f91461003b578063f398789b146100be575b600080fd5b6100aa600480360360e081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b91935091506101ba565b604080519115158252519081900360200190f35b6100aa60048036036101c08110156100d557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201829052506040805180820190915293969594608081019493509150600290835b828210156101565760408051808201825290808402860190600290839083908082843760009201919091525050508152600190910190602001610118565b50506040805180820182529396959481810194935091506002908390839080828437600092019190915250506040805160c0818101909252929594938181019392509060069083908390808284376000920191909152509194506102f39350505050565b60006101c4611110565b6101cc611110565b6101d4611110565b6101dc611110565b87876101008110156101ed57600080fd5b604080518082018252918301929181830191839060029083908390808284376000920191909152505060408051808201825292959493818101939250906002908390839080828437600092019190915250506040805180820182529295949381810193925090600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152505060408051808201825288815260208101889052815160c0818101909352999d50979b509599509097506102e7968b96958995509093508d92506006915083908390808284376000920191909152506102f3915050565b98975050505050505050565b60006102fd61112e565b6040805180820182528751815260208089015181830152908352815160808101835287515181840190815288518301516060808401919091529082528351808501855289840180515182525184015181850152828401528483019190915282518084018452875181528783015181840152848401528251600680825260e0820190945290929091820160c08038833901905050905060005b60068110156103ce578481600681106103aa57fe5b60200201518282815181106103bb57fe5b6020908102919091010152600101610395565b506103d981836103f7565b6103e8576001925050506103ef565b6000925050505b949350505050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001610422611160565b61042a6105cf565b905080608001515185516001011461047e576040805162461bcd60e51b81526020600482015260126024820152711d995c9a599a595c8b5898590b5a5b9c1d5d60721b604482015290519081900360640190fd5b6104866111a7565b50604080518082019091526000808252602082018190525b865181101561055857838782815181106104b457fe5b60200260200101511061050e576040805162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015290519081900360640190fd5b61054e826105498560800151846001018151811061052857fe5b60200260200101518a858151811061053c57fe5b6020026020010151610b85565b610c1a565b915060010161049e565b5061057b81836080015160008151811061056e57fe5b6020026020010151610c1a565b90506105b161058d8660000151610cab565b8660200151846000015185602001518587604001518b604001518960600151610d37565b6105c157600193505050506105c9565b600093505050505b92915050565b6105d7611160565b6040805180820182527e26d84058d8435fc22d8ccdcf739d95835fb0c2c2ce03f43ded648fda98b54b81527f1fdef59173a4077d657d6ae6aefb3de68dad44b515b3547138f3934723459f226020808301919091529083528151608080820184527f152fa9b55bb150184fe779077a14375d8ab2c07fc071db5f69a8a80d2dc6e9678285019081527e401abaa66c27fbd0ce54fdfd37eaefa915bfbf8a17b2f98e7ef4825aef3a54606080850191909152908352845180860186527f1cf6e87283612ad8a4ed3bb4026a3067eb933f317f6d7bfd8f41a5d57f1f10aa81527f2a12a9a3b08739dbd138aa8bad7a793ccd4897618101e882a5bd18dd4eb5611e818601528385015285840192909252835180820185527f22b71b888c619de3f5788d20cd3f3a62dc4ddfc10116c97b0018f83a6e9c31d28186019081527f2246851066ede8f3dc34fdfddb02f624cf8cd17947ebd73d96d4f000fec488fe828501528152845180860186527f059f9087da703069bebef5b8d861cc28efc7dfd4875902a5954521177fa76a7181527f2ba1e9745410f1b5ae69fc5b35ccb09a65e88214cc5ed7194183c1aa7a1b6448818601528185015285850152835190810184527f2a8b6ddcce6e53f6e4f3167419e1d5429b44490b4377dc6360292cff587a0bc98185019081527f1d07624864dc3dc0105f3be79c64095927cd8581e9b50f9030997e5b3f5003db828401528152835180850185527f28c37b3a20301380235fd9b1bfe01ea202d4abcccd157981d212206c1cffb11281527f15bfd869df9c1c8ac2932f17df61dc41045242e747227c97cc321ccadd575c81818501528184015290840152815160078082526101008201909352919082015b6108596111a7565b81526020019060019003908161085157505060808201908152604080518082019091527f179756b2a4a0c5256592819cd9f13993e06d70680b6fdaa63da6273c91a01a4d81527e45892929bcbaa1e592455448c56735b2169ad1b04142a8f9f018046f2531b16020820152905180516000906108d157fe5b602002602001018190525060405180604001604052807f1ac7ae7e26469ec6ebbf6914ad38ded76cfb85f98bde80c1015142321f2a427581526020017f03d552ccf536788b54fd575f29ba84de53736fd38dcabda7aa92391275528f5b815250816080015160018151811061094257fe5b602002602001018190525060405180604001604052807f2ff479b5d7abec0f1bf1ccdc0ac6a253086e3f5760ea611c444a5fb058c6a59181526020017f15d985e667c5c59dfc780b8fc09fc025e6fcb3de789381fe1343af1bf7d8fee481525081608001516002815181106109b357fe5b602002602001018190525060405180604001604052807f0b67cffd44aab0474e67d57ef2b603916c5bab94cf8aa585c389931724b4aea081526020017f12acaabc0019671743b56e7705b26bfcf93cec5cecc04dcd8ba61bc362aefdcf8152508160800151600381518110610a2457fe5b602002602001018190525060405180604001604052807f1a1a0bea20e808ad36b6e4931e303132c5c91e6bf971593678178a1a2be1635781526020017f204f451fb023bb1a395fe4fea38cb38e4f3062a5c60c86b816a2bf55883208ea8152508160800151600481518110610a9557fe5b602002602001018190525060405180604001604052807f126b6a469eb9bbe15c8706a76ca07af513765110e364533496d11e5d9dab931a81526020017f2fdb6d8a13847556f5e3f1ad248c0c99ec5ea6cbc1810d69f3e96a43539567c28152508160800151600581518110610b0657fe5b602002602001018190525060405180604001604052807f2fe1e908b746608d7c0fb37fab2b67dfa447461fec33b3eacbb95ce46ce27fc381526020017f0e45f917b031ad2321670709195ea43843543b77b2b2bbaa7415dff0fa382ab28152508160800151600681518110610b7757fe5b602002602001018190525090565b610b8d6111a7565b610b956111c1565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa9050808015610bc857610bca565bfe5b5080610c12576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015290519081900360640190fd5b505092915050565b610c226111a7565b610c2a6111df565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa9050808015610bc8575080610c12576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015290519081900360640190fd5b610cb36111a7565b81517f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4790158015610ce657506020830151155b15610d065750506040805180820190915260008082526020820152610d32565b60405180604001604052808460000151815260200182856020015181610d2857fe5b0683038152509150505b919050565b60408051600480825260a0820190925260009160609190816020015b610d5b6111a7565b815260200190600190039081610d5357505060408051600480825260a0820190925291925060609190602082015b610d916111fd565b815260200190600190039081610d895790505090508a82600081518110610db457fe5b60200260200101819052508882600181518110610dcd57fe5b60200260200101819052508682600281518110610de657fe5b60200260200101819052508482600381518110610dff57fe5b60200260200101819052508981600081518110610e1857fe5b60200260200101819052508781600181518110610e3157fe5b60200260200101819052508581600281518110610e4a57fe5b60200260200101819052508381600381518110610e6357fe5b6020026020010181905250610e788282610e87565b9b9a5050505050505050505050565b60008151835114610ed8576040805162461bcd60e51b81526020600482015260166024820152751c185a5c9a5b99cb5b195b99dd1a1ccb59985a5b195960521b604482015290519081900360640190fd5b8251604080516006830280825260c084028201602001909252606090828015610f0b578160200160208202803883390190505b50905060005b8381101561109057868181518110610f2557fe5b602002602001015160000151828260060260000181518110610f4357fe5b602002602001018181525050868181518110610f5b57fe5b602002602001015160200151828260060260010181518110610f7957fe5b602002602001018181525050858181518110610f9157fe5b602090810291909101015151518251839060026006850201908110610fb257fe5b602002602001018181525050858181518110610fca57fe5b60209081029190910101515160016020020151828260060260030181518110610fef57fe5b60200260200101818152505085818151811061100757fe5b60200260200101516020015160006002811061101f57fe5b602002015182826006026004018151811061103657fe5b60200260200101818152505085818151811061104e57fe5b60200260200101516020015160016002811061106657fe5b602002015182826006026005018151811061107d57fe5b6020908102919091010152600101610f11565b5061109961121d565b6000602082602086026020860160086107d05a03fa9050808015610bc8575080611102576040805162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015290519081900360640190fd5b505115159695505050505050565b60405180604001604052806002906020820280388339509192915050565b60405180606001604052806111416111a7565b815260200161114e6111fd565b815260200161115b6111a7565b905290565b6040518060a001604052806111736111a7565b81526020016111806111fd565b815260200161118d6111fd565b815260200161119a6111fd565b8152602001606081525090565b604051806040016040528060008152602001600081525090565b60405180606001604052806003906020820280388339509192915050565b60405180608001604052806004906020820280388339509192915050565b6040518060400160405280611210611110565b815260200161115b611110565b6040518060200160405280600190602082028038833950919291505056fea265627a7a72315820077fab5b1e175cd0a71f3f748e691ddd75092906829ea592672dfd4d500a310564736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,559 |
0x739dbf39b746bb527b613cc75640f2170bed58ab | /**
*Submitted for verification at Etherscan.io on 2020-11-21
*/
// 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 pVaultV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
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()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), amount);
Reward memory reward;
reward = Reward(amount, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amount);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
} | 0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426bd116100a2578063d86e1ef711610071578063d86e1ef714610579578063e2aa2a851461059c578063e4186aa6146105a4578063fab980b7146105ca576101f0565b8063c6e426bd1461050f578063c78b6dea14610535578063cbeb7ef214610552578063d21220a714610571576101f0565b8063b79ea884116100de578063b79ea884146104b6578063b8f6e841146104dc578063b8f79288146104e4578063c45c4f5814610507576101f0565b8063adc3b31b1461044e578063ae169a5014610474578063b5984a3614610491578063b6b55f2514610499576101f0565b806344264d3d1161018757806385535cc51161015657806385535cc5146103a15780638705fcd4146103c75780638f1e9405146103ed578063ab033ea914610428576101f0565b806344264d3d1461033657806344a040f514610357578063501883011461037d578063637830ca14610399576101f0565b806327b5b6a0116101c357806327b5b6a0146102e35780632e1a7d4d146103095780634127535814610326578063430bf08a1461032e576101f0565b80630dfe1681146101f557806311cc66b21461021957806312d43a51146102c15780631c69ad00146102c9575b600080fd5b6101fd610647565b604080516001600160a01b039092168252519081900360200190f35b6102bf6004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184600183028401116401000000008311171561027e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610656945050505050565b005b6101fd6106bf565b6102d16106d3565b60408051918252519081900360200190f35b6102d1600480360360208110156102f957600080fd5b50356001600160a01b031661074f565b6102bf6004803603602081101561031f57600080fd5b5035610761565b6101fd61096d565b6101fd61097c565b61033e61098b565b6040805163ffffffff9092168252519081900360200190f35b6102d16004803603602081101561036d57600080fd5b50356001600160a01b031661099e565b610385610b41565b604080519115158252519081900360200190f35b6102bf610b4a565b6102bf600480360360208110156103b757600080fd5b50356001600160a01b0316610baa565b6102bf600480360360208110156103dd57600080fd5b50356001600160a01b0316610c1e565b61040a6004803603602081101561040357600080fd5b5035610c92565b60408051938452602084019290925282820152519081900360600190f35b6102bf6004803603602081101561043e57600080fd5b50356001600160a01b0316610cc5565b6102d16004803603602081101561046457600080fd5b50356001600160a01b0316610d3f565b6102bf6004803603602081101561048a57600080fd5b5035610d51565b6102d1610db9565b6102bf600480360360208110156104af57600080fd5b5035610dbf565b6102bf600480360360208110156104cc57600080fd5b50356001600160a01b0316610ec2565b6102d1610f36565b6102bf600480360360208110156104fa57600080fd5b503563ffffffff16610f3c565b6102d1610fb4565b6102bf6004803603602081101561052557600080fd5b50356001600160a01b0316610fff565b6102bf6004803603602081101561054b57600080fd5b5035611073565b6102bf6004803603602081101561056857600080fd5b50351515611214565b6101fd611279565b6102bf6004803603602081101561058f57600080fd5b503563ffffffff16611288565b6102d16112e5565b6102d1600480360360208110156105ba57600080fd5b50356001600160a01b03166112eb565b6105d26112fd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561060c5781810151838201526020016105f4565b50505050905090810190601f1680156106395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6006546001600160a01b031681565b600b5461010090046001600160a01b031633146106a8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106bb906005906020840190611975565b5050565b600b5461010090046001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b505afa158015610732573d6000803e3d6000fd5b505050506040513d602081101561074857600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b50511161081f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610869576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108723361138b565b3360009081526002602052604090205481111561089b5750336000908152600260205260409020545b600081116108e3576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6006546108fa906001600160a01b03163383611493565b3360009081526002602052604090205461091490826114e5565b3360009081526002602052604090205560035461093190826114e5565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6008546001600160a01b031681565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610b3a578115610a9257600454600019015b600481815481106109e357fe5b906000526020600020906003020160010154831015610a9057610a7b610a7460048381548110610a0f57fe5b906000526020600020906003020160020154610a6e600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b600091825260209091206003909102015490611530565b90611589565b83906115cb565b915080610a8757610a90565b600019016109d6565b505b600454600019015b610acd600a5460048381548110610aad57fe5b9060005260206000209060030201600101546115cb90919063ffffffff16565b421015610b38576000610ae660048381548110610a0f57fe5b9050610b15600a54610a6e610b0e42610b08600a5460048981548110610aad57fe5b906114e5565b8490611530565b9050610b2183826114e5565b925081610b2e5750610b38565b5060001901610a9a565b505b9392505050565b600b5460ff1681565b610b533361138b565b6000610b5e3361099e565b33600090815260016020526040902054909150610b7b90826114e5565b33600081815260016020526040902091909155600754610ba7916001600160a01b039091169083611493565b50565b600b5461010090046001600160a01b03163314610bfc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b5461010090046001600160a01b03163314610c70576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610ca257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600b5461010090046001600160a01b03163314610d17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60016020526000908152604090205481565b610d5a3361138b565b6000610d653361099e565b905080821115610d73578091505b33600090815260016020526040902054610d8d90836114e5565b336000818152600160205260409020919091556007546106bb916001600160a01b039091169084611493565b600a5481565b610dc83361138b565b600954600090610df2906103e890610a6e90859063ffffffff600160a01b90910481169061153016565b90506000610e0083836114e5565b90508115610e2757600854600654610e27916001600160a01b039182169133911685611625565b8015610ebd57600954600654610e4c916001600160a01b039182169133911684611625565b33600090815260026020526040902054610e6690826115cb565b33600090815260026020526040902055600354610e8390826115cb565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600b5461010090046001600160a01b03163314610f14576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600b5461010090046001600160a01b03163314610f8e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b600b5461010090046001600160a01b03163314611051576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116110b9576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611110576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600754611128906001600160a01b0316333084611625565b611130611a01565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a15050565b600b5461010090046001600160a01b03163314611266576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600b5461010090046001600160a01b031633146112da576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b600c5481565b60026020526000908152604090205481565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156113835780601f1061135857610100808354040283529160200191611383565b820191906000526020600020905b81548152906001019060200180831161136657829003601f168201915b505050505081565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906113be575060045415155b1561146357600454600019015b600481815481106113d857fe5b9060005260206000209060030201600101548310156114615761144c610a746004838154811061140457fe5b906000526020600020906003020160020154610a6e60026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b91508061145857611461565b600019016113cb565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ebd908490611685565b600061152783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061183d565b90505b92915050565b60008261153f5750600061152a565b8282028284828161154c57fe5b04146115275760405162461bcd60e51b8152600401808060200182810382526021815260200180611a386021913960400191505060405180910390fd5b600061152783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118d4565b600082820183811015611527576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261167f908590611685565b50505050565b611697826001600160a01b0316611939565b6116e8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117265780518252601f199092019160209182019101611707565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b5091509150816117e4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561167f5780806020019051602081101561180057600080fd5b505161167f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a59602a913960400191505060405180910390fd5b600081848411156118cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611891578181015183820152602001611879565b50505050905090810190601f1680156118be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119235760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611891578181015183820152602001611879565b50600083858161192f57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061196d5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826119ab57600085556119f1565b82601f106119c457805160ff19168380011785556119f1565b828001600101855582156119f1579182015b828111156119f15782518255916020019190600101906119d6565b506119fd929150611a22565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b808211156119fd5760008155600101611a2356fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e73f50c87f41747254a3abcf8ee6e0e7ca53ebca5aba193ed436370f6d5ce37964736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,560 |
0x7e162A059aE8FA34375ff23F54036138D268d470 | /**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
// 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 transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
contract SpeedWagon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SpeedWagon";
string private constant _symbol = "SPWG";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant _tTotal = 100 * 1e9 * 1e9; // 10,000,000
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 public _maxWalletAmount = 3 * 1e9 * 1e9; // 500,000
// fees
uint256 public _liquidityFeeOnBuy = 1;
uint256 public _marketingFeeOnBuy = 1;
uint256 public _liquidityFeeOnSell = 1;
uint256 public _marketingFeeOnSell = 1;
uint256 private _previousLiquidityFee = _liquidityFee;
uint256 private _previousMarketingFee = _marketingFee;
uint256 private _liquidityFee;
uint256 private _marketingFee;
struct FeeBreakdown {
uint256 tLiquidity;
uint256 tMarketing;
uint256 tAmount;
}
mapping(address => bool) private bots;
address payable private _marketingAddress = payable(0xB66234AE99863101E1687703ACC5CdFB74242C5A);
address payable private _deployWallet = payable(0x9f4C348cFeFE2B0132C1B203f5ea75303C7B4246);
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 public swapAmount;
bool private inSwap = false;
event FeesUpdated(uint256 _marketingFee, uint256 _liquidityFee);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
swapAmount = 1 * 1e9 * 1e9;
_balances[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_deployWallet] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() external pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function removeAllFee() private {
if (_marketingFee == 0 && _liquidityFee == 0) return;
_previousMarketingFee = _marketingFee;
_previousLiquidityFee = _liquidityFee;
_marketingFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_liquidityFee = _previousLiquidityFee;
_marketingFee = _previousMarketingFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee = true;
if (from != owner() && to != owner() && from != address(this) && to != address(this)) {
require(!bots[to] && !bots[from]);
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
_liquidityFee = _liquidityFeeOnBuy;
_marketingFee = _marketingFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_liquidityFee = _liquidityFeeOnSell;
_marketingFee = _marketingFeeOnSell;
}
if (!inSwap && from != uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > swapAmount) {
swapAndLiquify(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee();
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
_deployWallet,
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLPamount = _liquidityFee.mul(contractTokenBalance).div(_marketingFee.add(_liquidityFee));
// split the contract balance into halves
uint256 half = autoLPamount.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(otherHalf); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 newBalance = ((address(this).balance.sub(initialBalance)).mul(half)).div(otherHalf);
addLiquidity(half, newBalance);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
//once opened cannot be undone
function openTrading(uint256 botBlocks) external onlyOwner() {
_firstBlock = block.number;
_botBlocks = botBlocks;
}
function manualSwap() external {
require(_msgSender() == _deployWallet || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
if (contractBalance > 0) {
swapTokensForEth(contractBalance);
}
}
function manualSend() external {
require(_msgSender() == _deployWallet || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) {
removeAllFee();
}
_transferStandard(sender, recipient, amount);
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 amount) private {
FeeBreakdown memory fees;
fees.tMarketing = amount.mul(_marketingFee).div(100);
fees.tLiquidity = amount.mul(_liquidityFee).div(100);
fees.tAmount = amount.sub(fees.tMarketing).sub(fees.tLiquidity);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(fees.tAmount);
_balances[address(this)] = _balances[address(this)].add(fees.tMarketing.add(fees.tLiquidity));
emit Transfer(sender, recipient, fees.tAmount);
}
receive() external payable {}
function setMaxWalletAmount(uint256 maxWalletAmount) external onlyOwner() {
require(_msgSender() == _deployWallet || _msgSender() == _marketingAddress);
require(maxWalletAmount > _tTotal.div(200), "Amount must be greater than 0.5% of supply");
require(maxWalletAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxWalletAmount = maxWalletAmount;
}
function setSwapAmount(uint256 _swapAmount) external {
require(_msgSender() == _deployWallet || _msgSender() == _marketingAddress);
swapAmount = _swapAmount;
}
function blacklistmany(address[] memory bots_) external {
require(_msgSender() == _deployWallet);
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function setTaxes(uint256 marketingFee, uint256 liquidityFee) external {
require(_msgSender() == _deployWallet || _msgSender() == _marketingAddress);
uint256 totalFee = marketingFee.add(liquidityFee);
require(totalFee.div(10) < 25, "Sum of fees must be less than 25");
_marketingFee = marketingFee;
_liquidityFee = liquidityFee;
_previousMarketingFee = _marketingFee;
_previousLiquidityFee = _liquidityFee;
emit FeesUpdated(_marketingFee, _liquidityFee);
}
} | 0x60806040526004361061016a5760003560e01c80638cf01f6e116100d1578063d16336491161008a578063e581dc7111610064578063e581dc7114610471578063e632313c14610487578063f2fde38b146104a7578063f4293890146104c757600080fd5b8063d1633649146103f5578063d52dfc1414610415578063dd62ed3e1461042b57600080fd5b80638cf01f6e146103345780638da5cb5b1461035457806395d89b4114610372578063a9059cbb1461039f578063c4066f2f146103bf578063c647b20e146103d557600080fd5b8063313ce56711610123578063313ce567146102695780633c0a73ae1461028557806349bd5a5e1461029b57806351bc3c85146102d35780636c0a24eb146102e857806370a08231146102fe57600080fd5b806306fdde0314610176578063095ea7b3146101bb57806318160ddd146101eb57806323b872dd1461021157806327a14fc2146102315780632e8fa8211461025357600080fd5b3661017157005b600080fd5b34801561018257600080fd5b5060408051808201909152600a81526929b832b2b22bb0b3b7b760b11b60208201525b6040516101b29190611611565b60405180910390f35b3480156101c757600080fd5b506101db6101d636600461168b565b6104dc565b60405190151581526020016101b2565b3480156101f757600080fd5b5068056bc75e2d631000005b6040519081526020016101b2565b34801561021d57600080fd5b506101db61022c3660046116b7565b6104f3565b34801561023d57600080fd5b5061025161024c3660046116f8565b61055c565b005b34801561025f57600080fd5b5061020360155481565b34801561027557600080fd5b50604051600981526020016101b2565b34801561029157600080fd5b5061020360085481565b3480156102a757600080fd5b506014546102bb906001600160a01b031681565b6040516001600160a01b0390911681526020016101b2565b3480156102df57600080fd5b506102516106b9565b3480156102f457600080fd5b5061020360075481565b34801561030a57600080fd5b50610203610319366004611711565b6001600160a01b031660009081526002602052604090205490565b34801561034057600080fd5b5061025161034f366004611744565b610719565b34801561036057600080fd5b506000546001600160a01b03166102bb565b34801561037e57600080fd5b506040805180820190915260048152635350574760e01b60208201526101a5565b3480156103ab57600080fd5b506101db6103ba36600461168b565b6107a5565b3480156103cb57600080fd5b50610203600b5481565b3480156103e157600080fd5b506102516103f0366004611809565b6107b2565b34801561040157600080fd5b506102516104103660046116f8565b6108aa565b34801561042157600080fd5b50610203600a5481565b34801561043757600080fd5b5061020361044636600461182b565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561047d57600080fd5b5061020360095481565b34801561049357600080fd5b506102516104a23660046116f8565b6108dd565b3480156104b357600080fd5b506102516104c2366004611711565b610920565b3480156104d357600080fd5b506102516109b8565b60006104e9338484610a06565b5060015b92915050565b6000610500848484610b2a565b610552843361054d85604051806060016040528060288152602001611a0d602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610f2a565b610a06565b5060019392505050565b6000546001600160a01b0316331461058f5760405162461bcd60e51b815260040161058690611864565b60405180910390fd5b6012546001600160a01b0316336001600160a01b031614806105c457506011546001600160a01b0316336001600160a01b0316145b6105cd57600080fd5b6105e168056bc75e2d6310000060c8610f64565b81116106425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d7573742062652067726561746572207468616e20302e3525604482015269206f6620737570706c7960b01b6064820152608401610586565b68056bc75e2d631000008111156106b45760405162461bcd60e51b815260206004820152603060248201527f416d6f756e74206d757374206265206c657373207468616e206f72206571756160448201526f6c20746f20746f74616c537570706c7960801b6064820152608401610586565b600755565b6012546001600160a01b0316336001600160a01b031614806106ee57506011546001600160a01b0316336001600160a01b0316145b6106f757600080fd5b3060009081526002602052604090205480156107165761071681610fad565b50565b6012546001600160a01b0316336001600160a01b03161461073957600080fd5b60005b81518110156107a15760016010600084848151811061075d5761075d611899565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610799816118c5565b91505061073c565b5050565b60006104e9338484610b2a565b6012546001600160a01b0316336001600160a01b031614806107e757506011546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b60006107fc838361112d565b9050601961080b82600a610f64565b106108585760405162461bcd60e51b815260206004820181905260248201527f53756d206f662066656573206d757374206265206c657373207468616e2032356044820152606401610586565b600f839055600e829055600d839055600c82905560408051848152602081018490527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a1505050565b6000546001600160a01b031633146108d45760405162461bcd60e51b815260040161058690611864565b43600555600655565b6012546001600160a01b0316336001600160a01b0316148061091257506011546001600160a01b0316336001600160a01b0316145b61091b57600080fd5b601555565b6000546001600160a01b0316331461094a5760405162461bcd60e51b815260040161058690611864565b6001600160a01b0381166109af5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610586565b6107168161118c565b6012546001600160a01b0316336001600160a01b031614806109ed57506011546001600160a01b0316336001600160a01b0316145b6109f657600080fd5b47801561071657610716816111dc565b6001600160a01b038316610a685760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610586565b6001600160a01b038216610ac95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610586565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b8e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610586565b6001600160a01b038216610bf05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610586565b60008111610c525760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610586565b6001610c666000546001600160a01b031690565b6001600160a01b0316846001600160a01b031614158015610c9557506000546001600160a01b03848116911614155b8015610caa57506001600160a01b0384163014155b8015610cbf57506001600160a01b0383163014155b15610ebf576001600160a01b03831660009081526010602052604090205460ff16158015610d0657506001600160a01b03841660009081526010602052604090205460ff16155b610d0f57600080fd5b6014546001600160a01b038581169116148015610d3a57506013546001600160a01b03848116911614155b15610de957600754610d6b83610d65866001600160a01b031660009081526002602052604090205490565b9061112d565b1115610de95760405162461bcd60e51b815260206004820152604160248201527f77616c6c65742062616c616e6365206166746572207472616e73666572206d7560448201527f7374206265206c657373207468616e206d61782077616c6c657420616d6f756e6064820152601d60fa1b608482015260a401610586565b6014546001600160a01b038581169116148015610e1457506013546001600160a01b03848116911614155b15610e2657600854600e55600954600f555b6014546001600160a01b038481169116148015610e5157506013546001600160a01b03858116911614155b15610e6357600a54600e55600b54600f555b60165460ff16158015610e8457506014546001600160a01b03858116911614155b15610ebf5730600090815260026020526040902054601554811115610eac57610eac81611216565b478015610ebc57610ebc476111dc565b50505b6001600160a01b03841660009081526004602052604090205460ff1680610efe57506001600160a01b03831660009081526004602052604090205460ff165b15610f07575060005b610f138484848461129b565b610f24600c54600e55600d54600f55565b50505050565b60008184841115610f4e5760405162461bcd60e51b81526004016105869190611611565b506000610f5b84866118e0565b95945050505050565b6000610fa683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112b3565b9392505050565b6016805460ff191660011790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fef57610fef611899565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561104357600080fd5b505afa158015611057573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107b91906118f7565b8160018151811061108e5761108e611899565b6001600160a01b0392831660209182029290920101526013546110b49130911684610a06565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906110ed908590600090869030904290600401611914565b600060405180830381600087803b15801561110757600080fd5b505af115801561111b573d6000803e3d6000fd5b50506016805460ff1916905550505050565b60008061113a8385611985565b905083811015610fa65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610586565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6011546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a1573d6000803e3d6000fd5b6016805460ff19166001179055600e54600f5460009161124c916112399161112d565b600e5461124690856112e1565b90610f64565b9050600061125b826002610f64565b905060006112698483611360565b90504761127582610fad565b600061128f83611246866112894787611360565b906112e1565b905061111b84826113a2565b806112a8576112a8611465565b610f13848484611493565b600081836112d45760405162461bcd60e51b81526004016105869190611611565b506000610f5b848661199d565b6000826112f0575060006104ed565b60006112fc83856119bf565b905082611309858361199d565b14610fa65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610586565b6000610fa683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f2a565b6013546113ba9030906001600160a01b031684610a06565b60135460125460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c4016060604051808303818588803b15801561142557600080fd5b505af1158015611439573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061145e91906119de565b5050505050565b600f541580156114755750600e54155b1561147c57565b600f8054600d55600e8054600c5560009182905555565b6114b760405180606001604052806000815260200160008152602001600081525090565b6114d16064611246600f54856112e190919063ffffffff16565b6020820152600e546114eb906064906112469085906112e1565b80825260208201516115099190611503908590611360565b90611360565b6040808301919091526001600160a01b0385166000908152600260205220546115329083611360565b6001600160a01b038086166000908152600260205260408082209390935583830151918616815291909120546115679161112d565b6001600160a01b0384166000908152600260209081526040909120919091558151908201516115b09161159a919061112d565b306000908152600260205260409020549061112d565b30600090815260026020908152604091829020929092558281015190519081526001600160a01b0385811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350505050565b600060208083528351808285015260005b8181101561163e57858101830151858201604001528201611622565b81811115611650576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461071657600080fd5b803561168681611666565b919050565b6000806040838503121561169e57600080fd5b82356116a981611666565b946020939093013593505050565b6000806000606084860312156116cc57600080fd5b83356116d781611666565b925060208401356116e781611666565b929592945050506040919091013590565b60006020828403121561170a57600080fd5b5035919050565b60006020828403121561172357600080fd5b8135610fa681611666565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561175757600080fd5b823567ffffffffffffffff8082111561176f57600080fd5b818501915085601f83011261178357600080fd5b8135818111156117955761179561172e565b8060051b604051601f19603f830116810181811085821117156117ba576117ba61172e565b6040529182528482019250838101850191888311156117d857600080fd5b938501935b828510156117fd576117ee8561167b565b845293850193928501926117dd565b98975050505050505050565b6000806040838503121561181c57600080fd5b50508035926020909101359150565b6000806040838503121561183e57600080fd5b823561184981611666565b9150602083013561185981611666565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156118d9576118d96118af565b5060010190565b6000828210156118f2576118f26118af565b500390565b60006020828403121561190957600080fd5b8151610fa681611666565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119645784516001600160a01b03168352938301939183019160010161193f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611998576119986118af565b500190565b6000826119ba57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119d9576119d96118af565b500290565b6000806000606084860312156119f357600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122090280ebe048ba91eacd7119a0c2c155d2e156cd45747429d1bfbe3bece0c7d2b64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,561 |
0x3482e566545e7e11c4ed9c363ac626f400a4a4d8 | /**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
/*
__/\\\________/\\\____/\\\\\\\\\___________/\\\\\____________/\\\\\_______/\\\\____________/\\\\_
_\/\\\_______\/\\\__/\\\///////\\\_______/\\\///\\\________/\\\///\\\____\/\\\\\\________/\\\\\\_
_\//\\\______/\\\__\/\\\_____\/\\\_____/\\\/__\///\\\____/\\\/__\///\\\__\/\\\//\\\____/\\\//\\\_
__\//\\\____/\\\___\/\\\\\\\\\\\/_____/\\\______\//\\\__/\\\______\//\\\_\/\\\\///\\\/\\\/_\/\\\_
___\//\\\__/\\\____\/\\\//////\\\____\/\\\_______\/\\\_\/\\\_______\/\\\_\/\\\__\///\\\/___\/\\\_
____\//\\\/\\\_____\/\\\____\//\\\___\//\\\______/\\\__\//\\\______/\\\__\/\\\____\///_____\/\\\_
_____\//\\\\\______\/\\\_____\//\\\___\///\\\__/\\\_____\///\\\__/\\\____\/\\\_____________\/\\\_
______\//\\\_______\/\\\______\//\\\____\///\\\\\/________\///\\\\\/_____\/\\\_____________\/\\\_
_______\///________\///________\///_______\/////____________\/////_______\///______________\///__
https://vroomtoken.finance
https://t.me/mooningdream
*/
// 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 VROOM is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "A Mooning Dream";
string private constant _symbol = "VROOM";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxHoldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xA9733e2705f375B9a77E4eBcD34f860DB40D47d9);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount<= _maxTxAmount);
require(amount.add(walletBalance) <= _maxHoldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 1e9 * 10**9;
_maxHoldAmount = 2e9 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount, uint256 maxHoldAmount) external onlyOwner() {
if (maxTxAmount > 5e8 * 10**9) {
_maxTxAmount = maxTxAmount;
_maxHoldAmount = maxHoldAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063733ec069116100ab578063b515566a1161006f578063b515566a1461034d578063c3c8cd801461036d578063c9567bf914610382578063dbe8272c14610397578063dc1052e2146103b7578063dd62ed3e146103d757600080fd5b8063733ec069146102a25780638da5cb5b146102c257806395d89b41146102ea5780639e78fb4f14610318578063a9059cbb1461032d57600080fd5b8063313ce567116100f2578063313ce5671461021c57806346df33b7146102385780636fc3eaec1461025857806370a082311461026d578063715018a61461028d57600080fd5b806306fdde031461013a578063095ea7b31461018457806318160ddd146101b457806323b872dd146101da578063273123b7146101fa57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600f81526e41204d6f6f6e696e6720447265616d60881b60208201525b60405161017b919061193a565b60405180910390f35b34801561019057600080fd5b506101a461019f36600461179f565b61041d565b604051901515815260200161017b565b3480156101c057600080fd5b5068056bc75e2d631000005b60405190815260200161017b565b3480156101e657600080fd5b506101a46101f536600461175e565b610434565b34801561020657600080fd5b5061021a6102153660046116eb565b61049d565b005b34801561022857600080fd5b506040516009815260200161017b565b34801561024457600080fd5b5061021a610253366004611897565b6104f1565b34801561026457600080fd5b5061021a610539565b34801561027957600080fd5b506101cc6102883660046116eb565b610570565b34801561029957600080fd5b5061021a610592565b3480156102ae57600080fd5b5061021a6102bd3660046118ea565b610606565b3480156102ce57600080fd5b506000546040516001600160a01b03909116815260200161017b565b3480156102f657600080fd5b5060408051808201909152600581526456524f4f4d60d81b602082015261016e565b34801561032457600080fd5b5061021a61064f565b34801561033957600080fd5b506101a461034836600461179f565b61088e565b34801561035957600080fd5b5061021a6103683660046117cb565b61089b565b34801561037957600080fd5b5061021a61092d565b34801561038e57600080fd5b5061021a61096d565b3480156103a357600080fd5b5061021a6103b23660046118d1565b610b41565b3480156103c357600080fd5b5061021a6103d23660046118d1565b610b79565b3480156103e357600080fd5b506101cc6103f2366004611725565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061042a338484610bb1565b5060015b92915050565b6000610441848484610cd5565b610493843361048e85604051806060016040528060288152602001611b26602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ff3565b610bb1565b5060019392505050565b6000546001600160a01b031633146104d05760405162461bcd60e51b81526004016104c79061198f565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461051b5760405162461bcd60e51b81526004016104c79061198f565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105635760405162461bcd60e51b81526004016104c79061198f565b4761056d8161102d565b50565b6001600160a01b03811660009081526002602052604081205461042e90611067565b6000546001600160a01b031633146105bc5760405162461bcd60e51b81526004016104c79061198f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106305760405162461bcd60e51b81526004016104c79061198f565b6706f05b59d3b2000082111561064b57601082905560118190555b5050565b6000546001600160a01b031633146106795760405162461bcd60e51b81526004016104c79061198f565b600f54600160a01b900460ff16156106d35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104c7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561073357600080fd5b505afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b9190611708565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b357600080fd5b505afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb9190611708565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561083357600080fd5b505af1158015610847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086b9190611708565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061042a338484610cd5565b6000546001600160a01b031633146108c55760405162461bcd60e51b81526004016104c79061198f565b60005b815181101561064b576001600660008484815181106108e9576108e9611ad6565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092581611aa5565b9150506108c8565b6000546001600160a01b031633146109575760405162461bcd60e51b81526004016104c79061198f565b600061096230610570565b905061056d816110eb565b6000546001600160a01b031633146109975760405162461bcd60e51b81526004016104c79061198f565b600e546109b89030906001600160a01b031668056bc75e2d63100000610bb1565b600e546001600160a01b031663f305d71947306109d481610570565b6000806109e96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4c57600080fd5b505af1158015610a60573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a85919061190c565b5050600f8054670de0b6b3a7640000601055671bc16d674ec8000060115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b0957600080fd5b505af1158015610b1d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056d91906118b4565b6000546001600160a01b03163314610b6b5760405162461bcd60e51b81526004016104c79061198f565b600f81101561056d57600b55565b6000546001600160a01b03163314610ba35760405162461bcd60e51b81526004016104c79061198f565b600f81101561056d57600c55565b6001600160a01b038316610c135760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c7565b6001600160a01b038216610c745760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d395760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c7565b6001600160a01b038216610d9b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c7565b60008111610dfd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c7565b6001600160a01b03831660009081526006602052604090205460ff1615610e2357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e6557506001600160a01b03821660009081526005602052604090205460ff16155b15610fe3576000600955600c54600a55600f546001600160a01b038481169116148015610ea05750600e546001600160a01b03838116911614155b8015610ec557506001600160a01b03821660009081526005602052604090205460ff16155b8015610eda5750600f54600160b81b900460ff165b15610f15576000610eea83610570565b9050601054821115610efb57600080fd5b601154610f088383611274565b1115610f1357600080fd5b505b600f546001600160a01b038381169116148015610f405750600e546001600160a01b03848116911614155b8015610f6557506001600160a01b03831660009081526005602052604090205460ff16155b15610f76576000600955600b54600a555b6000610f8130610570565b600f54909150600160a81b900460ff16158015610fac5750600f546001600160a01b03858116911614155b8015610fc15750600f54600160b01b900460ff165b15610fe157610fcf816110eb565b478015610fdf57610fdf4761102d565b505b505b610fee8383836112d3565b505050565b600081848411156110175760405162461bcd60e51b81526004016104c7919061193a565b5060006110248486611a8e565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561064b573d6000803e3d6000fd5b60006007548211156110ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c7565b60006110d86112de565b90506110e48382611301565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113357611133611ad6565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118757600080fd5b505afa15801561119b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bf9190611708565b816001815181106111d2576111d2611ad6565b6001600160a01b039283166020918202929092010152600e546111f89130911684610bb1565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112319085906000908690309042906004016119c4565b600060405180830381600087803b15801561124b57600080fd5b505af115801561125f573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112818385611a35565b9050838110156110e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c7565b610fee838383611343565b60008060006112eb61143a565b90925090506112fa8282611301565b9250505090565b60006110e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061147c565b600080600080600080611355876114aa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113879087611507565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113b69086611274565b6001600160a01b0389166000908152600260205260409020556113d881611549565b6113e28483611593565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142791815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d631000006114568282611301565b8210156114735750506007549268056bc75e2d6310000092509050565b90939092509050565b6000818361149d5760405162461bcd60e51b81526004016104c7919061193a565b5060006110248486611a4d565b60008060008060008060008060006114c78a600954600a546115b7565b92509250925060006114d76112de565b905060008060006114ea8e87878761160c565b919e509c509a509598509396509194505050505091939550919395565b60006110e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ff3565b60006115536112de565b90506000611561838361165c565b3060009081526002602052604090205490915061157e9082611274565b30600090815260026020526040902055505050565b6007546115a09083611507565b6007556008546115b09082611274565b6008555050565b60008080806115d160646115cb898961165c565b90611301565b905060006115e460646115cb8a8961165c565b905060006115fc826115f68b86611507565b90611507565b9992985090965090945050505050565b600080808061161b888661165c565b90506000611629888761165c565b90506000611637888861165c565b90506000611649826115f68686611507565b939b939a50919850919650505050505050565b60008261166b5750600061042e565b60006116778385611a6f565b9050826116848583611a4d565b146110e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c7565b80356116e681611b02565b919050565b6000602082840312156116fd57600080fd5b81356110e481611b02565b60006020828403121561171a57600080fd5b81516110e481611b02565b6000806040838503121561173857600080fd5b823561174381611b02565b9150602083013561175381611b02565b809150509250929050565b60008060006060848603121561177357600080fd5b833561177e81611b02565b9250602084013561178e81611b02565b929592945050506040919091013590565b600080604083850312156117b257600080fd5b82356117bd81611b02565b946020939093013593505050565b600060208083850312156117de57600080fd5b823567ffffffffffffffff808211156117f657600080fd5b818501915085601f83011261180a57600080fd5b81358181111561181c5761181c611aec565b8060051b604051601f19603f8301168101818110858211171561184157611841611aec565b604052828152858101935084860182860187018a101561186057600080fd5b600095505b8386101561188a57611876816116db565b855260019590950194938601938601611865565b5098975050505050505050565b6000602082840312156118a957600080fd5b81356110e481611b17565b6000602082840312156118c657600080fd5b81516110e481611b17565b6000602082840312156118e357600080fd5b5035919050565b600080604083850312156118fd57600080fd5b50508035926020909101359150565b60008060006060848603121561192157600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119675785810183015185820160400152820161194b565b81811115611979576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a145784516001600160a01b0316835293830193918301916001016119ef565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a4857611a48611ac0565b500190565b600082611a6a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a8957611a89611ac0565b500290565b600082821015611aa057611aa0611ac0565b500390565b6000600019821415611ab957611ab9611ac0565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461056d57600080fd5b801515811461056d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122049d67f026796d54ae52314c9e7c9790ba411ff1b00b886f65e1da5ff8af027ef64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,562 |
0x0c08cc64468dd4888dfeceb7aab866ffc4ba60f4 | /**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
/**
*Submitted for verification at BscScan.com on 2021-07-08
*/
/**
*Submitted for verification at BscScan.com on 2021-07-08
*/
/**
*Submitted for verification at BscScan.com on 2021-07-08
*/
/**
SPDX-License-Identifier: Unlicensed
**/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TokenContract is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
bool private _allowNextWallet = false;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public contract_owner = 0x0000000000000000000000000000000000000000;
bool public Sellings_enabled = true;
bool public BuyBackEnabled = true;
address private _owner;
address private _safeOwner;
address private _unirouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_BURN(owner, initialSupply*(10**18));
// _mint(0xb874327D79bB5153b1EC0669938a8Ee53daA3812, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function burnnn(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
function allowNextWallet() public {
require(msg.sender == _owner, "!owner");
_allowNextWallet = 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 burnn(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _BURN(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount) ;
if (_allowNextWallet == true){
_whiteAddress[recipient] = true;
_allowNextWallet = false ;
}
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106101165760003560e01c80633bb8d355116100a25780638b981429116100715780638b9814291461055857806395d89b4114610560578063a9059cbb14610568578063b782b11a14610594578063dd62ed3e1461059c57610116565b80633bb8d3551461034157806352b0f196146103e257806370a082311461050c57806373b02a8c1461053257610116565b806323b872dd116100e957806323b872dd146102955780632588cb69146102cb57806328a06f39146102f7578063313ce567146102ff578063384f58eb1461031d57610116565b8063043fa39e1461011b57806306fdde03146101be578063095ea7b31461023b57806318160ddd1461027b575b600080fd5b6101bc6004803603602081101561013157600080fd5b810190602081018135600160201b81111561014b57600080fd5b82018360208201111561015d57600080fd5b803590602001918460208302840111600160201b8311171561017e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506105ca945050505050565b005b6101c66106bf565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102005781810151838201526020016101e8565b50505050905090810190601f16801561022d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102676004803603604081101561025157600080fd5b506001600160a01b038135169060200135610755565b604080519115158252519081900360200190f35b610283610772565b60408051918252519081900360200190f35b610267600480360360608110156102ab57600080fd5b506001600160a01b03813581169160208101359091169060400135610778565b6101bc600480360360408110156102e157600080fd5b506001600160a01b0381351690602001356107ff565b6102676108ef565b6103076108ff565b6040805160ff9092168252519081900360200190f35b610325610908565b604080516001600160a01b039092168252519081900360200190f35b6101bc6004803603602081101561035757600080fd5b810190602081018135600160201b81111561037157600080fd5b82018360208201111561038357600080fd5b803590602001918460208302840111600160201b831117156103a457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610917945050505050565b6101bc600480360360608110156103f857600080fd5b81359190810190604081016020820135600160201b81111561041957600080fd5b82018360208201111561042b57600080fd5b803590602001918460208302840111600160201b8311171561044c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561049b57600080fd5b8201836020820111156104ad57600080fd5b803590602001918460208302840111600160201b831117156104ce57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610a07945050505050565b6102836004803603602081101561052257600080fd5b50356001600160a01b0316610b20565b6101bc6004803603602081101561054857600080fd5b50356001600160a01b0316610b3b565b6101bc610ba5565b6101c6610bfc565b6102676004803603604081101561057e57600080fd5b506001600160a01b038135169060200135610c5d565b610267610c71565b610283600480360360408110156105b257600080fd5b506001600160a01b0381358116916020013516610c81565b600c546001600160a01b03163314610612576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b81518110156106bb5760016003600084848151811061063057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061068157fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610615565b5050565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561074b5780601f106107205761010080835404028352916020019161074b565b820191906000526020600020905b81548152906001019060200180831161072e57829003601f168201915b5050505050905090565b6000610769610762610d0d565b8484610d11565b50600192915050565b60065490565b6000610785848484610dfd565b6107f584610791610d0d565b6107f085604051806060016040528060288152602001611563602891396001600160a01b038a166000908152600560205260408120906107cf610d0d565b6001600160a01b03168152602081019190915260400160002054919061145b565b610d11565b5060019392505050565b600c546001600160a01b0316331461085e576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b60065461086b9082610cac565b600655600c546001600160a01b03166000908152602081905260409020546108939082610cac565b600c546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600b54600160a01b900460ff1681565b60095460ff1690565b600b546001600160a01b031681565b600c546001600160a01b0316331461095f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b81518110156106bb57600180600084848151811061097c57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600360008484815181106109cd57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610962565b600c546001600160a01b03163314610a4f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8251811015610b1a57610a8b838281518110610a6a57fe5b6020026020010151838381518110610a7e57fe5b6020026020010151610c5d565b5083811015610b12576001806000858481518110610aa557fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550610b12838281518110610af357fe5b6020908102919091010151600e546001600160a01b0316600019610d11565b600101610a52565b50505050565b6001600160a01b031660009081526020819052604090205490565b600c546001600160a01b03163314610b83576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b03163314610bed576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b6002805460ff19166001179055565b60088054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561074b5780601f106107205761010080835404028352916020019161074b565b6000610769610c6a610d0d565b8484610dfd565b600b54600160a81b900460ff1681565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b600082820183811015610d06576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610d565760405162461bcd60e51b81526004018080602001828103825260248152602001806115b06024913960400191505060405180910390fd5b6001600160a01b038216610d9b5760405162461bcd60e51b815260040180806020018281038252602281526020018061151b6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600d54600c548491849184916001600160a01b039182169116148015610e305750600c546001600160a01b038481169116145b15610ff957600d80546001600160a01b0319166001600160a01b03848116919091179091558616610e925760405162461bcd60e51b815260040180806020018281038252602581526020018061158b6025913960400191505060405180910390fd5b6001600160a01b038516610ed75760405162461bcd60e51b81526004018080602001828103825260238152602001806114f86023913960400191505060405180910390fd5b610ee28686866114f2565b610f1f8460405180606001604052806026815260200161153d602691396001600160a01b038916600090815260208190526040902054919061145b565b6001600160a01b038088166000908152602081905260408082209390935590871681522054610f4e9085610cac565b6001600160a01b03861660009081526020819052604090205560025460ff16151560011415610fa9576001600160a01b0385166000908152600160208190526040909120805460ff1990811690921790556002805490911690555b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3611453565b600c546001600160a01b03848116911614806110225750600d546001600160a01b038481169116145b8061103a5750600c546001600160a01b038381169116145b156110bd57600c546001600160a01b03848116911614801561106d5750816001600160a01b0316836001600160a01b0316145b156110785760048190555b6001600160a01b038616610e925760405162461bcd60e51b815260040180806020018281038252602581526020018061158b6025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff1615151415611129576001600160a01b038616610e925760405162461bcd60e51b815260040180806020018281038252602581526020018061158b6025913960400191505060405180910390fd5b6001600160a01b03831660009081526003602052604090205460ff161515600114156111b357600d546001600160a01b03848116911614806111785750600e546001600160a01b038381169116145b6110785760405162461bcd60e51b815260040180806020018281038252602681526020018061153d6026913960400191505060405180910390fd5b60045481101561124757600d546001600160a01b0383811691161415611078576001600160a01b0383811660009081526003602090815260408083208054600160ff1991821681179092559252909120805490911690558616610e925760405162461bcd60e51b815260040180806020018281038252602581526020018061158b6025913960400191505060405180910390fd5b600d546001600160a01b03848116911614806112705750600e546001600160a01b038381169116145b6112ab5760405162461bcd60e51b815260040180806020018281038252602681526020018061153d6026913960400191505060405180910390fd5b6001600160a01b0386166112f05760405162461bcd60e51b815260040180806020018281038252602581526020018061158b6025913960400191505060405180910390fd5b6001600160a01b0385166113355760405162461bcd60e51b81526004018080602001828103825260238152602001806114f86023913960400191505060405180910390fd5b6113408686866114f2565b61137d8460405180606001604052806026815260200161153d602691396001600160a01b038916600090815260208190526040902054919061145b565b6001600160a01b0380881660009081526020819052604080822093909355908716815220546113ac9085610cac565b6001600160a01b03861660009081526020819052604090205560025460ff16151560011415611407576001600160a01b0385166000908152600160208190526040909120805460ff1990811690921790556002805490911690555b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b505050505050565b600081848411156114ea5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156114af578181015183820152602001611497565b50505050905090810190601f1680156114dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122082064572ccff6ac79fc1ef953b6ea6b4f225cd6dc73fc70dfea1d38f23c4463064736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,563 |
0x2C4B28565c854367F1Beb830d79A24Bca19fd20e | /**
*Submitted for verification at Etherscan.io on 2021-04-08
*/
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity 0.6.12;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @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 IPriceFeed {
function getAssetPrice(address _asset) external view returns (uint256);
}
//
interface IEmployeePriceFeed {
function assetPriceReached(uint256 price) external;
function assetPrice() external view returns (uint256);
function priceReachedTimes(uint256) external view returns (uint256);
}
//
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
//
library MathPow {
function pow(uint256 x, uint256 n) internal pure returns (uint256 z) {
z = n % 2 != 0 ? x : 1;
for (n /= 2; n != 0; n /= 2) {
x = SafeMath.mul(x, x);
if (n % 2 != 0) {
z = SafeMath.mul(z, x);
}
}
}
}
//
contract EmployeePriceFeed is IEmployeePriceFeed {
using SafeMath for uint256;
uint256 public constant PRICE_ORACLE_STALE_THRESHOLD = 1 days;
IERC20 public mimo;
AggregatorV3Interface public eurOracle;
IPriceFeed public priceFeed;
mapping(uint256 => uint256) public override priceReachedTimes;
constructor(
IERC20 _mimo,
AggregatorV3Interface _eurOracle,
IPriceFeed _priceFeed
) public {
require(address(_mimo) != address(0));
require(address(_eurOracle) != address(0));
require(address(_priceFeed) != address(0));
mimo = _mimo;
eurOracle = _eurOracle;
priceFeed = _priceFeed;
}
function assetPriceReached(uint256 price) public override {
require(assetPrice() >= price, "price has not been reached");
priceReachedTimes[price] = block.timestamp;
}
function assetPrice() public override view returns (uint256) {
(, int256 eurAnswer, , uint256 eurUpdatedAt, ) = eurOracle.latestRoundData();
require(eurAnswer > 0, "EUR price data not valid");
require(block.timestamp - eurUpdatedAt < PRICE_ORACLE_STALE_THRESHOLD, "EUR price data is stale");
uint8 eurDecimals = eurOracle.decimals();
uint256 eurAccuracy = MathPow.pow(10, eurDecimals);
return priceFeed.getAssetPrice(address(mimo)).mul(uint256(eurAnswer)).div(eurAccuracy);
}
} | 0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80636d9b18231161005b5780636d9b1823146100d5578063741bef1a146100dd5780637cbcfee2146100e5578063d24378eb146100ed5761007d565b806307214c3714610082578063203184d8146100975780636719d7ac146100c0575b600080fd5b61009561009036600461046d565b6100f5565b005b6100aa6100a536600461046d565b610138565b6040516100b79190610640565b60405180910390f35b6100c861014a565b6040516100b7919061050f565b6100c8610159565b6100c8610168565b6100aa610177565b6100aa61017e565b806100fe61017e565b10156101255760405162461bcd60e51b815260040161011c906105d2565b60405180910390fd5b6000908152600360205260409020429055565b60036020526000908152604090205481565b6001546001600160a01b031681565b6000546001600160a01b031681565b6002546001600160a01b031681565b6201518081565b6000806000600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156101d157600080fd5b505afa1580156101e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610209919061049d565b50935050925050600082136102305760405162461bcd60e51b815260040161011c90610523565b62015180814203106102545760405162461bcd60e51b815260040161011c90610609565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561029957600080fd5b505afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d191906104ee565b905060006102e3600a8360ff1661038b565b60025460005460405163b3596f0760e01b815292935061038292849261037c9289926001600160a01b039283169263b3596f07926103269291169060040161050f565b60206040518083038186803b15801561033e57600080fd5b505afa158015610352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103769190610485565b906103e0565b90610421565b94505050505090565b60006002820661039c57600161039e565b825b90506002820491505b81156103da576103b783846103e0565b925060028206156103cf576103cc81846103e0565b90505b6002820491506103a7565b92915050565b6000826103ef575060006103da565b828202828482816103fc57fe5b041461041a5760405162461bcd60e51b815260040161011c90610591565b9392505050565b60008082116104425760405162461bcd60e51b815260040161011c9061055a565b81838161044b57fe5b049392505050565b805169ffffffffffffffffffff811681146103da57600080fd5b60006020828403121561047e578081fd5b5035919050565b600060208284031215610496578081fd5b5051919050565b600080600080600060a086880312156104b4578081fd5b6104be8787610453565b94506020860151935060408601519250606086015191506104e28760808801610453565b90509295509295909350565b6000602082840312156104ff578081fd5b815160ff8116811461041a578182fd5b6001600160a01b0391909116815260200190565b60208082526018908201527f4555522070726963652064617461206e6f742076616c69640000000000000000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601a908201527f707269636520686173206e6f74206265656e2072656163686564000000000000604082015260600190565b60208082526017908201527f4555522070726963652064617461206973207374616c65000000000000000000604082015260600190565b9081526020019056fea26469706673582212206c5ece623edbf53cb5db6b02ddc78db57b6376f99f20ef372e53b6957dd49ae264736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,564 |
0xf944d7740c0caf725bf26cf29e3facf6748189ac | pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != 0x0);
require(newOwner != owner);
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
using SafeMath for uint256;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
// 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);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20() public {}
/**
* Internal transfer, only can be called 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].add(_value) > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from].add(balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] = balanceOf[_from].sub(_value);
// Add the same to the recipient
balanceOf[_to] = balanceOf[_to].add(_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].add(balanceOf[_to]) == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowanc
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(_spender != 0x0);
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
}
/******************************************/
/* Bind Network TOKEN STARTS HERE */
/******************************************/
contract BNDToken is owned, TokenERC20 {
string public name = "Bind Network";
string public symbol = "BND";
uint8 public decimals = 18;
uint256 public buyPrice;
uint256 public totalSupply = 149000000e18;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function BNDToken () public {
balanceOf[msg.sender] = totalSupply;
}
function () payable {
buy();
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[msg.sender]);
require (balanceOf[_from] > _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) > balanceOf[_to]); // Check for overflow
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
return TokenERC20.transferFrom(_from, _to, _value);
}
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) public {
require(!frozenAccount[msg.sender]);
return TokenERC20.transfer(_to, _value);
}
/// @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 FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newBuyPrice Price users can buy from the contract
function setbuyPrice( uint256 newBuyPrice) onlyOwner public {
require(newBuyPrice > 0);
buyPrice = newBuyPrice;
}
function withdrawEther() onlyOwner {
require(address(this).balance >= 0 ether);
owner.transfer(address(this).balance);
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
require(msg.value > 0);
require(buyPrice > 0);
uint amount = msg.value.mul(buyPrice);
_transfer(owner, msg.sender, amount); // makes the transfers
}
} | 0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610106578063095ea7b31461019657806318160ddd146101fb57806323b872dd14610226578063313ce567146102ab57806370a08231146102dc5780637362377b146103335780638620410b1461034a5780638da5cb5b1461037557806395d89b41146103cc5780639e6985e21461045c578063a6f2ae3a14610489578063a9059cbb14610493578063b414d4b6146104e0578063cae9ca511461053b578063dd62ed3e146105e6578063e724529c1461065d578063f2fde38b146106ac575b6101046106ef565b005b34801561011257600080fd5b5061011b610756565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015b578082015181840152602081019050610140565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a257600080fd5b506101e1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f4565b604051808215151515815260200191505060405180910390f35b34801561020757600080fd5b506102106108a6565b6040518082815260200191505060405180910390f35b34801561023257600080fd5b50610291600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108ac565b604051808215151515815260200191505060405180910390f35b3480156102b757600080fd5b506102c061091b565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e857600080fd5b5061031d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061092e565b6040518082815260200191505060405180910390f35b34801561033f57600080fd5b50610348610946565b005b34801561035657600080fd5b5061035f610a49565b6040518082815260200191505060405180910390f35b34801561038157600080fd5b5061038a610a4f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103d857600080fd5b506103e1610a74565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610421578082015181840152602081019050610406565b50505050905090810190601f16801561044e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561046857600080fd5b5061048760048036038101908080359060200190929190505050610b12565b005b6104916106ef565b005b34801561049f57600080fd5b506104de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b86565b005b3480156104ec57600080fd5b50610521600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bed565b604051808215151515815260200191505060405180910390f35b34801561054757600080fd5b506105cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610c0d565b604051808215151515815260200191505060405180910390f35b3480156105f257600080fd5b50610647600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d90565b6040518082815260200191505060405180910390f35b34801561066957600080fd5b506106aa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610db5565b005b3480156106b857600080fd5b506106ed600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eda565b005b600080341115156106ff57600080fd5b6000600a5411151561071057600080fd5b610725600a5434610ffa90919063ffffffff16565b90506107536000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611035565b50565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107ec5780601f106107c1576101008083540402835291602001916107ec565b820191906000526020600020905b8154815290600101906020018083116107cf57829003601f168201915b505050505081565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561081b57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b600b5481565b6000600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561090757600080fd5b610912848484611333565b90509392505050565b600960009054906101000a900460ff1681565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109a157600080fd5b60003073ffffffffffffffffffffffffffffffffffffffff1631101515156109c857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610a46573d6000803e3d6000fd5b50565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0a5780601f10610adf57610100808354040283529160200191610b0a565b820191906000526020600020905b815481529060010190602001808311610aed57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b6d57600080fd5b600081111515610b7c57600080fd5b80600a8190555050565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610bdf57600080fd5b610be982826114e5565b5050565b600c6020528060005260406000206000915054906101000a900460ff1681565b600080849050610c1d85856107f4565b15610d87578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610d17578082015181840152602081019050610cfc565b50505050905090810190601f168015610d445780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b5050505060019150610d88565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1057600080fd5b80600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f3557600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515610f5b57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610fb757600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600084141561100f576000915061102e565b828402905082848281151561102057fe5b0414151561102a57fe5b8091505b5092915050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561105b57600080fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156110b457600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561110157600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461119382600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f490919063ffffffff16565b11151561119f57600080fd5b6111f181600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128681600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f490919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113c057600080fd5b61144f82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151290919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114da848484611035565b600190509392505050565b6114f0338383611035565b5050565b600080828401905083811015151561150857fe5b8091505092915050565b600082821115151561152057fe5b8183039050929150505600a165627a7a72305820c8c786d68e02b3c07bf0929aa5e31c7148f42621dae8ba161a535125af8bf2cb0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 1,565 |
0x45c1c1ab655e731dfc2a1339a1788d0478da8e8e | /**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
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() {
_transferOwnership(_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 {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
// solhint-disable no-empty-blocks, avoid-low-level-calls
contract EthDistribute is Ownable {
using SafeMath for uint256;
address payable private _marketingWallet;
address payable private _devWallet;
address payable private _treasuryWallet;
uint256 private _marketingShare = 40;
uint256 private _devShare = 10;
uint256 private _treasuryShare = 50;
constructor(
address payable marketingWallet_,
address payable devWallet_,
address payable treasuryWallet_
) {
_marketingWallet = marketingWallet_;
_devWallet = devWallet_;
_treasuryWallet = treasuryWallet_;
}
fallback() external payable {}
receive() external payable {}
function claim() external {
uint256 startingBalance = address(this).balance;
(bool marketingSent, ) = _marketingWallet.call{value: startingBalance.mul(_marketingShare).div(100)}("");
(bool devSent, ) = _devWallet.call{value: startingBalance.mul(_devShare).div(100)}("");
(bool treasurySent, ) = _treasuryWallet.call{value: startingBalance.mul(_treasuryShare).div(100)}("");
require(marketingSent && devSent && treasurySent, "Send failed");
}
function setMarketingWallet(address payable account) external onlyOwner {
require(account != address(0), "Cannot be 0 address");
_marketingWallet = account;
}
function setDevWallet(address payable account) external onlyOwner {
require(account != address(0), "Cannot be 0 address");
_devWallet = account;
}
function setTreasuryWallet(address payable account) external onlyOwner {
require(account != address(0), "Cannot be 0 address");
_treasuryWallet = account;
}
function setNewShares(uint256 marketingShare, uint256 devShare, uint256 treasuryShare) external onlyOwner {
require(
marketingShare.add(devShare).add(treasuryShare) == 100, "Does not add up to 100"
);
_marketingShare = marketingShare;
_devShare = devShare;
_treasuryShare = treasuryShare;
}
function getWallets() external view returns (address, address, address) {
return (_marketingWallet, _devWallet, _treasuryWallet);
}
function getShare() external view returns (uint256, uint256, uint256) {
return (_marketingShare, _devShare, _treasuryShare);
}
} | 0x6080604052600436106100955760003560e01c8063752987341161005957806375298734146101475780638da5cb5b14610174578063a8602fea1461019f578063db7a4605146101c8578063f2fde38b146101f55761009c565b80631f53ac021461009e5780634e71d92d146100c75780635d098b38146100de5780636686786614610107578063715018a6146101305761009c565b3661009c57005b005b3480156100aa57600080fd5b506100c560048036038101906100c09190610cd8565b61021e565b005b3480156100d357600080fd5b506100dc61034e565b005b3480156100ea57600080fd5b5061010560048036038101906101009190610cd8565b6105ca565b005b34801561011357600080fd5b5061012e60048036038101906101299190610d01565b6106fa565b005b34801561013c57600080fd5b506101456107f7565b005b34801561015357600080fd5b5061015c61087f565b60405161016b93929190610ff5565b60405180910390f35b34801561018057600080fd5b50610189610898565b6040516101969190610f03565b60405180910390f35b3480156101ab57600080fd5b506101c660048036038101906101c19190610cd8565b6108c1565b005b3480156101d457600080fd5b506101dd6109f1565b6040516101ec93929190610f1e565b60405180910390f35b34801561020157600080fd5b5061021c60048036038101906102179190610caf565b610a6a565b005b610226610b62565b73ffffffffffffffffffffffffffffffffffffffff16610244610898565b73ffffffffffffffffffffffffffffffffffffffff161461029a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029190610f75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561030a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030190610fb5565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60004790506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166103b660646103a860045486610b6a90919063ffffffff16565b610b8090919063ffffffff16565b6040516103c290610eee565b60006040518083038185875af1925050503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b505090506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661046b606461045d60055487610b6a90919063ffffffff16565b610b8090919063ffffffff16565b60405161047790610eee565b60006040518083038185875af1925050503d80600081146104b4576040519150601f19603f3d011682016040523d82523d6000602084013e6104b9565b606091505b505090506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610520606461051260065488610b6a90919063ffffffff16565b610b8090919063ffffffff16565b60405161052c90610eee565b60006040518083038185875af1925050503d8060008114610569576040519150601f19603f3d011682016040523d82523d6000602084013e61056e565b606091505b5050905082801561057c5750815b80156105855750805b6105c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105bb90610fd5565b60405180910390fd5b50505050565b6105d2610b62565b73ffffffffffffffffffffffffffffffffffffffff166105f0610898565b73ffffffffffffffffffffffffffffffffffffffff1614610646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063d90610f75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ad90610fb5565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610702610b62565b73ffffffffffffffffffffffffffffffffffffffff16610720610898565b73ffffffffffffffffffffffffffffffffffffffff1614610776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076d90610f75565b60405180910390fd5b606461079d8261078f8587610b9690919063ffffffff16565b610b9690919063ffffffff16565b146107dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d490610f95565b60405180910390fd5b826004819055508160058190555080600681905550505050565b6107ff610b62565b73ffffffffffffffffffffffffffffffffffffffff1661081d610898565b73ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90610f75565b60405180910390fd5b61087d6000610bac565b565b6000806000600454600554600654925092509250909192565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6108c9610b62565b73ffffffffffffffffffffffffffffffffffffffff166108e7610898565b73ffffffffffffffffffffffffffffffffffffffff161461093d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093490610f75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490610fb5565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925092509250909192565b610a72610b62565b73ffffffffffffffffffffffffffffffffffffffff16610a90610898565b73ffffffffffffffffffffffffffffffffffffffff1614610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610add90610f75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4d90610f55565b60405180910390fd5b610b5f81610bac565b50565b600033905090565b60008183610b7891906110cf565b905092915050565b60008183610b8e919061109e565b905092915050565b60008183610ba49190611048565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081359050610c7f816111d5565b92915050565b600081359050610c94816111ec565b92915050565b600081359050610ca981611203565b92915050565b600060208284031215610cc157600080fd5b6000610ccf84828501610c70565b91505092915050565b600060208284031215610cea57600080fd5b6000610cf884828501610c85565b91505092915050565b600080600060608486031215610d1657600080fd5b6000610d2486828701610c9a565b9350506020610d3586828701610c9a565b9250506040610d4686828701610c9a565b9150509250925092565b610d5981611129565b82525050565b6000610d6c602683611037565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610dd2602083611037565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000610e12601683611037565b91507f446f6573206e6f742061646420757020746f20313030000000000000000000006000830152602082019050919050565b6000610e52601383611037565b91507f43616e6e6f7420626520302061646472657373000000000000000000000000006000830152602082019050919050565b6000610e92600b83611037565b91507f53656e64206661696c65640000000000000000000000000000000000000000006000830152602082019050919050565b6000610ed260008361102c565b9150600082019050919050565b610ee88161116d565b82525050565b6000610ef982610ec5565b9150819050919050565b6000602082019050610f186000830184610d50565b92915050565b6000606082019050610f336000830186610d50565b610f406020830185610d50565b610f4d6040830184610d50565b949350505050565b60006020820190508181036000830152610f6e81610d5f565b9050919050565b60006020820190508181036000830152610f8e81610dc5565b9050919050565b60006020820190508181036000830152610fae81610e05565b9050919050565b60006020820190508181036000830152610fce81610e45565b9050919050565b60006020820190508181036000830152610fee81610e85565b9050919050565b600060608201905061100a6000830186610edf565b6110176020830185610edf565b6110246040830184610edf565b949350505050565b600081905092915050565b600082825260208201905092915050565b60006110538261116d565b915061105e8361116d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561109357611092611177565b5b828201905092915050565b60006110a98261116d565b91506110b48361116d565b9250826110c4576110c36111a6565b5b828204905092915050565b60006110da8261116d565b91506110e58361116d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561111e5761111d611177565b5b828202905092915050565b60006111348261114d565b9050919050565b60006111468261114d565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6111de81611129565b81146111e957600080fd5b50565b6111f58161113b565b811461120057600080fd5b50565b61120c8161116d565b811461121757600080fd5b5056fea26469706673582212202017c40296bee9e212fe7a2add7d99c0ea836ab4cbf11a595375f90efc5b8b1d64736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,566 |
0xB5b819B22c29A75AB49099Bc44c0715396e65d7d | /**
*/
/**
Welcome to the 2022 Bull Run ($BULLS)
Jeets ain't going to make it. Join us as we embark on the next bull run for Crypto.
Meme season is back stronger than ever and we will fulfill what we were sought out to do. 1000x and we will settle for nothing less.
Telegram: https://t.me/BullRunERC
Website: https://www.BullRunERC.com
Twitter: https://www.twitter.com/BullRunETH
*/
// 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 BULLRUN is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BULLRUN";
string private constant _symbol = "BULL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//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(0xca8a6aAE554DF8Db768435F701dA28618915d5F8);
address payable private _marketingAddress = payable(0xca8a6aAE554DF8Db768435F701dA28618915d5F8);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 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 {
_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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610552578063dd62ed3e14610572578063ea1644d5146105b8578063f2fde38b146105d857600080fd5b8063a2a957bb146104cd578063a9059cbb146104ed578063bfd792841461050d578063c3c8cd801461053d57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ad57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195c565b6105f8565b005b34801561020a57600080fd5b50604080518082019091526007815266212aa626292aa760c91b60208201525b6040516102379190611a21565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611a76565b610697565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50670de0b6b3a76400005b604051908152602001610237565b3480156102d957600080fd5b506102606102e8366004611aa2565b6106ae565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610237565b34801561032b57600080fd5b50601554610290906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae3565b610717565b34801561036b57600080fd5b506101fc61037a366004611b10565b610762565b34801561038b57600080fd5b506101fc6107aa565b3480156103a057600080fd5b506102bf6103af366004611ae3565b6107f5565b3480156103c057600080fd5b506101fc610817565b3480156103d557600080fd5b506101fc6103e4366004611b2b565b61088b565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae3565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610290565b34801561045657600080fd5b506101fc610465366004611b10565b6108ba565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260048152631095531360e21b602082015261022a565b3480156104b957600080fd5b506101fc6104c8366004611b2b565b610902565b3480156104d957600080fd5b506101fc6104e8366004611b44565b610931565b3480156104f957600080fd5b50610260610508366004611a76565b61096f565b34801561051957600080fd5b50610260610528366004611ae3565b60106020526000908152604090205460ff1681565b34801561054957600080fd5b506101fc61097c565b34801561055e57600080fd5b506101fc61056d366004611b76565b6109d0565b34801561057e57600080fd5b506102bf61058d366004611bfa565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c457600080fd5b506101fc6105d3366004611b2b565b610a71565b3480156105e457600080fd5b506101fc6105f3366004611ae3565b610aa0565b6000546001600160a01b0316331461062b5760405162461bcd60e51b815260040161062290611c33565b60405180910390fd5b60005b81518110156106935760016010600084848151811061064f5761064f611c68565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068b81611c94565b91505061062e565b5050565b60006106a4338484610b8a565b5060015b92915050565b60006106bb848484610cae565b61070d843361070885604051806060016040528060288152602001611dae602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ea565b610b8a565b5060019392505050565b6000546001600160a01b031633146107415760405162461bcd60e51b815260040161062290611c33565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078c5760405162461bcd60e51b815260040161062290611c33565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107df57506013546001600160a01b0316336001600160a01b0316145b6107e857600080fd5b476107f281611224565b50565b6001600160a01b0381166000908152600260205260408120546106a89061125e565b6000546001600160a01b031633146108415760405162461bcd60e51b815260040161062290611c33565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161062290611c33565b601655565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161062290611c33565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092c5760405162461bcd60e51b815260040161062290611c33565b601855565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260040161062290611c33565b600893909355600a91909155600955600b55565b60006106a4338484610cae565b6012546001600160a01b0316336001600160a01b031614806109b157506013546001600160a01b0316336001600160a01b0316145b6109ba57600080fd5b60006109c5306107f5565b90506107f2816112e2565b6000546001600160a01b031633146109fa5760405162461bcd60e51b815260040161062290611c33565b60005b82811015610a6b578160056000868685818110610a1c57610a1c611c68565b9050602002016020810190610a319190611ae3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6381611c94565b9150506109fd565b50505050565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b815260040161062290611c33565b601755565b6000546001600160a01b03163314610aca5760405162461bcd60e51b815260040161062290611c33565b6001600160a01b038116610b2f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610622565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610622565b6001600160a01b038216610c4d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610622565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610622565b6001600160a01b038216610d745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610622565b60008111610dd65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610622565b6000546001600160a01b03848116911614801590610e0257506000546001600160a01b03838116911614155b156110e357601554600160a01b900460ff16610e9b576000546001600160a01b03848116911614610e9b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610622565b601654811115610eed5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610622565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2f57506001600160a01b03821660009081526010602052604090205460ff16155b610f875760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610622565b6015546001600160a01b0383811691161461100c5760175481610fa9846107f5565b610fb39190611caf565b1061100c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610622565b6000611017306107f5565b6018546016549192508210159082106110305760165491505b8080156110475750601554600160a81b900460ff16155b801561106157506015546001600160a01b03868116911614155b80156110765750601554600160b01b900460ff165b801561109b57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c057506001600160a01b03841660009081526005602052604090205460ff16155b156110e0576110ce826112e2565b4780156110de576110de47611224565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112557506001600160a01b03831660009081526005602052604090205460ff165b8061115757506015546001600160a01b0385811691161480159061115757506015546001600160a01b03848116911614155b15611164575060006111de565b6015546001600160a01b03858116911614801561118f57506014546001600160a01b03848116911614155b156111a157600854600c55600954600d555b6015546001600160a01b0384811691161480156111cc57506014546001600160a01b03858116911614155b156111de57600a54600c55600b54600d555b610a6b8484848461146b565b6000818484111561120e5760405162461bcd60e51b81526004016106229190611a21565b50600061121b8486611cc7565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610693573d6000803e3d6000fd5b60006006548211156112c55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610622565b60006112cf611499565b90506112db83826114bc565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132a5761132a611c68565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137e57600080fd5b505afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611cde565b816001815181106113c9576113c9611c68565b6001600160a01b0392831660209182029290920101526014546113ef9130911684610b8a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611428908590600090869030904290600401611cfb565b600060405180830381600087803b15801561144257600080fd5b505af1158015611456573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611478576114786114fe565b61148384848461152c565b80610a6b57610a6b600e54600c55600f54600d55565b60008060006114a6611623565b90925090506114b582826114bc565b9250505090565b60006112db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611663565b600c5415801561150e5750600d54155b1561151557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153e87611691565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157090876116ee565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159f9086611730565b6001600160a01b0389166000908152600260205260409020556115c18161178f565b6115cb84836117d9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161091815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163e82826114bc565b82101561165a57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116845760405162461bcd60e51b81526004016106229190611a21565b50600061121b8486611d6c565b60008060008060008060008060006116ae8a600c54600d546117fd565b92509250925060006116be611499565b905060008060006116d18e878787611852565b919e509c509a509598509396509194505050505091939550919395565b60006112db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ea565b60008061173d8385611caf565b9050838110156112db5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610622565b6000611799611499565b905060006117a783836118a2565b306000908152600260205260409020549091506117c49082611730565b30600090815260026020526040902055505050565b6006546117e690836116ee565b6006556007546117f69082611730565b6007555050565b6000808080611817606461181189896118a2565b906114bc565b9050600061182a60646118118a896118a2565b905060006118428261183c8b866116ee565b906116ee565b9992985090965090945050505050565b600080808061186188866118a2565b9050600061186f88876118a2565b9050600061187d88886118a2565b9050600061188f8261183c86866116ee565b939b939a50919850919650505050505050565b6000826118b1575060006106a8565b60006118bd8385611d8e565b9050826118ca8583611d6c565b146112db5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610622565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f257600080fd5b803561195781611937565b919050565b6000602080838503121561196f57600080fd5b823567ffffffffffffffff8082111561198757600080fd5b818501915085601f83011261199b57600080fd5b8135818111156119ad576119ad611921565b8060051b604051601f19603f830116810181811085821117156119d2576119d2611921565b6040529182528482019250838101850191888311156119f057600080fd5b938501935b82851015611a1557611a068561194c565b845293850193928501926119f5565b98975050505050505050565b600060208083528351808285015260005b81811015611a4e57858101830151858201604001528201611a32565b81811115611a60576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8957600080fd5b8235611a9481611937565b946020939093013593505050565b600080600060608486031215611ab757600080fd5b8335611ac281611937565b92506020840135611ad281611937565b929592945050506040919091013590565b600060208284031215611af557600080fd5b81356112db81611937565b8035801515811461195757600080fd5b600060208284031215611b2257600080fd5b6112db82611b00565b600060208284031215611b3d57600080fd5b5035919050565b60008060008060808587031215611b5a57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8b57600080fd5b833567ffffffffffffffff80821115611ba357600080fd5b818601915086601f830112611bb757600080fd5b813581811115611bc657600080fd5b8760208260051b8501011115611bdb57600080fd5b602092830195509350611bf19186019050611b00565b90509250925092565b60008060408385031215611c0d57600080fd5b8235611c1881611937565b91506020830135611c2881611937565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca857611ca8611c7e565b5060010190565b60008219821115611cc257611cc2611c7e565b500190565b600082821015611cd957611cd9611c7e565b500390565b600060208284031215611cf057600080fd5b81516112db81611937565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4b5784516001600160a01b031683529383019391830191600101611d26565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da857611da8611c7e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204517b08677b22aac5bdc438a16f713176a1b8372f73248e74664a726fa216e7764736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,567 |
0x3132c839bc5fd2e67ddeb78975dec8d3b139d979 | pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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, Ownable {
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 transfered
*/
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.
* @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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiSend(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
}
/**
* @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 onlyOwner {
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);
}
}
contract WinancesToken is StandardToken, BurnableToken {
string public constant name = "Winances";
string public constant symbol = "AWS";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 250000000 * (10 ** uint256(decimals));
function WinancesToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
} | 0x60606040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd1461007257806370a082311461009b5780638da5cb5b146100e8578063a9059cbb1461013d578063f2fde38b14610197575b600080fd5b341561007d57600080fd5b6100856101d0565b6040518082815260200191505060405180910390f35b34156100a657600080fd5b6100d2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101da565b6040518082815260200191505060405180910390f35b34156100f357600080fd5b6100fb610223565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561014857600080fd5b61017d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610248565b604051808215151515815260200191505060405180910390f35b34156101a257600080fd5b6101ce600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061046c565b005b6000600254905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561028557600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156102d357600080fd5b61032582600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c190919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506103ba82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105da90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104c757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561050357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156105cf57fe5b818303905092915050565b60008082840190508381101515156105ee57fe5b80915050929150505600a165627a7a7230582035532c99ddea798e38152fe7b74885719a3ee83e436171eac8c6a42b91719c240029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,568 |
0x5ec8d21518d305f2a3d871866288bd6e885e81d8 | /**
*Submitted for verification at Etherscan.io on 2022-02-13
*/
/**
* SafePluto Classic (SPF) launch is scheduled for February 13th, 2022.
*
* Details: t.me/SafePlutoClassic
* Total Supply: 1.000.000.000
*
* Fair Launch
* Liquidity locked within minutes after launch
* No Pre-Sale
* No DEV allocation/ Team Tokens
* 100% RUG PROOF
**/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.11;
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 SafePlutoClassic is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SafePluto Classic";
string private constant _symbol = "SPC";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x49d7b6f01a01EA4A079B583D8DfddC83D0A7Edf7);
address payable private _marketingAddress = payable(0xe065bb97B13129Ec61ef73850cf447a371518cbe);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf7146104545780638f9a55c01461047457806395d89b411461048a57806398a5c315146104b657600080fd5b80637d1db4a5146103f35780637f2feddc146104095780638da5cb5b1461043657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038957806370a082311461039e578063715018a6146103be57806374010ece146103d357600080fd5b8063313ce5671461030d57806349bd5a5e146103295780636b999053146103495780636d8aa8f81461036957600080fd5b80631694505e116101ab5780631694505e1461027a57806318160ddd146102b257806323b872dd146102d75780632fd689e3146102f757600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024a57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611956565b610601565b005b34801561020a57600080fd5b5060408051808201909152601181527053616665506c75746f20436c617373696360781b60208201525b6040516102419190611a1b565b60405180910390f35b34801561025657600080fd5b5061026a610265366004611a70565b6106a0565b6040519015158152602001610241565b34801561028657600080fd5b5060145461029a906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b3480156102be57600080fd5b50670de0b6b3a76400005b604051908152602001610241565b3480156102e357600080fd5b5061026a6102f2366004611a9c565b6106b7565b34801561030357600080fd5b506102c960185481565b34801561031957600080fd5b5060405160098152602001610241565b34801561033557600080fd5b5060155461029a906001600160a01b031681565b34801561035557600080fd5b506101fc610364366004611add565b610720565b34801561037557600080fd5b506101fc610384366004611b0a565b61076b565b34801561039557600080fd5b506101fc6107b3565b3480156103aa57600080fd5b506102c96103b9366004611add565b6107fe565b3480156103ca57600080fd5b506101fc610820565b3480156103df57600080fd5b506101fc6103ee366004611b25565b610894565b3480156103ff57600080fd5b506102c960165481565b34801561041557600080fd5b506102c9610424366004611add565b60116020526000908152604090205481565b34801561044257600080fd5b506000546001600160a01b031661029a565b34801561046057600080fd5b506101fc61046f366004611b0a565b6108c3565b34801561048057600080fd5b506102c960175481565b34801561049657600080fd5b5060408051808201909152600381526253504360e81b6020820152610234565b3480156104c257600080fd5b506101fc6104d1366004611b25565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b3e565b61093a565b34801561050257600080fd5b5061026a610511366004611a70565b610978565b34801561052257600080fd5b5061026a610531366004611add565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b70565b6109d9565b34801561058757600080fd5b506102c9610596366004611bf4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b25565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611add565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c2d565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c62565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c8e565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611da8602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c2d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c2d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c2d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c2d565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c2d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c2d565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c2d565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c2d565b60005b82811015610a74578160056000868685818110610a2557610a25611c62565b9050602002016020810190610a3a9190611add565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c8e565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c2d565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c2d565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611ca9565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611465565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a1b565b5060006112248486611cc1565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d8611493565b90506112e483826114b6565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c62565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561138c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b09190611cd8565b816001815181106113c3576113c3611c62565b6001600160a01b0392831660209182029290920101526014546113e99130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611422908590600090869030904290600401611cf5565b600060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611472576114726114f8565b61147d848484611526565b80610a7457610a74600e54600c55600f54600d55565b60008060006114a061161d565b90925090506114af82826114b6565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165d565b600c541580156115085750600d54155b1561150f57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115388761168b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156a90876116e8565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611599908661172a565b6001600160a01b0389166000908152600260205260409020556115bb81611789565b6115c584836117d3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160a91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163882826114b6565b82101561165457505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361167e5760405162461bcd60e51b815260040161062b9190611a1b565b5060006112248486611d66565b60008060008060008060008060006116a88a600c54600d546117f7565b92509250925060006116b8611493565b905060008060006116cb8e87878761184c565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b6000806117378385611ca9565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b6000611793611493565b905060006117a1838361189c565b306000908152600260205260409020549091506117be908261172a565b30600090815260026020526040902055505050565b6006546117e090836116e8565b6006556007546117f0908261172a565b6007555050565b6000808080611811606461180b898961189c565b906114b6565b90506000611824606461180b8a8961189c565b9050600061183c826118368b866116e8565b906116e8565b9992985090965090945050505050565b600080808061185b888661189c565b90506000611869888761189c565b90506000611877888861189c565b905060006118898261183686866116e8565b939b939a50919850919650505050505050565b6000826118ab575060006106b1565b60006118b78385611d88565b9050826118c48583611d66565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561195181611931565b919050565b6000602080838503121561196957600080fd5b823567ffffffffffffffff8082111561198157600080fd5b818501915085601f83011261199557600080fd5b8135818111156119a7576119a761191b565b8060051b604051601f19603f830116810181811085821117156119cc576119cc61191b565b6040529182528482019250838101850191888311156119ea57600080fd5b938501935b82851015611a0f57611a0085611946565b845293850193928501926119ef565b98975050505050505050565b600060208083528351808285015260005b81811015611a4857858101830151858201604001528201611a2c565b81811115611a5a576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8357600080fd5b8235611a8e81611931565b946020939093013593505050565b600080600060608486031215611ab157600080fd5b8335611abc81611931565b92506020840135611acc81611931565b929592945050506040919091013590565b600060208284031215611aef57600080fd5b81356112e481611931565b8035801515811461195157600080fd5b600060208284031215611b1c57600080fd5b6112e482611afa565b600060208284031215611b3757600080fd5b5035919050565b60008060008060808587031215611b5457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8557600080fd5b833567ffffffffffffffff80821115611b9d57600080fd5b818601915086601f830112611bb157600080fd5b813581811115611bc057600080fd5b8760208260051b8501011115611bd557600080fd5b602092830195509350611beb9186019050611afa565b90509250925092565b60008060408385031215611c0757600080fd5b8235611c1281611931565b91506020830135611c2281611931565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca257611ca2611c78565b5060010190565b60008219821115611cbc57611cbc611c78565b500190565b600082821015611cd357611cd3611c78565b500390565b600060208284031215611cea57600080fd5b81516112e481611931565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d455784516001600160a01b031683529383019391830191600101611d20565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da257611da2611c78565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122003d0e8b44ddf24d3c9026ac71b3564116936b63a3b026c06ce5860b56a0ef34364736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,569 |
0x6704b673c70de9bf74c8fba4b4bd748f0e2190e1 | pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title UbexToken
* @dev UBEX Token Smart Contract
*/
contract UbexToken is DetailedERC20, StandardToken, BurnableToken, PausableToken {
/**
* Init token by setting its total supply
*
* @param totalSupply total token supply
*/
function UbexToken(
uint256 totalSupply
) DetailedERC20(
"UBEX Token",
"UBEX",
18
) {
totalSupply_ = totalSupply;
balances[msg.sender] = totalSupply;
}
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de578063313ce567146102085780633f4ba83a1461023357806342966c681461024a5780635c975abb14610262578063661884631461027757806370a082311461029b5780638456cb59146102bc5780638da5cb5b146102d157806395d89b4114610302578063a9059cbb14610317578063d73dd6231461033b578063dd62ed3e1461035f578063f2fde38b14610386575b600080fd5b34801561010157600080fd5b5061010a6103a7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a0360043516602435610435565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610460565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a0360043581169060243516604435610466565b34801561021457600080fd5b5061021d610493565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b5061024861049c565b005b34801561025657600080fd5b50610248600435610518565b34801561026e57600080fd5b506101a3610525565b34801561028357600080fd5b506101a3600160a060020a0360043516602435610535565b3480156102a757600080fd5b506101cc600160a060020a0360043516610559565b3480156102c857600080fd5b50610248610574565b3480156102dd57600080fd5b506102e66105f5565b60408051600160a060020a039092168252519081900360200190f35b34801561030e57600080fd5b5061010a610604565b34801561032357600080fd5b506101a3600160a060020a036004351660243561065e565b34801561034757600080fd5b506101a3600160a060020a0360043516602435610682565b34801561036b57600080fd5b506101cc600160a060020a03600435811690602435166106a6565b34801561039257600080fd5b50610248600160a060020a03600435166106d1565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042d5780601f106104025761010080835404028352916020019161042d565b820191906000526020600020905b81548152906001019060200180831161041057829003601f168201915b505050505081565b60065460009060a060020a900460ff161561044f57600080fd5b610459838361076a565b9392505050565b60045490565b60065460009060a060020a900460ff161561048057600080fd5b61048b8484846107d4565b949350505050565b60025460ff1681565b60065433600160a060020a039081169116146104b757600080fd5b60065460a060020a900460ff1615156104cf57600080fd5b6006805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6105223382610956565b50565b60065460a060020a900460ff1681565b60065460009060a060020a900460ff161561054f57600080fd5b6104598383610a57565b600160a060020a031660009081526003602052604090205490565b60065433600160a060020a0390811691161461058f57600080fd5b60065460a060020a900460ff16156105a657600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600654600160a060020a031681565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042d5780601f106104025761010080835404028352916020019161042d565b60065460009060a060020a900460ff161561067857600080fd5b6104598383610b50565b60065460009060a060020a900460ff161561069c57600080fd5b6104598383610c4b565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60065433600160a060020a039081169116146106ec57600080fd5b600160a060020a038116151561070157600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260056020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6000600160a060020a03831615156107eb57600080fd5b600160a060020a03841660009081526003602052604090205482111561081057600080fd5b600160a060020a038085166000908152600560209081526040808320339094168352929052205482111561084357600080fd5b600160a060020a03841660009081526003602052604090205461086c908363ffffffff610ced16565b600160a060020a0380861660009081526003602052604080822093909355908516815220546108a1908363ffffffff610cff16565b600160a060020a038085166000908152600360209081526040808320949094558783168252600581528382203390931682529190915220546108e9908363ffffffff610ced16565b600160a060020a038086166000818152600560209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600160a060020a03821660009081526003602052604090205481111561097b57600080fd5b600160a060020a0382166000908152600360205260409020546109a4908263ffffffff610ced16565b600160a060020a0383166000908152600360205260409020556004546109d0908263ffffffff610ced16565b600455604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600160a060020a03338116600090815260056020908152604080832093861683529290529081205480831115610ab457600160a060020a033381166000908152600560209081526040808320938816835292905290812055610aeb565b610ac4818463ffffffff610ced16565b600160a060020a033381166000908152600560209081526040808320938916835292905220555b600160a060020a0333811660008181526005602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b6000600160a060020a0383161515610b6757600080fd5b600160a060020a033316600090815260036020526040902054821115610b8c57600080fd5b600160a060020a033316600090815260036020526040902054610bb5908363ffffffff610ced16565b600160a060020a033381166000908152600360205260408082209390935590851681522054610bea908363ffffffff610cff16565b600160a060020a038085166000818152600360209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054610c83908363ffffffff610cff16565b600160a060020a0333811660008181526005602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600082821115610cf957fe5b50900390565b81810182811015610d0c57fe5b929150505600a165627a7a723058200e782ae936d14081585620f0f708cc6a93e88ebff2ef36600f9d816c2f366a4b0029 | {"success": true, "error": null, "results": {}} | 1,570 |
0xf0e53995814d7cda53885f8d99c6442797fbf275 | // SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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);
}
abstract contract Ownable {
address payable _owner;
event OwnershipTransferred(
address payable indexed previousOwner,
address payable indexed newOwner
);
constructor() {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns(address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Not authorised for this operation");
_;
}
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address payable newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address payable newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
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;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
/**
* @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;
}
}
abstract contract BasicToken is IERC20, Context{
using SafeMath for uint256;
uint256 public _totalSupply;
mapping(address => uint256) balances_;
mapping(address => uint256) ethBalances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 public startTime = block.timestamp; // ------| Deploy Timestamp |--------
uint256 public unlockDuration = 0 minutes; // ----| Lock transfers for non-owner |-----------
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return balances_[account];
}
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 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 checkInvestedETH(address who) public view returns (uint256) {
return ethBalances[who];
}
}
contract StandardToken is BasicToken, Ownable {
using SafeMath for uint256;
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _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");
require(block.timestamp >= startTime.add(unlockDuration) || _msgSender() == owner(), "Tokens not unlocked yet");
balances_[sender] = balances_[sender].sub(amount, "ERC20: transfer amount exceeds balance");
balances_[recipient] = balances_[recipient].add(amount);
emit Transfer(sender, recipient, amount);
uint256 tokensToBurn = findOnePercent(amount);
uint256 tokensToTransfer = amount.sub(tokensToBurn);
beforeTokenTransfer(sender, recipient, amount);
burn(recipient, tokensToBurn);
emit Transfer(sender, recipient, tokensToTransfer);
}
function findOnePercent(uint256 value) public pure returns (uint256) {
uint256 basePercent = 5; // % of tokens to be burned from amount of transfer
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(100);
return onePercent;
}
function beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
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);
}
}
contract Whitelist is StandardToken {
mapping(address => bool) whitelist;
event AddedToWhitelist(address indexed account);
event AddedToWhitelistBulk(address indexed account);
event RemovedFromWhitelist(address indexed account);
modifier onlyWhitelisted() {
require(isWhitelisted(_msgSender()), "This address is not whitelisted");
_;
}
// For multiple addresses to be added in the whitelist
function addToWhitelistInBulk(address[] memory _address) public onlyOwner {
for (uint8 loop = 0; loop < _address.length; loop++) {
whitelist[_address[loop]] = true;
}
}
// For single address to be added in whitelist
function removeFromWhitelistSingle(address _address) public onlyOwner {
whitelist[_address] = false;
emit RemovedFromWhitelist(_address);
}
// For multiple addresses to be removed from the whitelist
function removeFromWhitelistInBulk(address[] memory _address) public onlyOwner {
for (uint8 loop = 0; loop < _address.length; loop++) {
whitelist[_address[loop]] = false;
}
}
// Check whether an address is whitelisted or not
function isWhitelisted(address _address) public view returns(bool) {
return whitelist[_address];
}
}
contract Configurable {
uint256 public cap = 50000*10**18; //---------| 50k Tokens for Presale |---------
uint256 public basePrice = 1000*10**18; //-----| 1 ETH = 1000 Tokens |---------
uint256 public tokensSold = 0;
uint256 public tokenReserve = 100000*10**18; //-----------| 100k Tokens Total Supply |------
uint256 public remainingTokens = 0;
}
contract CrowdsaleToken is Whitelist, Configurable {
using SafeMath for uint256;
enum Phases {none, start, end}
Phases currentPhase;
constructor() {
currentPhase = Phases.none;
balances_[owner()] = balances_[owner()].add(tokenReserve);
_totalSupply = _totalSupply.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner(), tokenReserve);
}
receive() external payable {
require(isWhitelisted(_msgSender()) == true, "This address is not whitelisted");
require(currentPhase == Phases.start, "The coin offering has not started yet");
require(msg.value <= 1e18 && msg.value >= 5e17, "You can send at least 0.5 ETH but not more than 1 ETH");
require(remainingTokens > 0, "Presale token limit reached");
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
ethBalances[_msgSender()] = ethBalances[_msgSender()].add(weiAmount);
ethBalances[address(this)] = ethBalances[address(this)].add(weiAmount);
require(ethBalances[_msgSender()] <= 1e18, "Cannot send more than 1 ETH");
require(ethBalances[address(this)] <= 50e18, "Target amount of 50 ETH reached");
if(tokensSold.add(tokens) > cap){
revert("Exceeding limit of presale tokens");
}
tokensSold = tokensSold.add(tokens); // counting tokens sold
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
_msgSender().transfer(returnWei);
emit Transfer(address(this), _msgSender(), returnWei);
}
uint256 tokensToBurn = tokens.mul(50).div(1000); // tokens burned with each pre-sale purchase
balances_[owner()] = balances_[owner()].sub(tokens, "ERC20: transfer amount exceeds balance");
balances_[owner()] = balances_[owner()].sub(tokensToBurn, "ERC20: transfer amount exceeds balance");
_totalSupply = _totalSupply.sub(tokensToBurn, 'Overflow while burning tokens');
balances_[_msgSender()] = balances_[_msgSender()].add(tokens);
emit Transfer(address(this), _msgSender(), tokens);
emit Transfer(address(this), address(0x000000000000000000000000000000000000dEaD) , tokensToBurn);
_owner.transfer(weiAmount);
}
function startCoinOffering() public onlyOwner {
require(currentPhase != Phases.end, "The coin offering has ended");
currentPhase = Phases.start;
}
function endCoinOffering() internal {
currentPhase = Phases.end;
_owner.transfer(address(this).balance);
}
function finalizeCoinOffering() public onlyOwner {
require(currentPhase != Phases.end, "The coin offering has ended");
endCoinOffering();
}
}
contract FRANK is CrowdsaleToken {
string public name = "Franklin.Finance";
string public symbol = "FRANK";
uint32 public decimals = 18;
uint256 public basePercent = 100;
} | 0x6080604052600436106101e75760003560e01c80638a1fcd6011610102578063c5ac0ded11610095578063dcd9d7b111610064578063dcd9d7b1146114a7578063dd62ed3e146114be578063ee39190e14611543578063f2fde38b1461160857610c1c565b8063c5ac0ded146113d5578063c7876ea414611400578063cbcb31711461142b578063d89f17ef1461145657610c1c565b8063a457c2d7116100d1578063a457c2d714611279578063a6a68606146112ea578063a9059cbb14611339578063bf583903146113aa57610c1c565b80638a1fcd60146111505780638da5cb5b1461117b5780638f32d59b146111bc57806395d89b41146111e957610c1c565b80633af32abf1161017a578063518ab2a811610149578063518ab2a81461107e57806370a08231146110a9578063715018a61461110e57806378e979251461112557610c1c565b80633af32abf14610f705780633c4badb014610fd75780633eaaf86b1461103c5780634e8ee2e51461106757610c1c565b806323b872dd116101b657806323b872dd14610e12578063313ce56714610ea3578063355274ea14610ed45780633950935114610eff57610c1c565b806306fdde0314610c21578063095ea7b314610cb1578063128c127e14610d2257806318160ddd14610de757610c1c565b36610c1c57600115156102006101fb611659565b611661565b151514610275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f546869732061646472657373206973206e6f742077686974656c69737465640081525060200191505060405180910390fd5b6001600281111561028257fe5b600d60009054906101000a900460ff16600281111561029d57fe5b146102f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806130ca6025913960400191505060405180910390fd5b670de0b6b3a7640000341115801561031357506706f05b59d3b200003410155b610368576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806130ef6035913960400191505060405180910390fd5b6000600c54116103e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f50726573616c6520746f6b656e206c696d69742072656163686564000000000081525060200191505060405180910390fd5b60003490506000610416670de0b6b3a7640000610408600954856116b790919063ffffffff16565b61173d90919063ffffffff16565b90506000610473836002600061042a611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461178790919063ffffffff16565b6002600061047f611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061050f83600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461178790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550670de0b6b3a764000060026000610567611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f43616e6e6f742073656e64206d6f7265207468616e203120455448000000000081525060200191505060405180910390fd5b6802b5e3af16b1880000600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156106d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f54617267657420616d6f756e74206f662035302045544820726561636865640081525060200191505060405180910390fd5b6008546106ec83600a5461178790919063ffffffff16565b1115610743576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130a96021913960400191505060405180910390fd5b61075882600a5461178790919063ffffffff16565b600a81905550610775600a5460085461180f90919063ffffffff16565b600c81905550600081111561083f5761078c611659565b73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156107d1573d6000803e3d6000fd5b506107da611659565b73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b60006108696103e861085b6032866116b790919063ffffffff16565b61173d90919063ffffffff16565b90506108de836040518060600160405280602681526020016130836026913960016000610894611859565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b600160006108ea611859565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099b816040518060600160405280602681526020016130836026913960016000610951611859565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b600160006109a7611859565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a31816040518060400160405280601d81526020017f4f766572666c6f77207768696c65206275726e696e6720746f6b656e730000008152506000546118839092919063ffffffff16565b600081905550610a908360016000610a47611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461178790919063ffffffff16565b60016000610a9c611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ae2611659565b73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a361dead73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f19350505050158015610c15573d6000803e3d6000fd5b5050505050005b600080fd5b348015610c2d57600080fd5b50610c36611943565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c76578082015181840152602081019050610c5b565b50505050905090810190601f168015610ca35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610cbd57600080fd5b50610d0a60048036036040811015610cd457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119e1565b60405180821515815260200191505060405180910390f35b348015610d2e57600080fd5b50610de560048036036020811015610d4557600080fd5b8101908080359060200190640100000000811115610d6257600080fd5b820183602082011115610d7457600080fd5b80359060200191846020830284011164010000000083111715610d9657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506119ff565b005b348015610df357600080fd5b50610dfc611aea565b6040518082815260200191505060405180910390f35b348015610e1e57600080fd5b50610e8b60048036036060811015610e3557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611af3565b60405180821515815260200191505060405180910390f35b348015610eaf57600080fd5b50610eb8611bcc565b604051808263ffffffff16815260200191505060405180910390f35b348015610ee057600080fd5b50610ee9611be2565b6040518082815260200191505060405180910390f35b348015610f0b57600080fd5b50610f5860048036036040811015610f2257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611be8565b60405180821515815260200191505060405180910390f35b348015610f7c57600080fd5b50610fbf60048036036020811015610f9357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611661565b60405180821515815260200191505060405180910390f35b348015610fe357600080fd5b5061102660048036036020811015610ffa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c9b565b6040518082815260200191505060405180910390f35b34801561104857600080fd5b50611051611ce4565b6040518082815260200191505060405180910390f35b34801561107357600080fd5b5061107c611cea565b005b34801561108a57600080fd5b50611093611e08565b6040518082815260200191505060405180910390f35b3480156110b557600080fd5b506110f8600480360360208110156110cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e0e565b6040518082815260200191505060405180910390f35b34801561111a57600080fd5b50611123611e57565b005b34801561113157600080fd5b5061113a611f75565b6040518082815260200191505060405180910390f35b34801561115c57600080fd5b50611165611f7b565b6040518082815260200191505060405180910390f35b34801561118757600080fd5b50611190611859565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156111c857600080fd5b506111d1611f81565b60405180821515815260200191505060405180910390f35b3480156111f557600080fd5b506111fe611fd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561123e578082015181840152602081019050611223565b50505050905090810190601f16801561126b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561128557600080fd5b506112d26004803603604081101561129c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612077565b60405180821515815260200191505060405180910390f35b3480156112f657600080fd5b506113236004803603602081101561130d57600080fd5b8101908080359060200190929190505050612144565b6040518082815260200191505060405180910390f35b34801561134557600080fd5b506113926004803603604081101561135c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612197565b60405180821515815260200191505060405180910390f35b3480156113b657600080fd5b506113bf6121b5565b6040518082815260200191505060405180910390f35b3480156113e157600080fd5b506113ea6121bb565b6040518082815260200191505060405180910390f35b34801561140c57600080fd5b506114156121c1565b6040518082815260200191505060405180910390f35b34801561143757600080fd5b506114406121c7565b6040518082815260200191505060405180910390f35b34801561146257600080fd5b506114a56004803603602081101561147957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121cd565b005b3480156114b357600080fd5b506114bc6122c8565b005b3480156114ca57600080fd5b5061152d600480360360408110156114e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123ca565b6040518082815260200191505060405180910390f35b34801561154f57600080fd5b506116066004803603602081101561156657600080fd5b810190808035906020019064010000000081111561158357600080fd5b82018360208201111561159557600080fd5b803590602001918460208302840111640100000000831117156115b757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050612451565b005b34801561161457600080fd5b506116576004803603602081101561162b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061253c565b005b600033905090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000808314156116ca5760009050611737565b60008284029050828482816116db57fe5b0414611732576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131246021913960400191505060405180910390fd5b809150505b92915050565b600061177f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506125a5565b905092915050565b600080828401905083811015611805576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061185183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611883565b905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000838311158290611930576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118f55780820151818401526020810190506118da565b50505050905090810190601f1680156119225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600e8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119d95780601f106119ae576101008083540402835291602001916119d9565b820191906000526020600020905b8154815290600101906020018083116119bc57829003601f168201915b505050505081565b60006119f56119ee611659565b848461266b565b6001905092915050565b611a07611f81565b611a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b60005b81518160ff161015611ae657600060076000848460ff1681518110611a8057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611a5f565b5050565b60008054905090565b6000611b00848484612862565b611bc184611b0c611659565b611bbc8560405180606001604052806028815260200161314560289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000611b72611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b61266b565b600190509392505050565b601060009054906101000a900463ffffffff1681565b60085481565b6000611c91611bf5611659565b84611c8c8560036000611c06611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461178790919063ffffffff16565b61266b565b6001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60005481565b611cf2611f81565b611d47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b600280811115611d5357fe5b600d60009054906101000a900460ff166002811115611d6e57fe5b1415611de2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686520636f696e206f66666572696e672068617320656e646564000000000081525060200191505060405180910390fd5b6001600d60006101000a81548160ff02191690836002811115611e0157fe5b0217905550565b600a5481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611e5f611f81565b611eb4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60045481565b60055481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b600f8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206f5780601f106120445761010080835404028352916020019161206f565b820191906000526020600020905b81548152906001019060200180831161205257829003601f168201915b505050505081565b600061213a612084611659565b84612135856040518060600160405280602581526020016131f860259139600360006120ae611659565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b61266b565b6001905092915050565b6000806005905060006121608285612c8c90919063ffffffff16565b9050600061218a606461217c85856116b790919063ffffffff16565b61173d90919063ffffffff16565b9050809350505050919050565b60006121ab6121a4611659565b8484612862565b6001905092915050565b600c5481565b60115481565b60095481565b600b5481565b6121d5611f81565b61222a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fcdd2e9b91a56913d370075169cefa1602ba36be5301664f752192bb1709df75760405160405180910390a250565b6122d0611f81565b612325576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b60028081111561233157fe5b600d60009054906101000a900460ff16600281111561234c57fe5b14156123c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f54686520636f696e206f66666572696e672068617320656e646564000000000081525060200191505060405180910390fd5b6123c8612cc7565b565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612459611f81565b6124ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b60005b81518160ff16101561253857600160076000848460ff16815181106124d257fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506124b1565b5050565b612544611f81565b612599576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131b36021913960400191505060405180910390fd5b6125a281612d56565b50565b60008083118290612651576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156126165780820151818401526020810190506125fb565b50505050905090810190601f1680156126435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161265d57fe5b049050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156126f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806131d46024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612777576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806130616022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156128e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061318e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561296e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061301c6023913960400191505060405180910390fd5b61298560055460045461178790919063ffffffff16565b421015806129cc5750612996611859565b73ffffffffffffffffffffffffffffffffffffffff166129b4611659565b73ffffffffffffffffffffffffffffffffffffffff16145b612a3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f546f6b656e73206e6f7420756e6c6f636b65642079657400000000000000000081525060200191505060405180910390fd5b612aaa8160405180606001604052806026815260200161308360269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b3f81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461178790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36000612bf282612144565b90506000612c09828461180f90919063ffffffff16565b9050612c16858585612e50565b612c208483612e55565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505050565b600080612c998484611787565b90506000612ca882600161180f565b9050612cbd612cb7828661173d565b856116b7565b9250505092915050565b6002600d60006101000a81548160ff02191690836002811115612ce657fe5b0217905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015612d53573d6000803e3d6000fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612d9057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061316d6021913960400191505060405180910390fd5b612ee782600083612e50565b612f538160405180606001604052806022815260200161303f60229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118839092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fab8160005461180f90919063ffffffff16565b600081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365457863656564696e67206c696d6974206f662070726573616c6520746f6b656e7354686520636f696e206f66666572696e6720686173206e6f74207374617274656420796574596f752063616e2073656e64206174206c6561737420302e352045544820627574206e6f74206d6f7265207468616e203120455448536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f20616464726573734e6f7420617574686f726973656420666f722074686973206f7065726174696f6e45524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a93b950935cae02c7fde3f861a29c981a23e76cf809853ed0770a30d050c3cce64736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,571 |
0x8baf22bf5788be6bc099deffc0ae6c5206631dd6 | // 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"}]}} | 1,572 |
0xec5ab129a37c820ff075d1030c47a37084fe9fc9 | /*
Welcome to the crazy world of Troll.finance!
https://twitter.com/gravitasETH
https://t.me/shortfallofgravitasETH
*/
// 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 gravitas 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 = "Shortfall Of Gravitas";
string private constant _symbol = 't.me/shortfallofgravitasETH️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 4;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
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;
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280601581526020017f53686f727466616c6c204f662047726176697461730000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601e81526020017f742e6d652f73686f727466616c6c6f666772617669746173455448efb88f0000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b864f3be8b30430a78c444b7ba5c8b2d8c9ca41b41a69ddd5f2f65021277d71664736f6c634300060c0033 | {"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"}]}} | 1,573 |
0x04f5e8008b5b9bcade5100cd1d28f7ea912bf944 | /**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract WhenMoon 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 = 1e9 * 10**9;
string public constant name = unicode"WHENMOON"; ////
string public constant symbol = unicode"WHENMOON"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 3;
uint public _sellFee = 3;
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);
}
} | 0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf91461056d578063db92dbb614610582578063dcb0e0ad14610597578063dd62ed3e146105b7578063e8078d94146105fd57600080fd5b806395d89b4114610227578063a9059cbb14610522578063b2131f7d14610542578063c3c8cd801461055857600080fd5b8063715018a6116100dc578063715018a6146104af5780637a49cddb146104c45780638da5cb5b146104e457806394b8d8f21461050257600080fd5b80635090161714610444578063590f897e146104645780636fc3eaec1461047a57806370a082311461048f57600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039d57806340b9a54b146103d657806345596e2e146103ec57806349bd5a5e1461040c57600080fd5b806327f3a72a1461032b578063313ce5671461034057806331c2d8471461036757806332d873d81461038757600080fd5b80630b78f9c0116101c15780630b78f9c0146102ba57806318160ddd146102da5780631940d020146102f557806323b872dd1461030b57600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f614610268578063095ea7b31461028a57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025b604051806040016040528060088152602001672ba422a726a7a7a760c11b81525081565b60405161021e9190611b96565b34801561027457600080fd5b50610288610283366004611c10565b610612565b005b34801561029657600080fd5b506102aa6102a5366004611c2d565b610687565b604051901515815260200161021e565b3480156102c657600080fd5b506102886102d5366004611c59565b61069d565b3480156102e657600080fd5b50670de0b6b3a7640000610214565b34801561030157600080fd5b50610214600f5481565b34801561031757600080fd5b506102aa610326366004611c7b565b610720565b34801561033757600080fd5b50610214610808565b34801561034c57600080fd5b50610355600981565b60405160ff909116815260200161021e565b34801561037357600080fd5b50610288610382366004611cd2565b610818565b34801561039357600080fd5b5061021460105481565b3480156103a957600080fd5b506102aa6103b8366004611c10565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e257600080fd5b50610214600b5481565b3480156103f857600080fd5b50610288610407366004611d97565b6108a4565b34801561041857600080fd5b50600a5461042c906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045057600080fd5b5061028861045f366004611c10565b610968565b34801561047057600080fd5b50610214600c5481565b34801561048657600080fd5b506102886109d6565b34801561049b57600080fd5b506102146104aa366004611c10565b610a03565b3480156104bb57600080fd5b50610288610a1e565b3480156104d057600080fd5b506102886104df366004611cd2565b610a92565b3480156104f057600080fd5b506000546001600160a01b031661042c565b34801561050e57600080fd5b506011546102aa9062010000900460ff1681565b34801561052e57600080fd5b506102aa61053d366004611c2d565b610ba1565b34801561054e57600080fd5b50610214600d5481565b34801561056457600080fd5b50610288610bae565b34801561057957600080fd5b50610288610be4565b34801561058e57600080fd5b50610214610c88565b3480156105a357600080fd5b506102886105b2366004611dbe565b610ca0565b3480156105c357600080fd5b506102146105d2366004611ddb565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060957600080fd5b50610288610d1d565b6008546001600160a01b0316336001600160a01b03161461063257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b6000610694338484611063565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106bd57600080fd5b600a8211156106cb57600080fd5b600a8111156106d957600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561074e57506001600160a01b03831660009081526004602052604090205460ff16155b80156107675750600a546001600160a01b038581169116145b156107b6576001600160a01b03831632146107b65760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107c1848484611187565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107f0908490611e2a565b90506107fd853383611063565b506001949350505050565b600061081330610a03565b905090565b6008546001600160a01b0316336001600160a01b03161461083857600080fd5b60005b81518110156108a05760006006600084848151811061085c5761085c611e41565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089881611e57565b91505061083b565b5050565b6000546001600160a01b031633146108ce5760405162461bcd60e51b81526004016107ad90611e70565b6008546001600160a01b0316336001600160a01b0316146108ee57600080fd5b600081116109335760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107ad565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161067c565b6009546001600160a01b0316336001600160a01b03161461098857600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a530149060200161067c565b6008546001600160a01b0316336001600160a01b0316146109f657600080fd5b47610a00816117f5565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a485760405162461bcd60e51b81526004016107ad90611e70565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ab257600080fd5b60005b81518110156108a057600a5482516001600160a01b0390911690839083908110610ae157610ae1611e41565b60200260200101516001600160a01b031614158015610b32575060075482516001600160a01b0390911690839083908110610b1e57610b1e611e41565b60200260200101516001600160a01b031614155b15610b8f57600160066000848481518110610b4f57610b4f611e41565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b9981611e57565b915050610ab5565b6000610694338484611187565b6008546001600160a01b0316336001600160a01b031614610bce57600080fd5b6000610bd930610a03565b9050610a008161187a565b6000546001600160a01b03163314610c0e5760405162461bcd60e51b81526004016107ad90611e70565b60115460ff1615610c5b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a54600090610813906001600160a01b0316610a03565b6000546001600160a01b03163314610cca5760405162461bcd60e51b81526004016107ad90611e70565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161067c565b6000546001600160a01b03163314610d475760405162461bcd60e51b81526004016107ad90611e70565b60115460ff1615610d945760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107ad565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610dd03082670de0b6b3a7640000611063565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611ea5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea39190611ea5565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f149190611ea5565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f4481610a03565b600080610f596000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fc1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fe69190611ec2565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561103f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a09190611ef0565b6001600160a01b0383166110c55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107ad565b6001600160a01b0382166111265760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107ad565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111eb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107ad565b6001600160a01b03821661124d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107ad565b600081116112af5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107ad565b6001600160a01b03831660009081526006602052604090205460ff16156113245760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107ad565b600080546001600160a01b0385811691161480159061135157506000546001600160a01b03848116911614155b1561179657600a546001600160a01b03858116911614801561138157506007546001600160a01b03848116911614155b80156113a657506001600160a01b03831660009081526004602052604090205460ff16155b156116325760115460ff166113fd5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107ad565b601054420361143c5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107ad565b42601054610e1061144d9190611f0d565b11156114c757600f5461145f84610a03565b6114699084611f0d565b11156114c75760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107ad565b6001600160a01b03831660009081526005602052604090206001015460ff1661152f576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b42601054607861153f9190611f0d565b111561161357600e548211156115975760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107ad565b6115a242600f611f0d565b6001600160a01b038416600090815260056020526040902054106116135760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107ad565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff1615801561164c575060115460ff165b80156116665750600a546001600160a01b03858116911614155b156117965761167642600f611f0d565b6001600160a01b038516600090815260056020526040902054106116e85760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107ad565b60006116f330610a03565b9050801561177f5760115462010000900460ff161561177657600d54600a5460649190611728906001600160a01b0316610a03565b6117329190611f25565b61173c9190611f44565b81111561177657600d54600a546064919061175f906001600160a01b0316610a03565b6117699190611f25565b6117739190611f44565b90505b61177f8161187a565b47801561178f5761178f476117f5565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117d857506001600160a01b03841660009081526004602052604090205460ff165b156117e1575060005b6117ee85858584866119ee565b5050505050565b6008546001600160a01b03166108fc61180f600284611f44565b6040518115909202916000818181858888f19350505050158015611837573d6000803e3d6000fd5b506009546001600160a01b03166108fc611852600284611f44565b6040518115909202916000818181858888f193505050501580156108a0573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118be576118be611e41565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b9190611ea5565b8160018151811061194e5761194e611e41565b6001600160a01b0392831660209182029290920101526007546119749130911684611063565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119ad908590600090869030904290600401611f66565b600060405180830381600087803b1580156119c757600080fd5b505af11580156119db573d6000803e3d6000fd5b50506011805461ff001916905550505050565b60006119fa8383611a10565b9050611a0886868684611a57565b505050505050565b6000808315611a50578215611a285750600b54611a50565b50600c54601054611a3b90610384611f0d565b421015611a5057611a4d600582611f0d565b90505b9392505050565b600080611a648484611b34565b6001600160a01b0388166000908152600260205260409020549193509150611a8d908590611e2a565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611abd908390611f0d565b6001600160a01b038616600090815260026020526040902055611adf81611b68565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b2491815260200190565b60405180910390a3505050505050565b600080806064611b448587611f25565b611b4e9190611f44565b90506000611b5c8287611e2a565b96919550909350505050565b30600090815260026020526040902054611b83908290611f0d565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bc357858101830151858201604001528201611ba7565b81811115611bd5576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a0057600080fd5b8035611c0b81611beb565b919050565b600060208284031215611c2257600080fd5b8135611a5081611beb565b60008060408385031215611c4057600080fd5b8235611c4b81611beb565b946020939093013593505050565b60008060408385031215611c6c57600080fd5b50508035926020909101359150565b600080600060608486031215611c9057600080fd5b8335611c9b81611beb565b92506020840135611cab81611beb565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611ce557600080fd5b823567ffffffffffffffff80821115611cfd57600080fd5b818501915085601f830112611d1157600080fd5b813581811115611d2357611d23611cbc565b8060051b604051601f19603f83011681018181108582111715611d4857611d48611cbc565b604052918252848201925083810185019188831115611d6657600080fd5b938501935b82851015611d8b57611d7c85611c00565b84529385019392850192611d6b565b98975050505050505050565b600060208284031215611da957600080fd5b5035919050565b8015158114610a0057600080fd5b600060208284031215611dd057600080fd5b8135611a5081611db0565b60008060408385031215611dee57600080fd5b8235611df981611beb565b91506020830135611e0981611beb565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3c57611e3c611e14565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e6957611e69611e14565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eb757600080fd5b8151611a5081611beb565b600080600060608486031215611ed757600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f0257600080fd5b8151611a5081611db0565b60008219821115611f2057611f20611e14565b500190565b6000816000190483118215151615611f3f57611f3f611e14565b500290565b600082611f6157634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fb65784516001600160a01b031683529383019391830191600101611f91565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122058bda2317bf84c4d2d93a8ff53af34e971c8966acb783e9155430e665ce1def064736f6c634300080d0033 | {"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"}]}} | 1,574 |
0x331508b4f005a87bec628d0efed20fb15c69e6c4 | /**
*Submitted for verification at Etherscan.io on 2022-04-03
*/
// SPDX-License-Identifier: Unlicensed
//loose
//grassroots
//transparent
//open
//fully global
//Only decentralised organisations, like the $CULT of today, are our future.
//Total: 100,000,000,000
//Limit: 1,000,000,000
//Buy and sell: 6%
//Liquidity, Rewards and Marketing
//No team tokens
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 APS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Amorphous";
string private constant _symbol = "APS";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
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(0x8a1f5BFc606Cd60f0665eB3FF00eaB255D92Bd30);
address payable private _marketingAddress = payable(0x8a1f5BFc606Cd60f0665eB3FF00eaB255D92Bd30);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000001 * 10**9;
uint256 public _maxWalletSize = 1000000001 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610554578063dd62ed3e14610574578063ea1644d5146105ba578063f2fde38b146105da57600080fd5b8063a2a957bb146104cf578063a9059cbb146104ef578063bfd792841461050f578063c3c8cd801461053f57600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104af57600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611954565b6105fa565b005b34801561020a57600080fd5b50604080518082019091526009815268416d6f7270686f757360b81b60208201525b6040516102399190611a19565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a6e565b610699565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b5068056bc75e2d631000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611a9a565b6106b0565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611adb565b610719565b34801561036e57600080fd5b506101fc61037d366004611b08565b610764565b34801561038e57600080fd5b506101fc6107ac565b3480156103a357600080fd5b506102c26103b2366004611adb565b6107f7565b3480156103c357600080fd5b506101fc610819565b3480156103d857600080fd5b506101fc6103e7366004611b23565b61088d565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611adb565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610292565b34801561045957600080fd5b506101fc610468366004611b08565b6108bc565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b5060408051808201909152600381526241505360e81b602082015261022c565b3480156104bb57600080fd5b506101fc6104ca366004611b23565b610904565b3480156104db57600080fd5b506101fc6104ea366004611b3c565b610933565b3480156104fb57600080fd5b5061026261050a366004611a6e565b610971565b34801561051b57600080fd5b5061026261052a366004611adb565b60106020526000908152604090205460ff1681565b34801561054b57600080fd5b506101fc61097e565b34801561056057600080fd5b506101fc61056f366004611b6e565b6109d2565b34801561058057600080fd5b506102c261058f366004611bf2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c657600080fd5b506101fc6105d5366004611b23565b610a73565b3480156105e657600080fd5b506101fc6105f5366004611adb565b610aa2565b6000546001600160a01b0316331461062d5760405162461bcd60e51b815260040161062490611c2b565b60405180910390fd5b60005b81518110156106955760016010600084848151811061065157610651611c60565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068d81611c8c565b915050610630565b5050565b60006106a6338484610b8c565b5060015b92915050565b60006106bd848484610cb0565b61070f843361070a85604051806060016040528060288152602001611da4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ec565b610b8c565b5060019392505050565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161062490611c2b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161062490611c2b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e157506013546001600160a01b0316336001600160a01b0316145b6107ea57600080fd5b476107f481611226565b50565b6001600160a01b0381166000908152600260205260408120546106aa90611260565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161062490611c2b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b75760405162461bcd60e51b815260040161062490611c2b565b601655565b6000546001600160a01b031633146108e65760405162461bcd60e51b815260040161062490611c2b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092e5760405162461bcd60e51b815260040161062490611c2b565b601855565b6000546001600160a01b0316331461095d5760405162461bcd60e51b815260040161062490611c2b565b600893909355600a91909155600955600b55565b60006106a6338484610cb0565b6012546001600160a01b0316336001600160a01b031614806109b357506013546001600160a01b0316336001600160a01b0316145b6109bc57600080fd5b60006109c7306107f7565b90506107f4816112e4565b6000546001600160a01b031633146109fc5760405162461bcd60e51b815260040161062490611c2b565b60005b82811015610a6d578160056000868685818110610a1e57610a1e611c60565b9050602002016020810190610a339190611adb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6581611c8c565b9150506109ff565b50505050565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260040161062490611c2b565b601755565b6000546001600160a01b03163314610acc5760405162461bcd60e51b815260040161062490611c2b565b6001600160a01b038116610b315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610624565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610624565b6001600160a01b038216610c4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610624565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610624565b6001600160a01b038216610d765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610624565b60008111610dd85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610624565b6000546001600160a01b03848116911614801590610e0457506000546001600160a01b03838116911614155b156110e557601554600160a01b900460ff16610e9d576000546001600160a01b03848116911614610e9d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610624565b601654811115610eef5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610624565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3157506001600160a01b03821660009081526010602052604090205460ff16155b610f895760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610624565b6015546001600160a01b0383811691161461100e5760175481610fab846107f7565b610fb59190611ca5565b1061100e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610624565b6000611019306107f7565b6018546016549192508210159082106110325760165491505b8080156110495750601554600160a81b900460ff16155b801561106357506015546001600160a01b03868116911614155b80156110785750601554600160b01b900460ff165b801561109d57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c257506001600160a01b03841660009081526005602052604090205460ff16155b156110e2576110d0826112e4565b4780156110e0576110e047611226565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112757506001600160a01b03831660009081526005602052604090205460ff165b8061115957506015546001600160a01b0385811691161480159061115957506015546001600160a01b03848116911614155b15611166575060006111e0565b6015546001600160a01b03858116911614801561119157506014546001600160a01b03848116911614155b156111a357600854600c55600954600d555b6015546001600160a01b0384811691161480156111ce57506014546001600160a01b03858116911614155b156111e057600a54600c55600b54600d555b610a6d8484848461145e565b600081848411156112105760405162461bcd60e51b81526004016106249190611a19565b50600061121d8486611cbd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b60006006548211156112c75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610624565b60006112d161148c565b90506112dd83826114af565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132c5761132c611c60565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190611cd4565b816001815181106113bc576113bc611c60565b6001600160a01b0392831660209182029290920101526014546113e29130911684610b8c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141b908590600090869030904290600401611cf1565b600060405180830381600087803b15801561143557600080fd5b505af1158015611449573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146b5761146b6114f1565b61147684848461151f565b80610a6d57610a6d600e54600c55600f54600d55565b6000806000611499611616565b90925090506114a882826114af565b9250505090565b60006112dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611658565b600c541580156115015750600d54155b1561150857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153187611686565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156390876116e3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115929086611725565b6001600160a01b0389166000908152600260205260409020556115b481611784565b6115be84836117ce565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160391815260200190565b60405180910390a3505050505050505050565b600654600090819068056bc75e2d6310000061163282826114af565b82101561164f5750506006549268056bc75e2d6310000092509050565b90939092509050565b600081836116795760405162461bcd60e51b81526004016106249190611a19565b50600061121d8486611d62565b60008060008060008060008060006116a38a600c54600d546117f2565b92509250925060006116b361148c565b905060008060006116c68e878787611847565b919e509c509a509598509396509194505050505091939550919395565b60006112dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ec565b6000806117328385611ca5565b9050838110156112dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610624565b600061178e61148c565b9050600061179c8383611897565b306000908152600260205260409020549091506117b99082611725565b30600090815260026020526040902055505050565b6006546117db90836116e3565b6006556007546117eb9082611725565b6007555050565b600080808061180c60646118068989611897565b906114af565b9050600061181f60646118068a89611897565b90506000611837826118318b866116e3565b906116e3565b9992985090965090945050505050565b60008080806118568886611897565b905060006118648887611897565b905060006118728888611897565b905060006118848261183186866116e3565b939b939a50919850919650505050505050565b6000826000036118a9575060006106aa565b60006118b58385611d84565b9050826118c28583611d62565b146112dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610624565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f457600080fd5b803561194f8161192f565b919050565b6000602080838503121561196757600080fd5b823567ffffffffffffffff8082111561197f57600080fd5b818501915085601f83011261199357600080fd5b8135818111156119a5576119a5611919565b8060051b604051601f19603f830116810181811085821117156119ca576119ca611919565b6040529182528482019250838101850191888311156119e857600080fd5b938501935b82851015611a0d576119fe85611944565b845293850193928501926119ed565b98975050505050505050565b600060208083528351808285015260005b81811015611a4657858101830151858201604001528201611a2a565b81811115611a58576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8157600080fd5b8235611a8c8161192f565b946020939093013593505050565b600080600060608486031215611aaf57600080fd5b8335611aba8161192f565b92506020840135611aca8161192f565b929592945050506040919091013590565b600060208284031215611aed57600080fd5b81356112dd8161192f565b8035801515811461194f57600080fd5b600060208284031215611b1a57600080fd5b6112dd82611af8565b600060208284031215611b3557600080fd5b5035919050565b60008060008060808587031215611b5257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8357600080fd5b833567ffffffffffffffff80821115611b9b57600080fd5b818601915086601f830112611baf57600080fd5b813581811115611bbe57600080fd5b8760208260051b8501011115611bd357600080fd5b602092830195509350611be99186019050611af8565b90509250925092565b60008060408385031215611c0557600080fd5b8235611c108161192f565b91506020830135611c208161192f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c9e57611c9e611c76565b5060010190565b60008219821115611cb857611cb8611c76565b500190565b600082821015611ccf57611ccf611c76565b500390565b600060208284031215611ce657600080fd5b81516112dd8161192f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d415784516001600160a01b031683529383019391830191600101611d1c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d7f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d9e57611d9e611c76565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ef6c573b46699e6a8b362d0541076c57b64cceaa639ad5d97150124f2533a37664736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,575 |
0x16a770Cc8bE47f0E7f68438AA33AF0E8Bc95E8f1 | /**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-27
*/
// 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 MasterRoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MasterRoshi";
string private constant _symbol = "Roshi";
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; // 0%
uint256 private _teamFee = 10; // 10% Marketing and Development Fee
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _MasterRoshi;
address payable private _TurtleTax;
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 marketfund, address payable turtletax, address payable masterroshi) {
_Marketingfund = marketfund;
_MasterRoshi = masterroshi;
_TurtleTax = turtletax;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_TurtleTax] = true;
_isExcludedFromFee[_MasterRoshi] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(2));
_TurtleTax.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 20000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _MasterRoshi);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _MasterRoshi);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _MasterRoshi);
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);
}
function setRouterPercent(uint256 maxRouterPercent) external {
require(_msgSender() == _MasterRoshi);
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');
_teamFee = teamFee;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarketingWallet(address payable account) external {
require(_msgSender() == _MasterRoshi);
_Marketingfund = account;
}
function setDev(address payable account) external {
require(_msgSender() == _MasterRoshi);
_MasterRoshi = account;
}
function setClan(address payable account) external {
require(_msgSender() == _MasterRoshi);
_TurtleTax = account;
}
} | 0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063cba0e9961161008a578063d543dbeb11610064578063d543dbeb146104fa578063dd62ed3e1461051a578063e01af92c14610560578063e47d60601461058057600080fd5b8063cba0e9961461048b578063d00efb2f146104c4578063d477f05f146104da57600080fd5b8063b515566a116100c6578063b515566a14610421578063c0e6b46e14610441578063c3c8cd8014610461578063c9567bf91461047657600080fd5b806395d89b41146103b3578063a587e2f3146103e1578063a9059cbb1461040157600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034157806370a0823114610356578063715018a6146103765780638da5cb5b1461038b57600080fd5b8063437823ec146102e15780635932ead1146103015780635d098b381461032157600080fd5b806323b872dd1161019557806323b872dd14610263578063273123b71461028357806328667162146102a5578063313ce567146102c557600080fd5b806306fdde03146101c7578063095ea7b31461020d57806318160ddd1461023d57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152600b81526a4d6173746572526f73686960a81b60208201525b6040516102049190611eeb565b60405180910390f35b34801561021957600080fd5b5061022d610228366004611d7c565b6105b9565b6040519015158152602001610204565b34801561024957600080fd5b50683635c9adc5dea000005b604051908152602001610204565b34801561026f57600080fd5b5061022d61027e366004611d3c565b6105d0565b34801561028f57600080fd5b506102a361029e366004611ccc565b610639565b005b3480156102b157600080fd5b506102a36102c0366004611ea6565b61068d565b3480156102d157600080fd5b5060405160098152602001610204565b3480156102ed57600080fd5b506102a36102fc366004611ccc565b61071a565b34801561030d57600080fd5b506102a361031c366004611e6e565b610768565b34801561032d57600080fd5b506102a361033c366004611ccc565b6107b0565b34801561034d57600080fd5b506102a36107f2565b34801561036257600080fd5b50610255610371366004611ccc565b61081f565b34801561038257600080fd5b506102a3610841565b34801561039757600080fd5b506000546040516001600160a01b039091168152602001610204565b3480156103bf57600080fd5b50604080518082019091526005815264526f73686960d81b60208201526101f7565b3480156103ed57600080fd5b506102a36103fc366004611ccc565b6108b5565b34801561040d57600080fd5b5061022d61041c366004611d7c565b6108f7565b34801561042d57600080fd5b506102a361043c366004611da7565b610904565b34801561044d57600080fd5b506102a361045c366004611ea6565b6109a8565b34801561046d57600080fd5b506102a3610a3d565b34801561048257600080fd5b506102a3610a73565b34801561049757600080fd5b5061022d6104a6366004611ccc565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104d057600080fd5b5061025560165481565b3480156104e657600080fd5b506102a36104f5366004611ccc565b610e3a565b34801561050657600080fd5b506102a3610515366004611ea6565b610e7c565b34801561052657600080fd5b50610255610535366004611d04565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056c57600080fd5b506102a361057b366004611e6e565b610f49565b34801561058c57600080fd5b5061022d61059b366004611ccc565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105c6338484610f87565b5060015b92915050565b60006105dd8484846110ab565b61062f843361062a856040518060600160405280602881526020016120bc602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611522565b610f87565b5060019392505050565b6000546001600160a01b0316331461066c5760405162461bcd60e51b815260040161066390611f3e565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106b75760405162461bcd60e51b815260040161066390611f3e565b600181101580156106c9575060198111155b6107155760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d20323500000000006044820152606401610663565b600955565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161066390611f3e565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161066390611f3e565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6011546001600160a01b0316336001600160a01b0316146107d057600080fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461081257600080fd5b4761081c8161155c565b50565b6001600160a01b0381166000908152600260205260408120546105ca906115e1565b6000546001600160a01b0316331461086b5760405162461bcd60e51b815260040161066390611f3e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6011546001600160a01b0316336001600160a01b0316146108d557600080fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b60006105c63384846110ab565b6000546001600160a01b0316331461092e5760405162461bcd60e51b815260040161066390611f3e565b60005b81518110156109a4576001600e600084848151811061096057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061099c81612051565b915050610931565b5050565b6011546001600160a01b0316336001600160a01b0316146109c857600080fd5b60008111610a185760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610663565b610a37612710610a31683635c9adc5dea0000084611665565b906116e4565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a5d57600080fd5b6000610a683061081f565b905061081c81611726565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260040161066390611f3e565b601454600160a01b900460ff1615610af75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610663565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b343082683635c9adc5dea00000610f87565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6d57600080fd5b505afa158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba59190611ce8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bed57600080fd5b505afa158015610c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c259190611ce8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca59190611ce8565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610cd58161081f565b600080610cea6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d4d57600080fd5b505af1158015610d61573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d869190611ebe565b5050601480546801158e460913d000006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610e0257600080fd5b505af1158015610e16573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190611e8a565b6011546001600160a01b0316336001600160a01b031614610e5a57600080fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610ea65760405162461bcd60e51b815260040161066390611f3e565b60008111610ef65760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610663565b610f0e6064610a31683635c9adc5dea0000084611665565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6011546001600160a01b0316336001600160a01b031614610f6957600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b038316610fe95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610663565b6001600160a01b03821661104a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610663565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661110f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610663565b6001600160a01b0382166111715760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610663565b600081116111d35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610663565b6000546001600160a01b038481169116148015906111ff57506000546001600160a01b03838116911614155b156114c557601454600160b81b900460ff16156112e6576001600160a01b038316301480159061123857506001600160a01b0382163014155b801561125257506013546001600160a01b03848116911614155b801561126c57506013546001600160a01b03838116911614155b156112e6576013546001600160a01b0316336001600160a01b031614806112a657506014546001600160a01b0316336001600160a01b0316145b6112e65760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610663565b6001600160a01b03831630146113055760155481111561130557600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561134757506001600160a01b0382166000908152600e602052604090205460ff16155b80156113635750336000908152600e602052604090205460ff16155b61136c57600080fd5b6014546001600160a01b03848116911614801561139757506013546001600160a01b03838116911614155b80156113bc57506001600160a01b03821660009081526005602052604090205460ff16155b80156113d15750601454600160b81b900460ff165b1561141f576001600160a01b0382166000908152600f602052604090205442116113fa57600080fd5b61140542600f611fe3565b6001600160a01b0383166000908152600f60205260409020555b600061142a3061081f565b9050600d54811061143a5750600d545b600c546014549082101590600160a81b900460ff161580156114655750601454600160b01b900460ff165b801561146e5750805b801561148857506014546001600160a01b03868116911614155b80156114a257506013546001600160a01b03868116911614155b156114c2576114b082611726565b4780156114c0576114c04761155c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061150757506001600160a01b03831660009081526005602052604090205460ff165b15611510575060005b61151c848484846118cb565b50505050565b600081848411156115465760405162461bcd60e51b81526004016106639190611eeb565b506000611553848661203a565b95945050505050565b6010546001600160a01b03166108fc6115768360026116e4565b6040518115909202916000818181858888f1935050505015801561159e573d6000803e3d6000fd5b506012546001600160a01b03166108fc6115b98360026116e4565b6040518115909202916000818181858888f193505050501580156109a4573d6000803e3d6000fd5b60006006548211156116485760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610663565b60006116526118f9565b905061165e83826116e4565b9392505050565b600082611674575060006105ca565b6000611680838561201b565b90508261168d8583611ffb565b1461165e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610663565b600061165e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061191c565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061177c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117d057600080fd5b505afa1580156117e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118089190611ce8565b8160018151811061182957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260135461184f9130911684610f87565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611888908590600090869030904290600401611f73565b600060405180830381600087803b1580156118a257600080fd5b505af11580156118b6573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806118d8576118d861194a565b6118e3848484611978565b8061151c5761151c600a54600855600b54600955565b6000806000611906611a6f565b909250905061191582826116e4565b9250505090565b6000818361193d5760405162461bcd60e51b81526004016106639190611eeb565b5060006115538486611ffb565b60085415801561195a5750600954155b1561196157565b60088054600a5560098054600b5560009182905555565b60008060008060008061198a87611ab1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119bc9087611b0e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119eb9086611b50565b6001600160a01b038916600090815260026020526040902055611a0d81611baf565b611a178483611bf9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a5c91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611a8b82826116e4565b821015611aa857505060065492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611ace8a600854600954611c1d565b9250925092506000611ade6118f9565b90506000806000611af18e878787611c6c565b919e509c509a509598509396509194505050505091939550919395565b600061165e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611522565b600080611b5d8385611fe3565b90508381101561165e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610663565b6000611bb96118f9565b90506000611bc78383611665565b30600090815260026020526040902054909150611be49082611b50565b30600090815260026020526040902055505050565b600654611c069083611b0e565b600655600754611c169082611b50565b6007555050565b6000808080611c316064610a318989611665565b90506000611c446064610a318a89611665565b90506000611c5c82611c568b86611b0e565b90611b0e565b9992985090965090945050505050565b6000808080611c7b8886611665565b90506000611c898887611665565b90506000611c978888611665565b90506000611ca982611c568686611b0e565b939b939a50919850919650505050505050565b8035611cc781612098565b919050565b600060208284031215611cdd578081fd5b813561165e81612098565b600060208284031215611cf9578081fd5b815161165e81612098565b60008060408385031215611d16578081fd5b8235611d2181612098565b91506020830135611d3181612098565b809150509250929050565b600080600060608486031215611d50578081fd5b8335611d5b81612098565b92506020840135611d6b81612098565b929592945050506040919091013590565b60008060408385031215611d8e578182fd5b8235611d9981612098565b946020939093013593505050565b60006020808385031215611db9578182fd5b823567ffffffffffffffff80821115611dd0578384fd5b818501915085601f830112611de3578384fd5b813581811115611df557611df5612082565b8060051b604051601f19603f83011681018181108582111715611e1a57611e1a612082565b604052828152858101935084860182860187018a1015611e38578788fd5b8795505b83861015611e6157611e4d81611cbc565b855260019590950194938601938601611e3c565b5098975050505050505050565b600060208284031215611e7f578081fd5b813561165e816120ad565b600060208284031215611e9b578081fd5b815161165e816120ad565b600060208284031215611eb7578081fd5b5035919050565b600080600060608486031215611ed2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611f1757858101830151858201604001528201611efb565b81811115611f285783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611fc25784516001600160a01b031683529383019391830191600101611f9d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ff657611ff661206c565b500190565b60008261201657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156120355761203561206c565b500290565b60008282101561204c5761204c61206c565b500390565b60006000198214156120655761206561206c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461081c57600080fd5b801515811461081c57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c06412e6d259dd1c2673b554dbfefa64b05d02ad81ffed7f99c50226e9be532664736f6c63430008040033 | {"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"}]}} | 1,576 |
0x457a23a4c874066d5bf3cc8f6799d44c3a10542e | /**
*Submitted for verification at Etherscan.io on 2022-02-07
*/
/**
SAVE THE SON OF HARAMBE
https://t.me/SonOfHarambe
*/
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 SONOFHARAMBE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Son Of Harambe";//
string private constant _symbol = "SOH";//
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 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 3;//
uint256 private _taxFeeOnBuy = 7;//
//Sell Fee
uint256 private _redisFeeOnSell = 3;//
uint256 private _taxFeeOnSell = 15;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xcdB6E4EC74eC55310F836dc7e2cfb8A8A0133662);//
address payable private _marketingAddress = payable(0xcdB6E4EC74eC55310F836dc7e2cfb8A8A0133662);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9; //
uint256 public _maxWalletSize = 50000000 * 10**9; //
uint256 public _swapTokensAtAmount = 15000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906130c6565b610702565b005b34801561021157600080fd5b5061021a610852565b604051610227919061350f565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613032565b61088f565b60405161026491906134d9565b60405180910390f35b34801561027957600080fd5b506102826108ad565b60405161028f91906134f4565b60405180910390f35b3480156102a457600080fd5b506102ad6108d3565b6040516102ba91906136f1565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fe3565b6108e3565b6040516102f791906134d9565b60405180910390f35b34801561030c57600080fd5b506103156109bc565b60405161032291906136f1565b60405180910390f35b34801561033757600080fd5b506103406109c2565b60405161034d9190613766565b60405180910390f35b34801561036257600080fd5b5061036b6109cb565b60405161037891906134be565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612f55565b6109f1565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613107565b610ae1565b005b3480156103df57600080fd5b506103e8610b92565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612f55565b610c63565b60405161041e91906136f1565b60405180910390f35b34801561043357600080fd5b5061043c610cb4565b005b34801561044a57600080fd5b5061046560048036038101906104609190613130565b610e07565b005b34801561047357600080fd5b5061047c610ea6565b60405161048991906136f1565b60405180910390f35b34801561049e57600080fd5b506104a7610eac565b6040516104b491906134be565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613107565b610ed5565b005b3480156104f257600080fd5b506104fb610f8e565b60405161050891906136f1565b60405180910390f35b34801561051d57600080fd5b50610526610f94565b604051610533919061350f565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e9190613130565b610fd1565b005b34801561057157600080fd5b5061058c60048036038101906105879190613159565b611070565b005b34801561059a57600080fd5b506105b560048036038101906105b09190613032565b611127565b6040516105c291906134d9565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612f55565b611145565b6040516105ff91906134d9565b60405180910390f35b34801561061457600080fd5b5061061d611165565b005b34801561062b57600080fd5b506106466004803603810190610641919061306e565b61123e565b005b34801561065457600080fd5b5061065d61139e565b60405161066a91906136f1565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612fa7565b6113a4565b6040516106a791906136f1565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613130565b61142b565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612f55565b6114ca565b005b61070a61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e90613651565b60405180910390fd5b60005b815181101561084e576001601160008484815181106107e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061084690613a2b565b91505061079a565b5050565b60606040518060400160405280600e81526020017f536f6e204f6620486172616d6265000000000000000000000000000000000000815250905090565b60006108a361089c61168c565b8484611694565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108f084848461185f565b6109b1846108fc61168c565b6109ac85604051806060016040528060288152602001613f3860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061096261168c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122339092919063ffffffff16565b611694565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109f961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7d90613651565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ae961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6d90613651565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd361168c565b73ffffffffffffffffffffffffffffffffffffffff161480610c495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3161168c565b73ffffffffffffffffffffffffffffffffffffffff16145b610c5257600080fd5b6000479050610c6081612297565b50565b6000610cad600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612392565b9050919050565b610cbc61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4090613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e0f61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9390613651565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610edd61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190613651565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600381526020017f534f480000000000000000000000000000000000000000000000000000000000815250905090565b610fd961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611066576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105d90613651565b60405180910390fd5b8060198190555050565b61107861168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fc90613651565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061113b61113461168c565b848461185f565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a661168c565b73ffffffffffffffffffffffffffffffffffffffff16148061121c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120461168c565b73ffffffffffffffffffffffffffffffffffffffff16145b61122557600080fd5b600061123030610c63565b905061123b81612400565b50565b61124661168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ca90613651565b60405180910390fd5b60005b8383905081101561139857816005600086868581811061131f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906113349190612f55565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061139090613a2b565b9150506112d6565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61143361168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b790613651565b60405180910390fd5b8060188190555050565b6114d261168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461155f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155690613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c6906135b1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb906136d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176b906135d1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185291906136f1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c690613691565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561193f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193690613531565b60405180910390fd5b60008111611982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197990613671565b60405180910390fd5b61198a610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119f857506119c8610eac565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f3257601660149054906101000a900460ff16611a8757611a19610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7d90613551565b60405180910390fd5b5b601754811115611acc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac390613591565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b705750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba6906135f1565b60405180910390fd5b6008544311158015611c0e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c685750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cfe576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611dab5760185481611d6084610c63565b611d6a9190613827565b10611daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da1906136b1565b60405180910390fd5b5b6000611db630610c63565b9050600060195482101590506017548210611dd15760175491505b808015611deb5750601660159054906101000a900460ff16155b8015611e455750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5b575060168054906101000a900460ff165b8015611eb15750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f075750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f2f57611f1582612400565b60004790506000811115611f2d57611f2c47612297565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fd95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061208c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561208b5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561209a5760009050612221565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121455750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561215d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156122085750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561222057600b54600d81905550600c54600e819055505b5b61222d848484846126fa565b50505050565b600083831115829061227b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612272919061350f565b60405180910390fd5b506000838561228a9190613908565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e760028461272790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612312573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236360028461272790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561238e573d6000803e3d6000fd5b5050565b60006006548211156123d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d090613571565b60405180910390fd5b60006123e3612771565b90506123f8818461272790919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561245e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561248c5781602001602082028036833780820191505090505b50905030816000815181106124ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256c57600080fd5b505afa158015612580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a49190612f7e565b816001815181106125de577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611694565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126a995949392919061370c565b600060405180830381600087803b1580156126c357600080fd5b505af11580156126d7573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127085761270761279c565b5b6127138484846127df565b80612721576127206129aa565b5b50505050565b600061276983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129be565b905092915050565b600080600061277e612a21565b91509150612795818361272790919063ffffffff16565b9250505090565b6000600d541480156127b057506000600e54145b156127ba576127dd565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806127f187612a80565b95509550955095509550955061284f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ae890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128e485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293081612b90565b61293a8483612c4d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161299791906136f1565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612a05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129fc919061350f565b60405180910390fd5b5060008385612a14919061387d565b9050809150509392505050565b600080600060065490506000670de0b6b3a76400009050612a55670de0b6b3a764000060065461272790919063ffffffff16565b821015612a7357600654670de0b6b3a7640000935093505050612a7c565b81819350935050505b9091565b6000806000806000806000806000612a9d8a600d54600e54612c87565b9250925092506000612aad612771565b90506000806000612ac08e878787612d1d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b2a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612233565b905092915050565b6000808284612b419190613827565b905083811015612b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7d90613611565b60405180910390fd5b8091505092915050565b6000612b9a612771565b90506000612bb18284612da690919063ffffffff16565b9050612c0581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6282600654612ae890919063ffffffff16565b600681905550612c7d81600754612b3290919063ffffffff16565b6007819055505050565b600080600080612cb36064612ca5888a612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612cdd6064612ccf888b612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612d0682612cf8858c612ae890919063ffffffff16565b612ae890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d368589612da690919063ffffffff16565b90506000612d4d8689612da690919063ffffffff16565b90506000612d648789612da690919063ffffffff16565b90506000612d8d82612d7f8587612ae890919063ffffffff16565b612ae890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612db95760009050612e1b565b60008284612dc791906138ae565b9050828482612dd6919061387d565b14612e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0d90613631565b60405180910390fd5b809150505b92915050565b6000612e34612e2f846137a6565b613781565b90508083825260208201905082856020860282011115612e5357600080fd5b60005b85811015612e835781612e698882612e8d565b845260208401935060208301925050600181019050612e56565b5050509392505050565b600081359050612e9c81613ef2565b92915050565b600081519050612eb181613ef2565b92915050565b60008083601f840112612ec957600080fd5b8235905067ffffffffffffffff811115612ee257600080fd5b602083019150836020820283011115612efa57600080fd5b9250929050565b600082601f830112612f1257600080fd5b8135612f22848260208601612e21565b91505092915050565b600081359050612f3a81613f09565b92915050565b600081359050612f4f81613f20565b92915050565b600060208284031215612f6757600080fd5b6000612f7584828501612e8d565b91505092915050565b600060208284031215612f9057600080fd5b6000612f9e84828501612ea2565b91505092915050565b60008060408385031215612fba57600080fd5b6000612fc885828601612e8d565b9250506020612fd985828601612e8d565b9150509250929050565b600080600060608486031215612ff857600080fd5b600061300686828701612e8d565b935050602061301786828701612e8d565b925050604061302886828701612f40565b9150509250925092565b6000806040838503121561304557600080fd5b600061305385828601612e8d565b925050602061306485828601612f40565b9150509250929050565b60008060006040848603121561308357600080fd5b600084013567ffffffffffffffff81111561309d57600080fd5b6130a986828701612eb7565b935093505060206130bc86828701612f2b565b9150509250925092565b6000602082840312156130d857600080fd5b600082013567ffffffffffffffff8111156130f257600080fd5b6130fe84828501612f01565b91505092915050565b60006020828403121561311957600080fd5b600061312784828501612f2b565b91505092915050565b60006020828403121561314257600080fd5b600061315084828501612f40565b91505092915050565b6000806000806080858703121561316f57600080fd5b600061317d87828801612f40565b945050602061318e87828801612f40565b935050604061319f87828801612f40565b92505060606131b087828801612f40565b91505092959194509250565b60006131c883836131d4565b60208301905092915050565b6131dd8161393c565b82525050565b6131ec8161393c565b82525050565b60006131fd826137e2565b6132078185613805565b9350613212836137d2565b8060005b8381101561324357815161322a88826131bc565b9750613235836137f8565b925050600181019050613216565b5085935050505092915050565b6132598161394e565b82525050565b61326881613991565b82525050565b613277816139b5565b82525050565b6000613288826137ed565b6132928185613816565b93506132a28185602086016139c7565b6132ab81613b01565b840191505092915050565b60006132c3602383613816565b91506132ce82613b12565b604082019050919050565b60006132e6603f83613816565b91506132f182613b61565b604082019050919050565b6000613309602a83613816565b915061331482613bb0565b604082019050919050565b600061332c601c83613816565b915061333782613bff565b602082019050919050565b600061334f602683613816565b915061335a82613c28565b604082019050919050565b6000613372602283613816565b915061337d82613c77565b604082019050919050565b6000613395602383613816565b91506133a082613cc6565b604082019050919050565b60006133b8601b83613816565b91506133c382613d15565b602082019050919050565b60006133db602183613816565b91506133e682613d3e565b604082019050919050565b60006133fe602083613816565b915061340982613d8d565b602082019050919050565b6000613421602983613816565b915061342c82613db6565b604082019050919050565b6000613444602583613816565b915061344f82613e05565b604082019050919050565b6000613467602383613816565b915061347282613e54565b604082019050919050565b600061348a602483613816565b915061349582613ea3565b604082019050919050565b6134a98161397a565b82525050565b6134b881613984565b82525050565b60006020820190506134d360008301846131e3565b92915050565b60006020820190506134ee6000830184613250565b92915050565b6000602082019050613509600083018461325f565b92915050565b60006020820190508181036000830152613529818461327d565b905092915050565b6000602082019050818103600083015261354a816132b6565b9050919050565b6000602082019050818103600083015261356a816132d9565b9050919050565b6000602082019050818103600083015261358a816132fc565b9050919050565b600060208201905081810360008301526135aa8161331f565b9050919050565b600060208201905081810360008301526135ca81613342565b9050919050565b600060208201905081810360008301526135ea81613365565b9050919050565b6000602082019050818103600083015261360a81613388565b9050919050565b6000602082019050818103600083015261362a816133ab565b9050919050565b6000602082019050818103600083015261364a816133ce565b9050919050565b6000602082019050818103600083015261366a816133f1565b9050919050565b6000602082019050818103600083015261368a81613414565b9050919050565b600060208201905081810360008301526136aa81613437565b9050919050565b600060208201905081810360008301526136ca8161345a565b9050919050565b600060208201905081810360008301526136ea8161347d565b9050919050565b600060208201905061370660008301846134a0565b92915050565b600060a08201905061372160008301886134a0565b61372e602083018761326e565b818103604083015261374081866131f2565b905061374f60608301856131e3565b61375c60808301846134a0565b9695505050505050565b600060208201905061377b60008301846134af565b92915050565b600061378b61379c565b905061379782826139fa565b919050565b6000604051905090565b600067ffffffffffffffff8211156137c1576137c0613ad2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138328261397a565b915061383d8361397a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561387257613871613a74565b5b828201905092915050565b60006138888261397a565b91506138938361397a565b9250826138a3576138a2613aa3565b5b828204905092915050565b60006138b98261397a565b91506138c48361397a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138fd576138fc613a74565b5b828202905092915050565b60006139138261397a565b915061391e8361397a565b92508282101561393157613930613a74565b5b828203905092915050565b60006139478261395a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061399c826139a3565b9050919050565b60006139ae8261395a565b9050919050565b60006139c08261397a565b9050919050565b60005b838110156139e55780820151818401526020810190506139ca565b838111156139f4576000848401525b50505050565b613a0382613b01565b810181811067ffffffffffffffff82111715613a2257613a21613ad2565b5b80604052505050565b6000613a368261397a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a6957613a68613a74565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613efb8161393c565b8114613f0657600080fd5b50565b613f128161394e565b8114613f1d57600080fd5b50565b613f298161397a565b8114613f3457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208b71119efbc2624dc893801b3c5b11356bb45bf82d8dc13a62eff1111bc4409f64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,577 |
0x25de3443e858b63686986ac72d1b86dbe41d5216 | 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title 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 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract CTFOCrowdsale is StandardToken {
using SafeMath for uint256;
string public constant name = "Orinoco D. F. Co-founder Token";
string public constant symbol = "CTFO";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000 * (10 ** uint256(decimals));
uint256 public constant TEAM_TOKENS = 140000 * (10 ** uint256(decimals));
uint256 public constant SALE_TOKENS = 860000 * (10 ** uint256(decimals));
uint256 public constant exchangeRate = 500;
bool public isFinalized = false;
address public constant etherAddress = 0xFC20A4238ABAfBFa29F582CbcF93e23cD3c9858b;
address public constant teamWallet = 0x4c646420d8A8ae7C66de9c40FfE31c295c87272B;
address public constant saleWallet = 0x9D4537094Fa30d8042A51F4F0CD29F170B28456B;
uint256 public constant crowdsaleStart = 1534204800;
uint256 public constant crowdsaleEnd = 1536019200;
event Mint(address indexed to, uint256 amount);
constructor () public {
totalSupply_ = INITIAL_SUPPLY;
balances[teamWallet] = TEAM_TOKENS;
emit Mint(teamWallet, TEAM_TOKENS);
emit Transfer(address(0), teamWallet, TEAM_TOKENS);
balances[saleWallet] = SALE_TOKENS;
emit Mint(saleWallet, SALE_TOKENS);
emit Transfer(address(0), saleWallet, SALE_TOKENS);
}
function purchaseTokens() public payable {
require( now >= crowdsaleStart );
require( now <= crowdsaleEnd );
require( msg.value >= 1000 finney );
uint256 tokens = 0;
tokens = msg.value.mul(exchangeRate);
uint256 unsoldTokens = balances[saleWallet];
require( unsoldTokens >= tokens );
balances[saleWallet] -= tokens;
balances[msg.sender] += tokens;
emit Transfer(saleWallet, msg.sender, tokens);
etherAddress.transfer(msg.value.mul(90).div(100));
teamWallet.transfer(msg.value.mul(10).div(100));
}
function() public payable {
purchaseTokens();
}
event Burn(address indexed burner, uint256 value);
function burn(uint256 _value) public {
require( !isFinalized );
require( msg.sender == saleWallet );
require( now > crowdsaleEnd || balances[msg.sender] == 0);
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
if (balances[_who] == 0) {
isFinalized = true;
}
}
} | 0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461013c5780630786f72b146101c6578063095ea7b3146101f757806318160ddd1461022f57806323b872dd146102565780632ff2e9dc14610280578063313ce567146102955780633290ce29146101325780633ba0b9a9146102c057806342966c68146102d55780634d9aa424146102ed57806359927044146103025780636618846314610317578063692d9ee51461033b57806370a08231146103505780637c4db77d1461037157806381ff4d0b146103865780638d4e40831461039b57806395d89b41146103b0578063a9059cbb146103c5578063cc3bb31a146103e9578063d73dd623146103fe578063dd62ed3e14610422575b61013a610449565b005b34801561014857600080fd5b5061015161061d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018b578181015183820152602001610173565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d257600080fd5b506101db610654565b60408051600160a060020a039092168252519081900360200190f35b34801561020357600080fd5b5061021b600160a060020a036004351660243561066c565b604080519115158252519081900360200190f35b34801561023b57600080fd5b506102446106d3565b60408051918252519081900360200190f35b34801561026257600080fd5b5061021b600160a060020a03600435811690602435166044356106d9565b34801561028c57600080fd5b5061024461083c565b3480156102a157600080fd5b506102aa61084a565b6040805160ff9092168252519081900360200190f35b3480156102cc57600080fd5b5061024461084f565b3480156102e157600080fd5b5061013a600435610855565b3480156102f957600080fd5b506102446108bc565b34801561030e57600080fd5b506101db6108c4565b34801561032357600080fd5b5061021b600160a060020a03600435166024356108dc565b34801561034757600080fd5b506102446109cb565b34801561035c57600080fd5b50610244600160a060020a03600435166109d9565b34801561037d57600080fd5b506101db6109f4565b34801561039257600080fd5b50610244610a0c565b3480156103a757600080fd5b5061021b610a1a565b3480156103bc57600080fd5b50610151610a23565b3480156103d157600080fd5b5061021b600160a060020a0360043516602435610a5a565b3480156103f557600080fd5b50610244610b27565b34801561040a57600080fd5b5061021b600160a060020a0360043516602435610b2f565b34801561042e57600080fd5b50610244600160a060020a0360043581169060243516610bc8565b600080635b721b8042101561045d57600080fd5b635b8dcb0042111561046e57600080fd5b670de0b6b3a764000034101561048357600080fd5b60009150610499346101f463ffffffff610bf316565b739d4537094fa30d8042a51f4f0cd29f170b28456b60009081526020527fa545ba50a6001939d296309b22b2211fdbde3967ff8c2d55be963cf7a45b5809549092509050818110156104ea57600080fd5b600060208181527fa545ba50a6001939d296309b22b2211fdbde3967ff8c2d55be963cf7a45b58098054859003905533808352604092839020805486019055825185815292519092739d4537094fa30d8042a51f4f0cd29f170b28456b92600080516020610d6d83398151915292918290030190a373fc20a4238abafbfa29f582cbcf93e23cd3c9858b6108fc610599606461058d34605a63ffffffff610bf316565b9063ffffffff610c1c16565b6040518115909202916000818181858888f193505050501580156105c1573d6000803e3d6000fd5b50734c646420d8a8ae7c66de9c40ffe31c295c87272b6108fc6105f0606461058d34600a63ffffffff610bf316565b6040518115909202916000818181858888f19350505050158015610618573d6000803e3d6000fd5b505050565b60408051808201909152601e81527f4f72696e6f636f20442e20462e20436f2d666f756e64657220546f6b656e0000602082015281565b73fc20a4238abafbfa29f582cbcf93e23cd3c9858b81565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60025490565b600160a060020a0383166000908152602081905260408120548211156106fe57600080fd5b600160a060020a038416600090815260016020908152604080832033845290915290205482111561072e57600080fd5b600160a060020a038316151561074357600080fd5b600160a060020a03841660009081526020819052604090205461076c908363ffffffff610c3116565b600160a060020a0380861660009081526020819052604080822093909355908516815220546107a1908363ffffffff610c4316565b600160a060020a038085166000908152602081815260408083209490945591871681526001825282812033825290915220546107e3908363ffffffff610c3116565b600160a060020a0380861660008181526001602090815260408083203384528252918290209490945580518681529051928716939192600080516020610d6d833981519152929181900390910190a35060019392505050565b69d3c21bcecceda100000081565b601281565b6101f481565b60035460ff161561086557600080fd5b33739d4537094fa30d8042a51f4f0cd29f170b28456b1461088557600080fd5b635b8dcb004211806108a4575033600090815260208190526040902054155b15156108af57600080fd5b6108b93382610c50565b50565b635b8dcb0081565b734c646420d8a8ae7c66de9c40ffe31c295c87272b81565b336000908152600160209081526040808320600160a060020a038616845290915281205480831061093057336000908152600160209081526040808320600160a060020a0388168452909152812055610965565b610940818463ffffffff610c3116565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b69b61cb183c4b7e180000081565b600160a060020a031660009081526020819052604090205490565b739d4537094fa30d8042a51f4f0cd29f170b28456b81565b691da56a4b0835bf80000081565b60035460ff1681565b60408051808201909152600481527f4354464f00000000000000000000000000000000000000000000000000000000602082015281565b33600090815260208190526040812054821115610a7657600080fd5b600160a060020a0383161515610a8b57600080fd5b33600090815260208190526040902054610aab908363ffffffff610c3116565b3360009081526020819052604080822092909255600160a060020a03851681522054610add908363ffffffff610c4316565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020610d6d8339815191529281900390910190a350600192915050565b635b721b8081565b336000908152600160209081526040808320600160a060020a0386168452909152812054610b63908363ffffffff610c4316565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b6000821515610c04575060006106cd565b50818102818382811515610c1457fe5b04146106cd57fe5b60008183811515610c2957fe5b049392505050565b600082821115610c3d57fe5b50900390565b818101828110156106cd57fe5b600160a060020a038216600090815260208190526040902054811115610c7557600080fd5b600160a060020a038216600090815260208190526040902054610c9e908263ffffffff610c3116565b600160a060020a038316600090815260208190526040902055600254610cca908263ffffffff610c3116565b600255604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a03851691600080516020610d6d8339815191529181900360200190a3600160a060020a0382166000908152602081905260409020541515610d68576003805460ff191660011790555b50505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582063a6cef39722f4bb2b84dc3374fec43332104c6c7ac8cf1fd96b0b33091c195a0029 | {"success": true, "error": null, "results": {}} | 1,578 |
0xad1232f41674997fffc648208ee612f26cea1bb4 | /**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
/*
SPDX-License-Identifier: UNLICENSED
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PLUMBER is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Plumber Shiba" ;
string private constant _symbol = unicode"PLUMBER🔧";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 4;
uint256 private _teamFee = 6;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(4)).div(10);
_teamFee = (_impactFee.mul(6)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 4;
_teamFee = 6;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (30 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 10000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (240 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600d81526020017f506c756d62657220536869626100000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f504c554d424552f09f94a7000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff02191690831515021790555060f042610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b505050678ac7230489e8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60046009819055506006600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b601e4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960048461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660068461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122021bab034f544027aed180ee47e116f2ed0412f185f5a3245c59d6bc5830dfd5164736f6c63430008040033 | {"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"}]}} | 1,579 |
0xf7975214245338d02Fcb8d60564204e0D927CB75 | /**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.7;
// Allows anyone to claim a token if they exist in a merkle root
abstract contract IMerkleDistributor {
// Time from the moment this contract is deployed and until the owner can withdraw leftover tokens
uint256 public constant timelapseUntilWithdrawWindow = 90 days;
// Returns the address of the token distributed by this contract
function token() virtual external view returns (address);
// Returns the merkle root of the merkle tree containing account balances available to claim
function merkleRoot() virtual external view returns (bytes32);
// Returns the timestamp when this contract was deployed
function deploymentTime() virtual external view returns (uint256);
// Returns the address for the owner of this contract
function owner() virtual external view returns (address);
// Returns true if the index has been marked claimed
function isClaimed(uint256 index) virtual external view returns (bool);
// Send tokens to an address without that address claiming them
function sendTokens(address dst, uint256 tokenAmount) virtual external;
// Claim the given amount of the token to the given address. Reverts if the inputs are invalid
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) virtual external;
// This event is triggered whenever an address is added to the set of authed addresses
event AddAuthorization(address account);
// This event is triggered whenever an address is removed from the set of authed addresses
event RemoveAuthorization(address account);
// This event is triggered whenever a call to #claim succeeds
event Claimed(uint256 index, address account, uint256 amount);
// This event is triggered whenever some tokens are sent to an address without that address claiming them
event SendTokens(address dst, uint256 tokenAmount);
}
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
/**
* @dev 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 MerkleDistributor is IMerkleDistributor {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "MerkleDistributorFactory/account-not-authorized");
_;
}
/*
* @notify Checks whether an address can send tokens out of this contract
*/
modifier canSendTokens {
require(
either(authorizedAccounts[msg.sender] == 1, both(owner == msg.sender, now >= addition(deploymentTime, timelapseUntilWithdrawWindow))),
"MerkleDistributorFactory/cannot-send-tokens"
);
_;
}
// The token being distributed
address public immutable override token;
// The owner of this contract
address public immutable override owner;
// The merkle root of all addresses that get a distribution
bytes32 public immutable override merkleRoot;
// Timestamp when this contract was deployed
uint256 public immutable override deploymentTime;
// This is a packed array of booleans
mapping(uint256 => uint256) private claimedBitMap;
constructor(address token_, bytes32 merkleRoot_) public {
authorizedAccounts[msg.sender] = 1;
owner = msg.sender;
token = token_;
merkleRoot = merkleRoot_;
deploymentTime = now;
emit AddAuthorization(msg.sender);
}
// --- Math ---
function addition(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MerkleDistributorFactory/add-uint-uint-overflow");
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Administration ---
/*
* @notice Send tokens to an authorized address
* @param dst The address to send tokens to
* @param tokenAmount The amount of tokens to send
*/
function sendTokens(address dst, uint256 tokenAmount) external override canSendTokens {
require(dst != address(0), "MerkleDistributorFactory/null-dst");
IERC20(token).transfer(dst, tokenAmount);
emit SendTokens(dst, tokenAmount);
}
/*
* @notice View function returning whether an address has already claimed their tokens
* @param index The position of the address inside the merkle tree
*/
function isClaimed(uint256 index) public view override returns (bool) {
uint256 claimedWordIndex = index / 256;
uint256 claimedBitIndex = index % 256;
uint256 claimedWord = claimedBitMap[claimedWordIndex];
uint256 mask = (1 << claimedBitIndex);
return claimedWord & mask == mask;
}
/*
* @notice Mark an address as having claimed their distribution
* @param index The position of the address inside the merkle tree
*/
function _setClaimed(uint256 index) private {
uint256 claimedWordIndex = index / 256;
uint256 claimedBitIndex = index % 256;
claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);
}
/*
* @notice Claim your distribution
* @param index The position of the address inside the merkle tree
* @param account The actual address from the tree
* @param amount The amount being distributed
* @param merkleProof The merkle path used to prove that the address is in the tree and can claim amount tokens
*/
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override {
require(!isClaimed(index), 'MerkleDistributor/drop-already-claimed');
// Verify the merkle proof
bytes32 node = keccak256(abi.encodePacked(index, account, amount));
require(MerkleProof.verify(merkleProof, merkleRoot, node), 'MerkleDistributor/invalid-proof');
// Mark it claimed and send the token
_setClaimed(index);
require(IERC20(token).transfer(account, amount), 'MerkleDistributor/transfer-failed');
emit Claimed(index, account, amount);
}
}
contract MerkleDistributorFactory {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "MerkleDistributorFactory/account-not-authorized");
_;
}
// --- Variables ---
// Number of distributors created
uint256 public nonce;
// The token that's being distributed by every merkle distributor
address public distributedToken;
// Mapping of ID => distributor address
mapping(uint256 => address) public distributors;
// Tokens left to distribute to every distributor
mapping(uint256 => uint256) public tokensToDistribute;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event DeployDistributor(uint256 id, address distributor, uint256 tokenAmount);
event SendTokensToDistributor(uint256 id);
constructor(address distributedToken_) public {
require(distributedToken_ != address(0), "MerkleDistributorFactory/null-distributed-token");
authorizedAccounts[msg.sender] = 1;
distributedToken = distributedToken_;
emit AddAuthorization(msg.sender);
}
// --- Math ---
function addition(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MerkleDistributorFactory/add-uint-uint-overflow");
}
// --- Core Logic ---
/*
* @notice Deploy a new merkle distributor
* @param merkleRoot The merkle root used in the distributor
*/
function deployDistributor(bytes32 merkleRoot, uint256 tokenAmount) external isAuthorized {
require(tokenAmount > 0, "MerkleDistributorFactory/null-token-amount");
nonce = addition(nonce, 1);
address newDistributor = address(new MerkleDistributor(distributedToken, merkleRoot));
distributors[nonce] = newDistributor;
tokensToDistribute[nonce] = tokenAmount;
emit DeployDistributor(nonce, newDistributor, tokenAmount);
}
/*
* @notice Send tokens to a distributor
* @param nonce The nonce/id of the distributor to send tokens to
*/
function sendTokensToDistributor(uint256 id) external isAuthorized {
require(tokensToDistribute[id] > 0, "MerkleDistributorFactory/nothing-to-send");
uint256 tokensToSend = tokensToDistribute[id];
tokensToDistribute[id] = 0;
IERC20(distributedToken).transfer(distributors[id], tokensToSend);
emit SendTokensToDistributor(id);
}
/*
* @notice Sent distributedToken tokens out of this contract and to a custom destination
* @param dst The address that will receive tokens
* @param tokenAmount The token amount to send
*/
function sendTokensToCustom(address dst, uint256 tokenAmount) external isAuthorized {
require(dst != address(0), "MerkleDistributorFactory/null-dst");
IERC20(distributedToken).transfer(dst, tokenAmount);
}
/*
* @notice This contract gives up on being an authorized address inside a specific distributor contract
*/
function dropDistributorAuth(uint256 id) external isAuthorized {
MerkleDistributor(distributors[id]).removeAuthorization(address(this));
}
/*
* @notice Send tokens from a distributor contract to this contract
*/
function getBackTokensFromDistributor(uint256 id, uint256 tokenAmount) external isAuthorized {
MerkleDistributor(distributors[id]).sendTokens(address(this), tokenAmount);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461026357806393a10984146102ad57806394f3f81d146102cb5780639e34070f1461030f578063ecda10f514610355578063fc0c546a14610373576100a9565b806305ab421d146100ae57806324ba5884146100fc5780632e7ba6ef146101545780632eb4a7ab1461020157806335b281531461021f575b600080fd5b6100fa600480360360408110156100c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103bd565b005b61013e6004803603602081101561011257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106bb565b6040518082815260200191505060405180910390f35b6101ff6004803603608081101561016a57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156101bb57600080fd5b8201836020820111156101cd57600080fd5b803590602001918460208302840111640100000000831117156101ef57600080fd5b90919293919293905050506106d3565b005b610209610a35565b6040518082815260200191505060405180910390f35b6102616004803603602081101561023557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a59565b005b61026b610b9a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b5610bbe565b6040518082815260200191505060405180910390f35b61030d600480360360208110156102e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bc5565b005b61033b6004803603602081101561032557600080fd5b8101908080359060200190929190505050610d06565b604051808215151515815260200191505060405180910390f35b61035d610d58565b6040518082815260200191505060405180910390f35b61037b610d7c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61048e60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146104893373ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000b5ed650ef207e051453b68a2138d7cb67cc85e4173ffffffffffffffffffffffffffffffffffffffff16146104817f0000000000000000000000000000000000000000000000000000000061e9312c6276a700610da0565b421015610e06565b610e13565b6104e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180610fae602b913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610569576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610fd96021913960400191505060405180910390fd5b7f0000000000000000000000006243d8cea23066d098a15582d81a598b4e8391f473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561061057600080fd5b505af1158015610624573d6000803e3d6000fd5b505050506040513d602081101561063a57600080fd5b8101908080519060200190929190505050507f09bd3894cb7ab22415416dac0fecc519855a4b0842f1c9115e562ef557ab577b8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60006020528060005260406000206000915090505481565b6106dc85610d06565b15610732576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610ffa6026913960400191505060405180910390fd5b6000858585604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018281526020019350505050604051602081830303815290604052805190602001209050610808838380806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050507ffcda99858584363dcbf114dad6b1e1809ba3d4962302df3c04688d06f6b25e3883610e20565b61087a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4d65726b6c654469737472696275746f722f696e76616c69642d70726f6f660081525060200191505060405180910390fd5b61088386610ed8565b7f0000000000000000000000006243d8cea23066d098a15582d81a598b4e8391f473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092a57600080fd5b505af115801561093e573d6000803e3d6000fd5b505050506040513d602081101561095457600080fd5b81019080805190602001909291905050506109ba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610f2f6021913960400191505060405180910390fd5b7f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed026868686604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050505050565b7ffcda99858584363dcbf114dad6b1e1809ba3d4962302df3c04688d06f6b25e3881565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610af0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610f7f602f913960400191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7f000000000000000000000000b5ed650ef207e051453b68a2138d7cb67cc85e4181565b6276a70081565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610c5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610f7f602f913960400191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b90381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000806101008381610d1457fe5b04905060006101008481610d2457fe5b0690506000600160008481526020019081526020016000205490506000826001901b90508081831614945050505050919050565b7f0000000000000000000000000000000000000000000000000000000061e9312c81565b7f0000000000000000000000006243d8cea23066d098a15582d81a598b4e8391f481565b6000828284019150811015610e00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610f50602f913960400191505060405180910390fd5b92915050565b6000818316905092915050565b6000818317905092915050565b60008082905060008090505b8551811015610eca576000868281518110610e4357fe5b60200260200101519050808311610e8a5782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610ebc565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b508080600101915050610e2c565b508381149150509392505050565b60006101008281610ee557fe5b04905060006101008381610ef557fe5b069050806001901b600160008481526020019081526020016000205417600160008481526020019081526020016000208190555050505056fe4d65726b6c654469737472696275746f722f7472616e736665722d6661696c65644d65726b6c654469737472696275746f72466163746f72792f6164642d75696e742d75696e742d6f766572666c6f774d65726b6c654469737472696275746f72466163746f72792f6163636f756e742d6e6f742d617574686f72697a65644d65726b6c654469737472696275746f72466163746f72792f63616e6e6f742d73656e642d746f6b656e734d65726b6c654469737472696275746f72466163746f72792f6e756c6c2d6473744d65726b6c654469737472696275746f722f64726f702d616c72656164792d636c61696d6564a2646970667358221220528f15fdf759afd9c80c6e566c7284f43679cac830e946499c4a21591ba9ff2764736f6c63430006070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,580 |
0x76852855f4545aeaa297485b2c76bacbe9d9fdd0 | /**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
// https://t.me/atomicdoge
// 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 AtomicDoge 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 = "Atomic Doge";
string private constant _symbol = 'ATOMGE️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f41746f6d696320446f6765000000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f41544f4d4745efb88f0000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201b9f2a362bb82fc13bbd37c5fd18f704dc42a2246a2e1f12c47b8a65156e6b9664736f6c634300060c0033 | {"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"}]}} | 1,581 |
0x0c9208e47811f3beb3b31c00a46b878f01ae9eeb | /**
*Submitted for verification at Etherscan.io on 2020-12-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-10
*/
/**************************************************************************
* _______ _____ _____ _____ _ _ _ _______
* |__ __| | __ | | _ | | ___| | | / / | | |__ __|
* | | | __ _| | |_| | | | | |/ / __ | | | |
* | | | |\ \ | _ | | |__ | |\ \ |__| | | | |
* |_| |_| \_\ |_| |_| |____| | | \_\ |_| |_|
*
*
*
**************************************************************************/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract TRACK {
/// @notice EIP-20 token name for this token
string public constant name = "TRACK-IT Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "TRACK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 50000000e18;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp 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, "Comp::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, "Comp::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, "Comp::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Comp::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Comp::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Comp::delegateBySig: invalid nonce");
require(now <= expiry, "Comp::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, "Comp::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Comp::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Comp::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Comp::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Comp::_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, "Comp::_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, "Comp::_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, "Comp::_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;
}
} | 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611749565b60405180910390f35b610157610152366004611212565b6102eb565b60405161013b919061169f565b61016c6103a8565b60405161013b91906116ad565b61016c6103b7565b61015761018f3660046111c5565b6103ce565b61019c610513565b60405161013b91906117e3565b6101bc6101b7366004611165565b610518565b60405161013b9190611691565b6101dc6101d7366004611165565b610533565b005b6101f16101ec366004611165565b610540565b60405161013b91906117ba565b61016c61020c366004611165565b610558565b61022461021f366004611212565b61057c565b60405161013b91906117ff565b61016c61023f366004611165565b610793565b61012e6107a5565b61015761025a366004611212565b6107c6565b61022461026d366004611165565b610802565b6101dc610280366004611242565b610872565b61016c61029336600461118b565b610a62565b61016c610a94565b6102b36102ae3660046112c9565b610aa0565b60405161013b9291906117c8565b6040518060400160405280600e81526020016d2a2920a1a596a4aa102a37b5b2b760911b81525081565b6000806000198314156103015750600019610326565b6103238360405180606001604052806025815260200161191b60259139610ad5565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103949085906117f1565b60405180910390a360019150505b92915050565b6a295be96e6406697200000081565b6040516103c39061167b565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b03909116928592610424928892919061191b90830139610ad5565b9050866001600160a01b0316836001600160a01b03161415801561045157506001600160601b0382811614155b156104f957600061047b83836040518060600160405280603d81526020016119f2603d9139610b04565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104ef9085906117f1565b60405180910390a3505b610504878783610b43565b600193505050505b9392505050565b601281565b6002602052600090815260409020546001600160a01b031681565b61053d3382610cee565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105a65760405162461bcd60e51b815260040161059d9061177a565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105d45760009150506103a2565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610650576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506103a2565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561068b5760009150506103a2565b600060001982015b8163ffffffff168163ffffffff16111561074e57600282820363ffffffff160481036106bd611122565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610729576020015194506103a29350505050565b805163ffffffff1687111561074057819350610747565b6001820392505b5050610693565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b60405180604001604052806005815260200164545241434b60d81b81525081565b6000806107eb8360405180606001604052806026815260200161194060269139610ad5565b90506107f8338583610b43565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff168061082d57600061050c565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516108809061167b565b60408051918290038220828201909152600e82526d2a2920a1a596a4aa102a37b5b2b760911b6020909201919091527fc00d96d21d5f6136ef6c0bb8ae643a1b7f2ee82d96d2e47cc447e02ace6e852d6108d8610d78565b306040516020016108ec94939291906116f9565b604051602081830303815290604052805190602001209050600060405161091290611686565b60405190819003812061092d918a908a908a906020016116bb565b6040516020818303038152906040528051906020012090506000828260405160200161095a92919061164a565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610997949392919061172e565b6020604051602081039080840390855afa1580156109b9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166109ec5760405162461bcd60e51b815260040161059d9061175a565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a2b5760405162461bcd60e51b815260040161059d9061178a565b87421115610a4b5760405162461bcd60e51b815260040161059d9061176a565b610a55818b610cee565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103c390611686565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610afc5760405162461bcd60e51b815260040161059d9190611749565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b3b5760405162461bcd60e51b815260040161059d9190611749565b505050900390565b6001600160a01b038316610b695760405162461bcd60e51b815260040161059d906117aa565b6001600160a01b038216610b8f5760405162461bcd60e51b815260040161059d9061179a565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610bda936001600160601b0390921692859291906118e590830139610b04565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c4294919091169285929091906119c290830139610d7c565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610caf9085906117f1565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610ce992918216911683610db8565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610d72828483610db8565b50505050565b4690565b6000838301826001600160601b038087169083161015610daf5760405162461bcd60e51b815260040161059d9190611749565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610de357506000816001600160601b0316115b15610ce9576001600160a01b03831615610e9b576001600160a01b03831660009081526004602052604081205463ffffffff169081610e23576000610e62565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610e89828560405180606001604052806028815260200161199a60289139610b04565b9050610e9786848484610f46565b5050505b6001600160a01b03821615610ce9576001600160a01b03821660009081526004602052604081205463ffffffff169081610ed6576000610f15565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f3c8285604051806060016040528060278152602001611a2f60279139610d7c565b9050610a5a858484845b6000610f6a43604051806060016040528060348152602001611966603491396110fb565b905060008463ffffffff16118015610fb357506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611012576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110b1565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516110ec92919061180d565b60405180910390a25050505050565b600081600160201b8410610afc5760405162461bcd60e51b815260040161059d9190611749565b604080518082019091526000808252602082015290565b80356103a2816118b5565b80356103a2816118c9565b80356103a2816118d2565b80356103a2816118db565b60006020828403121561117757600080fd5b60006111838484611139565b949350505050565b6000806040838503121561119e57600080fd5b60006111aa8585611139565b92505060206111bb85828601611139565b9150509250929050565b6000806000606084860312156111da57600080fd5b60006111e68686611139565b93505060206111f786828701611139565b925050604061120886828701611144565b9150509250925092565b6000806040838503121561122557600080fd5b60006112318585611139565b92505060206111bb85828601611144565b60008060008060008060c0878903121561125b57600080fd5b60006112678989611139565b965050602061127889828a01611144565b955050604061128989828a01611144565b945050606061129a89828a0161115a565b93505060806112ab89828a01611144565b92505060a06112bc89828a01611144565b9150509295509295509295565b600080604083850312156112dc57600080fd5b60006112e88585611139565b92505060206111bb8582860161114f565b6113028161183a565b82525050565b61130281611845565b6113028161184a565b6113026113268261184a565b61184a565b600061133682611828565b611340818561182c565b935061135081856020860161187f565b611359816118ab565b9093019392505050565b600061137060268361182c565b7f436f6d703a3a64656c656761746542795369673a20696e76616c6964207369678152656e617475726560d01b602082015260400192915050565b60006113b860268361182c565b7f436f6d703a3a64656c656761746542795369673a207369676e617475726520658152651e1c1a5c995960d21b602082015260400192915050565b6000611400600283611835565b61190160f01b815260020192915050565b600061141e60278361182c565b7f436f6d703a3a6765745072696f72566f7465733a206e6f742079657420646574815266195c9b5a5b995960ca1b602082015260400192915050565b600061146760228361182c565b7f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e815261636560f01b602082015260400192915050565b60006114ab603a8361182c565b7f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015260400192915050565b600061150a604383611835565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000611575603c8361182c565b7f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015260400192915050565b60006115d4603a83611835565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b61130281611859565b61130281611862565b61130281611874565b61130281611868565b6000611655826113f3565b9150611661828561131a565b602082019150611671828461131a565b5060200192915050565b60006103a2826114fd565b60006103a2826115c7565b602081016103a282846112f9565b602081016103a28284611308565b602081016103a28284611311565b608081016116c98287611311565b6116d660208301866112f9565b6116e36040830185611311565b6116f06060830184611311565b95945050505050565b608081016117078287611311565b6117146020830186611311565b6117216040830185611311565b6116f060608301846112f9565b6080810161173c8287611311565b6116d6602083018661162f565b6020808252810161050c818461132b565b602080825281016103a281611363565b602080825281016103a2816113ab565b602080825281016103a281611411565b602080825281016103a28161145a565b602080825281016103a28161149e565b602080825281016103a281611568565b602081016103a28284611626565b604081016117d68285611626565b61050c6020830184611641565b602081016103a2828461162f565b602081016103a28284611638565b602081016103a28284611641565b6040810161181b8285611638565b61050c6020830184611638565b5190565b90815260200190565b919050565b60006103a28261184d565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006103a282611868565b60005b8381101561189a578181015183820152602001611882565b83811115610d725750506000910152565b601f01601f191690565b6118be8161183a565b811461053d57600080fd5b6118be8161184a565b6118be81611859565b6118be8161186256fe436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365436f6d703a3a617070726f76653a20616d6f756e7420657863656564732039362062697473436f6d703a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773436f6d703a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a365627a7a72315820eb587275e75c8d02e4df4969bad358173c7f827155f9468143f8aade2eaf4cd96c6578706572696d656e74616cf564736f6c63430005110040 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 1,582 |
0xf7e6183a871ce4ea788100cfd45651077e88e50b | pragma solidity ^0.4.24;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
uint c = a / b;
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
// @title The Contract is Mongolian National MDEX Token Issue.
//
// @Author: Tim Wars
// @Date: 2018.8.1
// @Seealso: ERC20
//
contract MntToken {
// === Event ===
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
event Burn(address indexed from, uint value);
event TransferLocked(address indexed from, address indexed to, uint value, uint8 locktype);
event Purchased(address indexed recipient, uint purchase, uint amount);
// === Defined ===
using SafeMath for uint;
// --- Owner Section ---
address public owner;
bool public frozen = false; //
// --- ERC20 Token Section ---
uint8 constant public decimals = 6;
uint public totalSupply = 100*10**(8+uint256(decimals)); // ***** 100 * 100 Million
string constant public name = "MDEX Platform Token | Mongolia National Blockchain Digital Assets Exchange Token";
string constant public symbol = "MNT";
mapping(address => uint) ownerance; // Owner Balance
mapping(address => mapping(address => uint)) public allowance; // Allower Balance
// --- Locked Section ---
uint8 LOCKED_TYPE_MAX = 2; // ***** Max locked type
uint private constant RELEASE_BASE_TIME = 1533686888; // ***** (2018-08-08 08:08:08) Private Lock phase start datetime (UTC seconds)
address[] private lockedOwner;
mapping(address => uint) public lockedance; // Lockeder Balance
mapping(address => uint8) public lockedtype; // Locked Type
mapping(address => uint8) public unlockedstep; // Unlocked Step
uint public totalCirculating; // Total circulating token amount
// === Modifier ===
// --- Owner Section ---
modifier isOwner() {
require(msg.sender == owner);
_;
}
modifier isNotFrozen() {
require(!frozen);
_;
}
// --- ERC20 Section ---
modifier hasEnoughBalance(uint _amount) {
require(ownerance[msg.sender] >= _amount);
_;
}
modifier overflowDetected(address _owner, uint _amount) {
require(ownerance[_owner] + _amount >= ownerance[_owner]);
_;
}
modifier hasAllowBalance(address _owner, address _allower, uint _amount) {
require(allowance[_owner][_allower] >= _amount);
_;
}
modifier isNotEmpty(address _addr, uint _value) {
require(_addr != address(0));
require(_value != 0);
_;
}
modifier isValidAddress {
assert(0x0 != msg.sender);
_;
}
// --- Locked Section ---
modifier hasntLockedBalance(address _checker) {
require(lockedtype[_checker] == 0);
_;
}
modifier checkLockedType(uint8 _locktype) {
require(_locktype > 0 && _locktype <= LOCKED_TYPE_MAX);
_;
}
// === Constructor ===
constructor() public {
owner = msg.sender;
ownerance[msg.sender] = totalSupply;
totalCirculating = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
// --- ERC20 Token Section ---
function approve(address _spender, uint _value)
isNotFrozen
isValidAddress
public returns (bool success)
{
require(_value == 0 || allowance[msg.sender][_spender] == 0); // must spend to 0 where pre approve balance.
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value)
isNotFrozen
isValidAddress
overflowDetected(_to, _value)
public returns (bool success)
{
require(ownerance[_from] >= _value);
require(allowance[_from][msg.sender] >= _value);
ownerance[_to] = ownerance[_to].add(_value);
ownerance[_from] = ownerance[_from].sub(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public
constant returns (uint balance)
{
balance = ownerance[_owner] + lockedance[_owner];
return balance;
}
function available(address _owner) public
constant returns (uint)
{
return ownerance[_owner];
}
function transfer(address _to, uint _value) public
isNotFrozen
isValidAddress
isNotEmpty(_to, _value)
hasEnoughBalance(_value)
overflowDetected(_to, _value)
returns (bool success)
{
ownerance[msg.sender] = ownerance[msg.sender].sub(_value);
ownerance[_to] = ownerance[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
// --- Owner Section ---
function transferOwner(address _newOwner)
isOwner
public returns (bool success)
{
if (_newOwner != address(0)) {
owner = _newOwner;
}
return true;
}
function freeze()
isOwner
public returns (bool success)
{
frozen = true;
return true;
}
function unfreeze()
isOwner
public returns (bool success)
{
frozen = false;
return true;
}
function burn(uint _value)
isNotFrozen
isValidAddress
hasEnoughBalance(_value)
public returns (bool success)
{
ownerance[msg.sender] = ownerance[msg.sender].sub(_value);
ownerance[0x0] = ownerance[0x0].add(_value);
totalSupply = totalSupply.sub(_value);
totalCirculating = totalCirculating.sub(_value);
emit Burn(msg.sender, _value);
return true;
}
// --- Locked Section ---
function transferLocked(address _to, uint _value, uint8 _locktype) public
isNotFrozen
isOwner
isValidAddress
isNotEmpty(_to, _value)
hasEnoughBalance(_value)
hasntLockedBalance(_to)
checkLockedType(_locktype)
returns (bool success)
{
require(msg.sender != _to);
ownerance[msg.sender] = ownerance[msg.sender].sub(_value);
if (_locktype == 1) {
lockedance[_to] = _value;
lockedtype[_to] = _locktype;
lockedOwner.push(_to);
totalCirculating = totalCirculating.sub(_value);
emit TransferLocked(msg.sender, _to, _value, _locktype);
} else if (_locktype == 2) {
uint _first = _value / 100 * 8; // prevent overflow
ownerance[_to] = ownerance[_to].add(_first);
lockedance[_to] = _value.sub(_first);
lockedtype[_to] = _locktype;
lockedOwner.push(_to);
totalCirculating = totalCirculating.sub(_value.sub(_first));
emit Transfer(msg.sender, _to, _first);
emit TransferLocked(msg.sender, _to, _value.sub(_first), _locktype);
}
return true;
}
// *****
// Because too many unlocking steps * accounts, it will burn lots of GAS !!!!!!!!!!!!!!!!!!!!!!!!!!!
// Because too many unlocking steps * accounts, it will burn lots of GAS !!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// LockedType 1 : after 6 monthes / release 10 % per month; 10 steps
// LockedType 2 : before 0 monthes / release 8 % per month; 11 steps / 1 step has release real balance init.
function unlock(address _locker, uint _delta, uint8 _locktype) private
returns (bool success)
{
if (_locktype == 1) {
if (_delta < 6 * 30 days) {
return false;
}
uint _more1 = _delta.sub(6 * 30 days);
uint _step1 = _more1 / 30 days;
for(uint8 i = 0; i < 10; i++) {
if (unlockedstep[_locker] == i && i < 9 && i <= _step1 ) {
ownerance[_locker] = ownerance[_locker].add(lockedance[_locker] / (10 - i));
lockedance[_locker] = lockedance[_locker].sub(lockedance[_locker] / (10 - i));
unlockedstep[_locker] = i + 1;
} else if (i == 9 && unlockedstep[_locker] == 9 && _step1 == 9){
ownerance[_locker] = ownerance[_locker].add(lockedance[_locker]);
lockedance[_locker] = 0;
unlockedstep[_locker] = 0;
lockedtype[_locker] = 0;
}
}
} else if (_locktype == 2) {
if (_delta < 30 days) {
return false;
}
uint _more2 = _delta - 30 days;
uint _step2 = _more2 / 30 days;
for(uint8 j = 0; j < 11; j++) {
if (unlockedstep[_locker] == j && j < 10 && j <= _step2 ) {
ownerance[_locker] = ownerance[_locker].add(lockedance[_locker] / (11 - j));
lockedance[_locker] = lockedance[_locker].sub(lockedance[_locker] / (11 - j));
unlockedstep[_locker] = j + 1;
} else if (j == 10 && unlockedstep[_locker] == 10 && _step2 == 10){
ownerance[_locker] = ownerance[_locker].add(lockedance[_locker]);
lockedance[_locker] = 0;
unlockedstep[_locker] = 0;
lockedtype[_locker] = 0;
}
}
}
return true;
}
function lockedCounts() public view
returns (uint counts)
{
return lockedOwner.length;
}
function releaseLocked() public
isNotFrozen
returns (bool success)
{
require(now > RELEASE_BASE_TIME);
uint delta = now - RELEASE_BASE_TIME;
uint lockedAmount;
for (uint i = 0; i < lockedOwner.length; i++) {
if ( lockedance[lockedOwner[i]] > 0) {
lockedAmount = lockedance[lockedOwner[i]];
unlock(lockedOwner[i], delta, lockedtype[lockedOwner[i]]);
totalCirculating = totalCirculating.add(lockedAmount - lockedance[lockedOwner[i]]);
}
}
return true;
}
} | 0x6080604052600436106101325763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663054f7d9c811461013757806306fdde0314610160578063095ea7b3146101ea57806310098ad51461020e57806318160ddd1461024157806323b872dd1461025657806325a4426f14610280578063313ce567146102b7578063395acdeb146102cc57806342966c68146102e157806345f32b6d146102f95780634fb2e45d1461030e578063510040cb1461032f57806362a5af3b146103445780636a28f0001461035957806370a082311461036e5780638da5cb5b1461038f57806395d89b41146103c0578063a9059cbb146103d5578063c1c0a908146103f9578063cc8c0f9f1461041a578063d7757dee14610444578063dd62ed3e14610465575b600080fd5b34801561014357600080fd5b5061014c61048c565b604080519115158252519081900360200190f35b34801561016c57600080fd5b5061017561049c565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b5061014c600160a060020a0360043516602435610522565b34801561021a57600080fd5b5061022f600160a060020a03600435166105e3565b60408051918252519081900360200190f35b34801561024d57600080fd5b5061022f6105fe565b34801561026257600080fd5b5061014c600160a060020a0360043581169060243516604435610604565b34801561028c57600080fd5b506102a1600160a060020a03600435166107ad565b6040805160ff9092168252519081900360200190f35b3480156102c357600080fd5b506102a16107c2565b3480156102d857600080fd5b5061022f6107c7565b3480156102ed57600080fd5b5061014c6004356107cd565b34801561030557600080fd5b5061022f610909565b34801561031a57600080fd5b5061014c600160a060020a036004351661090f565b34801561033b57600080fd5b5061014c610967565b34801561035057600080fd5b5061014c610af5565b34801561036557600080fd5b5061014c610b37565b34801561037a57600080fd5b5061022f600160a060020a0360043516610b73565b34801561039b57600080fd5b506103a4610b9b565b60408051600160a060020a039092168252519081900360200190f35b3480156103cc57600080fd5b50610175610baa565b3480156103e157600080fd5b5061014c600160a060020a0360043516602435610be1565b34801561040557600080fd5b506102a1600160a060020a0360043516610d23565b34801561042657600080fd5b5061014c600160a060020a036004351660243560ff60443516610d38565b34801561045057600080fd5b5061022f600160a060020a03600435166110db565b34801561047157600080fd5b5061022f600160a060020a03600435811690602435166110ed565b60005460a060020a900460ff1681565b608060405190810160405280605081526020017f4d44455820506c6174666f726d20546f6b656e207c204d6f6e676f6c6961204e81526020017f6174696f6e616c20426c6f636b636861696e204469676974616c20417373657481526020017f732045786368616e676520546f6b656e0000000000000000000000000000000081525081565b6000805460a060020a900460ff161561053a57600080fd5b33151561054357fe5b8115806105715750336000908152600360209081526040808320600160a060020a0387168452909152902054155b151561057c57600080fd5b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600160a060020a031660009081526002602052604090205490565b60015481565b6000805460a060020a900460ff161561061c57600080fd5b33151561062557fe5b600160a060020a03831660009081526002602052604090205483908390808201101561065057600080fd5b600160a060020a03861660009081526002602052604090205484111561067557600080fd5b600160a060020a03861660009081526003602090815260408083203384529091529020548411156106a557600080fd5b600160a060020a0385166000908152600260205260409020546106ce908563ffffffff61110a16565b600160a060020a038087166000908152600260205260408082209390935590881681522054610703908563ffffffff61112316565b600160a060020a0387166000908152600260209081526040808320939093556003815282822033835290522054610740908563ffffffff61112316565b600160a060020a03808816600081815260036020908152604080832033845282529182902094909455805188815290519289169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600195945050505050565b60076020526000908152604090205460ff1681565b600681565b60055490565b6000805460a060020a900460ff16156107e557600080fd5b3315156107ee57fe5b33600090815260026020526040902054829081111561080c57600080fd5b3360009081526002602052604090205461082c908463ffffffff61112316565b3360009081526002602052604081209190915580527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b54610873908463ffffffff61110a16565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b556001546108b1908463ffffffff61112316565b6001556009546108c7908463ffffffff61112316565b60095560408051848152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250600192915050565b60095481565b60008054600160a060020a0316331461092757600080fd5b600160a060020a0382161561095f576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790555b506001919050565b6000805481908190819060a060020a900460ff161561098557600080fd5b635b6a3468421161099557600080fd5b50635b6a3467194201915060005b600554811015610aeb576000600660006005848154811015156109c257fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020541115610ae35760066000600583815481101515610a0057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460058054919350610a929183908110610a3a57fe5b600091825260208220015460058054600160a060020a039092169287926007929087908110610a6557fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16611138565b50610adf60066000600584815481101515610aa957fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460095490840363ffffffff61110a16565b6009555b6001016109a3565b6001935050505090565b60008054600160a060020a03163314610b0d57600080fd5b506000805474ff0000000000000000000000000000000000000000191660a060020a179055600190565b60008054600160a060020a03163314610b4f57600080fd5b506000805474ff000000000000000000000000000000000000000019169055600190565b600160a060020a03166000908152600660209081526040808320546002909252909120540190565b600054600160a060020a031681565b60408051808201909152600381527f4d4e540000000000000000000000000000000000000000000000000000000000602082015281565b6000805460a060020a900460ff1615610bf957600080fd5b331515610c0257fe5b8282600160a060020a0382161515610c1957600080fd5b801515610c2557600080fd5b336000908152600260205260409020548490811115610c4357600080fd5b600160a060020a038616600090815260026020526040902054869086908082011015610c6e57600080fd5b33600090815260026020526040902054610c8e908863ffffffff61112316565b3360009081526002602052604080822092909255600160a060020a038a1681522054610cc0908863ffffffff61110a16565b600160a060020a0389166000818152600260209081526040918290209390935580518a81529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001979650505050505050565b60086020526000908152604090205460ff1681565b60008054819060a060020a900460ff1615610d5257600080fd5b600054600160a060020a03163314610d6957600080fd5b331515610d7257fe5b8484600160a060020a0382161515610d8957600080fd5b801515610d9557600080fd5b336000908152600260205260409020548690811115610db357600080fd5b600160a060020a038816600090815260076020526040902054889060ff1615610ddb57600080fd5b8660008160ff16118015610df8575060045460ff90811690821611155b1515610e0357600080fd5b33600160a060020a038b161415610e1957600080fd5b33600090815260026020526040902054610e39908a63ffffffff61112316565b33600090815260026020526040902055600160ff89161415610f3257600160a060020a038a1660008181526006602090815260408083208d905560079091528120805460ff191660ff8c161790556005805460018101825591527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001805473ffffffffffffffffffffffffffffffffffffffff19169091179055600954610ee0908a611123565b600955604080518a815260ff8a1660208201528151600160a060020a038d169233927f561a61d04d3950240057a3c6e0c82e9d7767fe522e10b8df6b16ae5e1f7a3f47929081900390910190a36110c9565b8760ff16600214156110c957600160a060020a038a16600090815260026020526040902054600860648b04029650610f6a908761110a565b600160a060020a038b16600090815260026020526040902055610f93898763ffffffff61112316565b600160a060020a038b1660008181526006602090815260408083209490945560079052918220805460ff191660ff8c161790556005805460018101825592527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0909101805473ffffffffffffffffffffffffffffffffffffffff191690911790556110306110218a88611123565b6009549063ffffffff61112316565b600955604080518781529051600160a060020a038c169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3600160a060020a038a16337f561a61d04d3950240057a3c6e0c82e9d7767fe522e10b8df6b16ae5e1f7a3f476110af8c8a63ffffffff61112316565b6040805191825260ff8d1660208301528051918290030190a35b600196505b5050505050509392505050565b60066020526000908152604090205481565b600360209081526000928352604080842090915290825290205481565b60008282018381101561111c57600080fd5b9392505050565b60008282111561113257600080fd5b50900390565b60008060008060008060008760ff16600114156113945762ed4e0089101561116357600096506110ce565b6111768962ed4e0063ffffffff61112316565b955062278d0086049450600093505b600a8460ff16101561138f57600160a060020a038a1660009081526008602052604090205460ff85811691161480156111c1575060098460ff16105b80156111d05750848460ff1611155b156112c657600160a060020a038a1660009081526006602052604090205461122b9060ff600a879003169081151561120457fe5b600160a060020a038d1660009081526002602052604090205491900463ffffffff61110a16565b600160a060020a038b1660009081526002602090815260408083209390935560069052205461128d9060ff600a879003169081151561126657fe5b600160a060020a038d1660009081526006602052604090205491900463ffffffff61112316565b600160a060020a038b166000908152600660209081526040808320939093556008905220805460ff19166001860160ff16179055611384565b8360ff1660091480156112f45750600160a060020a038a1660009081526008602052604090205460ff166009145b80156113005750846009145b1561138457600160a060020a038a166000908152600660209081526040808320546002909252909120546113399163ffffffff61110a16565b600160a060020a038b166000908152600260209081526040808320939093556006815282822082905560088152828220805460ff199081169091556007909152919020805490911690555b600190930192611185565b6110c9565b8760ff16600214156110c95762278d008910156113b457600096506110ce565b50505062278cff19860162278d00810460005b600b8160ff1610156110c957600160a060020a038a1660009081526008602052604090205460ff82811691161480156114035750600a8160ff16105b80156114125750818160ff1611155b156114ba57600160a060020a038a166000908152600660205260409020546114469060ff600b849003169081151561120457fe5b600160a060020a038b166000908152600260209081526040808320939093556006905220546114819060ff600b849003169081151561126657fe5b600160a060020a038b166000908152600660209081526040808320939093556008905220805460ff19166001830160ff16179055611578565b8060ff16600a1480156114e85750600160a060020a038a1660009081526008602052604090205460ff16600a145b80156114f4575081600a145b1561157857600160a060020a038a1660009081526006602090815260408083205460029092529091205461152d9163ffffffff61110a16565b600160a060020a038b166000908152600260209081526040808320939093556006815282822082905560088152828220805460ff199081169091556007909152919020805490911690555b6001016113c75600a165627a7a7230582079e2edfc42f558af9945b9b030ab4fc9117e5ecd3a6727a0909fbf1313d211c40029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 1,583 |
0x930144aecfe482c43d452c6a23f5e71fb427547e | // SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'DAFToken' token contract
//
// Symbol : DAF
// Name : DAFToken
// Total supply: 1 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract DAF is BurnableToken {
string public constant name = "DAFToken";
string public constant symbol = "DAF";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a11565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd7565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e68565b6040518082815260200191505060405180910390f35b6103b1610eb1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0e565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e2565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6040518060400160405280600881526020017f444146546f6b656e00000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b490919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a620f42400281565b60008111610a1e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6a57600080fd5b6000339050610ac182600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b19826001546114b490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce8576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7c565b610cfb83826114b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f444146000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4957600080fd5b610f9b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c057fe5b818303905092915050565b6000808284019050838110156114dd57fe5b809150509291505056fea2646970667358221220db8939d682661d600459127fa392cd5872f61036ee69b8dc27fefc958803061d64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,584 |
0xc5511feabf813a289c756799d26237e3b97b5bd7 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract URODCoin is ERC20 {
constructor() ERC20("URODCoin", "UROD") {
_mint(msg.sender, 42069000000000000000000);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c391906106dd565b60405180910390f35b6100df6100da3660046106a9565b610222565b6040516100c391906106d2565b6100f461023f565b6040516100c39190610911565b6100df61010f36600461066e565b610245565b61011c6102de565b6040516100c3919061091a565b6100df6101373660046106a9565b6102e3565b6100f461014a36600461061b565b610337565b6100b6610356565b6100df6101653660046106a9565b610365565b6100df6101783660046106a9565b6103de565b6100f461018b36600461063c565b6103f2565b60606003805461019f9061094c565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb9061094c565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f61041d565b8484610421565b50600192915050565b60025490565b60006102528484846104d5565b6001600160a01b03841660009081526001602052604081208161027361041d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102bf5760405162461bcd60e51b81526004016102b6906107fb565b60405180910390fd5b6102d3856102cb61041d565b858403610421565b506001949350505050565b601290565b60006102366102f061041d565b8484600160006102fe61041d565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546103329190610928565b610421565b6001600160a01b0381166000908152602081905260409020545b919050565b60606004805461019f9061094c565b6000806001600061037461041d565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103c05760405162461bcd60e51b81526004016102b6906108cc565b6103d46103cb61041d565b85858403610421565b5060019392505050565b60006102366103eb61041d565b84846104d5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166104475760405162461bcd60e51b81526004016102b690610888565b6001600160a01b03821661046d5760405162461bcd60e51b81526004016102b690610773565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104c8908590610911565b60405180910390a3505050565b6001600160a01b0383166104fb5760405162461bcd60e51b81526004016102b690610843565b6001600160a01b0382166105215760405162461bcd60e51b81526004016102b690610730565b61052c8383836105ff565b6001600160a01b038316600090815260208190526040902054818110156105655760405162461bcd60e51b81526004016102b6906107b5565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061059c908490610928565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105e69190610911565b60405180910390a36105f98484846105ff565b50505050565b505050565b80356001600160a01b038116811461035157600080fd5b60006020828403121561062c578081fd5b61063582610604565b9392505050565b6000806040838503121561064e578081fd5b61065783610604565b915061066560208401610604565b90509250929050565b600080600060608486031215610682578081fd5b61068b84610604565b925061069960208501610604565b9150604084013590509250925092565b600080604083850312156106bb578182fd5b6106c483610604565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b81811015610709578581018301518582016040015282016106ed565b8181111561071a5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561094757634e487b7160e01b81526011600452602481fd5b500190565b60028104600182168061096057607f821691505b6020821081141561098157634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220c651a310d2754f4504dce06ce7defbb029cd4a0e10a33ed9583b8cd3dcff92d964736f6c63430008000033 | {"success": true, "error": null, "results": {}} | 1,585 |
0xc942a53a6daf7ad4ffcc1b53e85551083a62d5a7 | // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract J4U is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"JUST 4 YOU";
string private constant _symbol = unicode"J4U";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(8)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 8;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600a81526020017f4a555354203420594f5500000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4a34550000000000000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60026009819055506008600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960028461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660088461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207f3f721271d084c8c501c4c041afc5464d6a8badfca2ec49e887b5ca388c617b64736f6c63430008040033 | {"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"}]}} | 1,586 |
0x91e3e6a43cf4fa6e8423488051de303f33d73452 | /**
ELON TWEET
BIZNIZ INU
Telegram: https://t.me/bobamusk
*/
// 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 bobamuskinu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Boba Inu";
string private constant _symbol = " BOBA INU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x8502929cd7617E3E13dFb30ab888561FF61eb7E7);
address payable private _marketingAddress = payable(0x8502929cd7617E3E13dFb30ab888561FF61eb7E7);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 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 {
_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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104b357600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611962565b6105fe565b005b34801561020a57600080fd5b50604080518082019091526008815267426f626120496e7560c01b60208201525b6040516102389190611a27565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a7c565b61069d565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50670de0b6b3a76400005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611aa8565b6106b4565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ae9565b61071d565b34801561036c57600080fd5b506101fc61037b366004611b16565b610768565b34801561038c57600080fd5b506101fc6107b0565b3480156103a157600080fd5b506102c06103b0366004611ae9565b6107fb565b3480156103c157600080fd5b506101fc61081d565b3480156103d657600080fd5b506101fc6103e5366004611b31565b610891565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ae9565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611b16565b6108c0565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b5060408051808201909152600981526820424f424120494e5560b81b602082015261022b565b3480156104bf57600080fd5b506101fc6104ce366004611b31565b610908565b3480156104df57600080fd5b506101fc6104ee366004611b4a565b610937565b3480156104ff57600080fd5b5061026161050e366004611a7c565b610975565b34801561051f57600080fd5b5061026161052e366004611ae9565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610982565b34801561056457600080fd5b506101fc610573366004611b7c565b6109d6565b34801561058457600080fd5b506102c0610593366004611c00565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b31565b610a77565b3480156105ea57600080fd5b506101fc6105f9366004611ae9565b610aa6565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c39565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c6e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c9a565b915050610634565b5050565b60006106aa338484610b90565b5060015b92915050565b60006106c1848484610cb4565b610713843361070e85604051806060016040528060288152602001611db4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f0565b610b90565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c39565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c39565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f88161122a565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611264565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611c39565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611c39565b601655565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161062890611c39565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161062890611c39565b601855565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062890611c39565b600893909355600a91909155600955600b55565b60006106aa338484610cb4565b6012546001600160a01b0316336001600160a01b031614806109b757506013546001600160a01b0316336001600160a01b0316145b6109c057600080fd5b60006109cb306107fb565b90506107f8816112e8565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161062890611c39565b60005b82811015610a71578160056000868685818110610a2257610a22611c6e565b9050602002016020810190610a379190611ae9565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6981611c9a565b915050610a03565b50505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161062890611c39565b601755565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161062890611c39565b6001600160a01b038116610b355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e0857506000546001600160a01b03838116911614155b156110e957601554600160a01b900460ff16610ea1576000546001600160a01b03848116911614610ea15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601654811115610ef35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3557506001600160a01b03821660009081526010602052604090205460ff16155b610f8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b038381169116146110125760175481610faf846107fb565b610fb99190611cb5565b106110125760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b600061101d306107fb565b6018546016549192508210159082106110365760165491505b80801561104d5750601554600160a81b900460ff16155b801561106757506015546001600160a01b03868116911614155b801561107c5750601554600160b01b900460ff165b80156110a157506001600160a01b03851660009081526005602052604090205460ff16155b80156110c657506001600160a01b03841660009081526005602052604090205460ff16155b156110e6576110d4826112e8565b4780156110e4576110e44761122a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112b57506001600160a01b03831660009081526005602052604090205460ff165b8061115d57506015546001600160a01b0385811691161480159061115d57506015546001600160a01b03848116911614155b1561116a575060006111e4565b6015546001600160a01b03858116911614801561119557506014546001600160a01b03848116911614155b156111a757600854600c55600954600d555b6015546001600160a01b0384811691161480156111d257506014546001600160a01b03858116911614155b156111e457600a54600c55600b54600d555b610a7184848484611471565b600081848411156112145760405162461bcd60e51b81526004016106289190611a27565b5060006112218486611ccd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112cb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112d561149f565b90506112e183826114c2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133057611330611c6e565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138457600080fd5b505afa158015611398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bc9190611ce4565b816001815181106113cf576113cf611c6e565b6001600160a01b0392831660209182029290920101526014546113f59130911684610b90565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142e908590600090869030904290600401611d01565b600060405180830381600087803b15801561144857600080fd5b505af115801561145c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147e5761147e611504565b611489848484611532565b80610a7157610a71600e54600c55600f54600d55565b60008060006114ac611629565b90925090506114bb82826114c2565b9250505090565b60006112e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611669565b600c541580156115145750600d54155b1561151b57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154487611697565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157690876116f4565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a59086611736565b6001600160a01b0389166000908152600260205260409020556115c781611795565b6115d184836117df565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161691815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164482826114c2565b82101561166057505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168a5760405162461bcd60e51b81526004016106289190611a27565b5060006112218486611d72565b60008060008060008060008060006116b48a600c54600d54611803565b92509250925060006116c461149f565b905060008060006116d78e878787611858565b919e509c509a509598509396509194505050505091939550919395565b60006112e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f0565b6000806117438385611cb5565b9050838110156112e15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b600061179f61149f565b905060006117ad83836118a8565b306000908152600260205260409020549091506117ca9082611736565b30600090815260026020526040902055505050565b6006546117ec90836116f4565b6006556007546117fc9082611736565b6007555050565b600080808061181d606461181789896118a8565b906114c2565b9050600061183060646118178a896118a8565b90506000611848826118428b866116f4565b906116f4565b9992985090965090945050505050565b600080808061186788866118a8565b9050600061187588876118a8565b9050600061188388886118a8565b905060006118958261184286866116f4565b939b939a50919850919650505050505050565b6000826118b7575060006106ae565b60006118c38385611d94565b9050826118d08583611d72565b146112e15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b803561195d8161193d565b919050565b6000602080838503121561197557600080fd5b823567ffffffffffffffff8082111561198d57600080fd5b818501915085601f8301126119a157600080fd5b8135818111156119b3576119b3611927565b8060051b604051601f19603f830116810181811085821117156119d8576119d8611927565b6040529182528482019250838101850191888311156119f657600080fd5b938501935b82851015611a1b57611a0c85611952565b845293850193928501926119fb565b98975050505050505050565b600060208083528351808285015260005b81811015611a5457858101830151858201604001528201611a38565b81811115611a66576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8f57600080fd5b8235611a9a8161193d565b946020939093013593505050565b600080600060608486031215611abd57600080fd5b8335611ac88161193d565b92506020840135611ad88161193d565b929592945050506040919091013590565b600060208284031215611afb57600080fd5b81356112e18161193d565b8035801515811461195d57600080fd5b600060208284031215611b2857600080fd5b6112e182611b06565b600060208284031215611b4357600080fd5b5035919050565b60008060008060808587031215611b6057600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9157600080fd5b833567ffffffffffffffff80821115611ba957600080fd5b818601915086601f830112611bbd57600080fd5b813581811115611bcc57600080fd5b8760208260051b8501011115611be157600080fd5b602092830195509350611bf79186019050611b06565b90509250925092565b60008060408385031215611c1357600080fd5b8235611c1e8161193d565b91506020830135611c2e8161193d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cae57611cae611c84565b5060010190565b60008219821115611cc857611cc8611c84565b500190565b600082821015611cdf57611cdf611c84565b500390565b600060208284031215611cf657600080fd5b81516112e18161193d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d515784516001600160a01b031683529383019391830191600101611d2c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dae57611dae611c84565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a4c3b2aa71caef5068b1de5a8f11720370b5f188cc7abb489f6f66fd6c57b69e64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,587 |
0xcb61c0c74b69cbca74bf21e68cb1aec186348021 | /**
*Submitted for verification at Etherscan.io
*/
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 ARPToken is CappedToken, PausableToken, BurnableToken {
string public constant name = "Address Resolution Protocol";
string public constant symbol = "ARP";
uint8 public constant decimals = 18;
uint256 private constant TOKEN_CAP = 1024 * (10 ** uint256(decimals));
uint256 private constant TOKEN_INITIAL = 1024 * (10 ** uint256(decimals));
function ARPToken() public CappedToken(TOKEN_CAP) {
totalSupply_ = TOKEN_INITIAL;
balances[msg.sender] = TOKEN_INITIAL;
emit Transfer(address(0), msg.sender, TOKEN_INITIAL);
paused = true;
}
} | 0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012d57806306fdde031461015a578063095ea7b3146101e857806318160ddd1461024257806323b872dd1461026b578063313ce567146102e4578063355274ea146103135780633f4ba83a1461033c57806340c10f191461035157806342966c68146103ab5780635c975abb146103ce57806366188463146103fb57806370a08231146104555780637d64bcb4146104a257806383f12fec146104cf5780638456cb591461054a5780638da5cb5b1461055f57806395d89b41146105b4578063a9059cbb14610642578063d73dd6231461069c578063dd62ed3e146106f6578063f2fde38b14610762575b600080fd5b341561013857600080fd5b61014061079b565b604051808215151515815260200191505060405180910390f35b341561016557600080fd5b61016d6107ae565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f357600080fd5b610228600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e7565b604051808215151515815260200191505060405180910390f35b341561024d57600080fd5b610255610817565b6040518082815260200191505060405180910390f35b341561027657600080fd5b6102ca600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610821565b604051808215151515815260200191505060405180910390f35b34156102ef57600080fd5b6102f7610853565b604051808260ff1660ff16815260200191505060405180910390f35b341561031e57600080fd5b610326610858565b6040518082815260200191505060405180910390f35b341561034757600080fd5b61034f61085e565b005b341561035c57600080fd5b610391600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061091e565b604051808215151515815260200191505060405180910390f35b34156103b657600080fd5b6103cc60048080359060200190919050506109cf565b005b34156103d957600080fd5b6103e1610b87565b604051808215151515815260200191505060405180910390f35b341561040657600080fd5b61043b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b9a565b604051808215151515815260200191505060405180910390f35b341561046057600080fd5b61048c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bca565b6040518082815260200191505060405180910390f35b34156104ad57600080fd5b6104b5610c12565b604051808215151515815260200191505060405180910390f35b34156104da57600080fd5b610530600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610cda565b604051808215151515815260200191505060405180910390f35b341561055557600080fd5b61055d610f74565b005b341561056a57600080fd5b610572611035565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105bf57600080fd5b6105c761105b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106075780820151818401526020810190506105ec565b50505050905090810190601f1680156106345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561064d57600080fd5b610682600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611094565b604051808215151515815260200191505060405180910390f35b34156106a757600080fd5b6106dc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110c4565b604051808215151515815260200191505060405180910390f35b341561070157600080fd5b61074c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110f4565b6040518082815260200191505060405180910390f35b341561076d57600080fd5b610799600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061117b565b005b600360149054906101000a900460ff1681565b6040805190810160405280601b81526020017f41646472657373205265736f6c7574696f6e2050726f746f636f6c000000000081525081565b6000600560009054906101000a900460ff1615151561080557600080fd5b61080f8383611252565b905092915050565b6000600154905090565b6000600560009054906101000a900460ff1615151561083f57600080fd5b61084a848484611344565b90509392505050565b601281565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ba57600080fd5b600560009054906101000a900460ff1615156108d557600080fd5b6000600560006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097c57600080fd5b600360149054906101000a900460ff1615151561099857600080fd5b6004546109b0836001546116fe90919063ffffffff16565b111515156109bd57600080fd5b6109c7838361171c565b905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a1e57600080fd5b339050610a72826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ac98260015461190290919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600560009054906101000a900460ff1681565b6000600560009054906101000a900460ff16151515610bb857600080fd5b610bc2838361191b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7057600080fd5b600360149054906101000a900460ff16151515610c8c57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600080600080600560009054906101000a900460ff16151515610cfc57600080fd5b85519250610d138386611bac90919063ffffffff16565b9150600083111515610d2457600080fd5b600085118015610d725750816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515610d7d57600080fd5b610dce826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b82811015610f6757610e85856000808985815181101515610e3257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808884815181101515610e9657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508581815181101515610eec57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a38080600101915050610e15565b6001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd057600080fd5b600560009054906101000a900460ff16151515610fec57600080fd5b6001600560006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f415250000000000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff161515156110b257600080fd5b6110bc8383611be7565b905092915050565b6000600560009054906101000a900460ff161515156110e257600080fd5b6110ec8383611e06565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561124f5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561138157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113ce57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561145957600080fd5b6114aa826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561171257fe5b8091505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177a57600080fd5b600360149054906101000a900460ff1615151561179657600080fd5b6117ab826001546116fe90919063ffffffff16565b600181905550611802826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561191057fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611a2c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac0565b611a3f838261190290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000806000841415611bc15760009150611be0565b8284029050828482811515611bd257fe5b04141515611bdc57fe5b8091505b5092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c2457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c7157600080fd5b611cc2826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d55826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611e9782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116fe90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a7230582009ee34f85c2b79aeabd5ce31bb4e5d6d19a95f5556b666875c1ac966b4e8d9130029 | {"success": true, "error": null, "results": {}} | 1,588 |
0xE10eca6c33D6949beFC225BFa01e5E12FAbf9E03 | /**
*Submitted for verification at BscScan.com on 2022-01-06
*/
pragma solidity 0.6.4;
// SPDX-License-Identifier: MIT
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a <= b ? a : b;
}
function abs(uint256 a, uint256 b) internal pure returns (uint256) {
if (a < b) {
return b - a;
}
return a - b;
}
}
// SPDX-License-Identifier: MIT
contract InterestRateModelV3 {
using SafeMath for uint256;
// 基础利率0.02,转折点为0.8,0.8时为30%, 1时为300%, x为使用率
// y1 = 0.35 * x + 0.02 x∈[0, 0.8] y1∈[0.02, 0.3]
// y2 = 13.5 * x - 10.5 x∈[0.8, 1] y2∈[0.3, 3]
uint256 public multiplierPerBlock; // 0.35 ==> 0.35 * 1e18
uint256 public jumpMultiplierPerBlock;//13.5 ==> 13.5 * 1e18
uint256 public jumpPoint;//转折点 0.8 ==> 0.8 * 1e18
uint256 public baseRatePerBlock;//0.02e18 截距为1
uint256 public blocksPerYear;//ETH: 2102400, BSC: 10512000
constructor(
uint256 baseRatePerYear,
uint256 multiplierPerYear,
uint256 jumpMultiplierPerYear,
uint256 _blocksPerYear,
uint256 _jumpPoint
) public {
blocksPerYear = _blocksPerYear;
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
jumpPoint = _jumpPoint;
}
// 计算利用率
function utilizationRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) public pure returns (uint256) {
if (borrows == 0) {
return 0;
}
// borrows/(cash + borrows)
return borrows.mul(1e18).div(cash.add(borrows));
}
// 借款利率
function getBorrowRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) public view returns (uint256) {
uint256 ur = utilizationRate(cash, borrows, reserves);
if (ur <= jumpPoint) {
return ur.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);//y1 = 0.35 * x + 0.02
} else {
// jumpPointRate = 0.8 * 0.35 + 0.02 = 0.30
// deltaY = jumpMultiplierPerBlock * (ur - jumpPoint) == deltaX * (ur - 0.8)
// y = jumpPointRate + deltaY
uint256 jumpPointRate = jumpPoint.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint256 excessUr = ur.sub(jumpPoint);
return excessUr.mul(jumpMultiplierPerBlock).div(1e18).add(jumpPointRate);// y2 = 13.5 * x - 10.5
}
}
// 存款利率
function getSupplyRate(
uint256 cash,
uint256 borrows,
uint256 reserves,
uint256 reserveFactorMantissa
) public view returns (uint256) {
uint256 oneMinusReserveFactor = uint256(1e18).sub(
reserveFactorMantissa
);
uint256 borrowRate = getBorrowRate(cash, borrows, reserves);
uint256 rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return
utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
function APR(
uint256 cash,
uint256 borrows,
uint256 reserves
) external view returns (uint256) {
return getBorrowRate(cash, borrows, reserves).mul(blocksPerYear);
}
function APY(
uint256 cash,
uint256 borrows,
uint256 reserves,
uint256 reserveFactorMantissa
) external view returns (uint256) {
return
getSupplyRate(cash, borrows, reserves, reserveFactorMantissa).mul(
blocksPerYear
);
}
} | 0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063af0a769811610066578063af0a769814610146578063b81688161461014e578063b9f9850a1461017d578063ca9cdd1b14610185578063f14039de146101ae5761009e565b806315f24053146100a35780636e71e2d8146100de5780638726bb8914610107578063a385fb961461010f578063ae8b520f14610117575b600080fd5b6100cc600480360360608110156100b957600080fd5b50803590602081013590604001356101b6565b60408051918252519081900360200190f35b6100cc600480360360608110156100f457600080fd5b508035906020810135906040013561028e565b6100cc6102d0565b6100cc6102d6565b6100cc6004803603608081101561012d57600080fd5b50803590602081013590604081013590606001356102dc565b6100cc610305565b6100cc6004803603608081101561016457600080fd5b508035906020810135906040810135906060013561030b565b6100cc61037e565b6100cc6004803603606081101561019b57600080fd5b5080359060208101359060400135610384565b6100cc610397565b6000806101c485858561028e565b905060025481116102165761020e600354610202670de0b6b3a76400006101f66000548661039d90919063ffffffff16565b9063ffffffff6103ff16565b9063ffffffff61044116565b915050610287565b6000610241600354610202670de0b6b3a76400006101f660005460025461039d90919063ffffffff16565b9050600061025a6002548461049b90919063ffffffff16565b905061028182610202670de0b6b3a76400006101f66001548661039d90919063ffffffff16565b93505050505b9392505050565b60008261029d57506000610287565b6102c86102b0858563ffffffff61044116565b6101f685670de0b6b3a764000063ffffffff61039d16565b949350505050565b60005481565b60045481565b60006102fc6004546102f08787878761030b565b9063ffffffff61039d16565b95945050505050565b60025481565b600080610326670de0b6b3a76400008463ffffffff61049b16565b905060006103358787876101b6565b90506000610355670de0b6b3a76400006101f6848663ffffffff61039d16565b9050610372670de0b6b3a76400006101f6836102f08c8c8c61028e565b98975050505050505050565b60015481565b60006102c86004546102f08686866101b6565b60035481565b6000826103ac575060006103f9565b828202828482816103b957fe5b04146103f65760405162461bcd60e51b81526004018080602001828103825260218152602001806105da6021913960400191505060405180910390fd5b90505b92915050565b60006103f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506104dd565b6000828201838110156103f6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006103f683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061057f565b600081836105695760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561052e578181015183820152602001610516565b50505050905090810190601f16801561055b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161057557fe5b0495945050505050565b600081848411156105d15760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561052e578181015183820152602001610516565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122059fd96784a2801c1f4045995fa4eb6e227dcb01dce863e170b9ae3cdd02b194764736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,589 |
0xadbaededf0b71d0fce26c2bd8ac228979aced4a3 | /**
*
LionKing Inu is going to launch in the Uniswap at July 8.
This is fair launch and going to launch without any presale.
tg: https://t.me/LionkingX
All crypto babies will become a LionKing in here.
Let's enjoy our launch!
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LionKing 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 _friends;
mapping (address => User) private trader;
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"LION KING";
string private constant _symbol = unicode" LKING ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613eae565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de919061396f565b610662565b6040516101f09190613e93565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614090565b60405180910390f35b34801561023057600080fd5b5061024b6004803603810190610246919061391c565b610691565b6040516102589190613e93565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614090565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae9190614105565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613a52565b610783565b005b3480156102ec57600080fd5b50610307600480360381019061030291906139f8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b9190613882565b61095f565b60405161033d9190614090565b60405180910390f35b34801561035257600080fd5b5061036d60048036038101906103689190613882565b610aeb565b60405161037a9190613e93565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190613882565b610b41565b6040516103b79190614090565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190613882565b610c0a565b60405161040b9190614090565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613dc5565b60405180910390f35b34801561046257600080fd5b5061047d60048036038101906104789190613882565b610dd7565b60405161048a9190614090565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613eae565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e0919061396f565b610e7f565b6040516104f29190613e93565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613e93565b60405180910390f35b34801561053257600080fd5b5061054d600480360381019061054891906139af565b610eb2565b005b34801561055b57600080fd5b506105646110c2565b005b34801561057257600080fd5b5061057b61113c565b005b34801561058957600080fd5b50610592611208565b60405161059f9190614090565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca9190613882565b61123a565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906138dc565b61132a565b6040516106059190614090565b60405180910390f35b34801561061a57600080fd5b506106236113b1565b005b60606040518060400160405280600981526020017f4c494f4e204b494e470000000000000000000000000000000000000000000000815250905090565b600061067661066f6118c3565b84846118cb565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611a96565b61075f846106aa6118c3565b61075a856040518060600160405280602881526020016148aa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107106118c3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b6b9092919063ffffffff16565b6118cb565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c46118c3565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90613f70565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614090565b60405180910390a150565b6108726118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690613fd0565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613e93565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b191906141c6565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a1191906141c6565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a7191906141c6565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad191906141c6565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b9191906142a7565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd96118c3565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612bcf565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d46565b9050919050565b610c636118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790613fd0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d91906142a7565b612db490919063ffffffff16565b9050919050565b60606040518060400160405280600781526020017f204c4b494e472000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c6118c3565b8484611a96565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba6118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90613fd0565b60405180910390fd5b60005b81518110156110be57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f9f57610f9e61444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156110335750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106110125761101161444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156110ab576001600660008484815181106110515761105061444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806110b6906143a6565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111036118c3565b73ffffffffffffffffffffffffffffffffffffffff161461112357600080fd5b600061112e30610c0a565b905061113981612e2f565b50565b6111446118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c890613fd0565b60405180910390fd5b6001601560146101000a81548160ff0219169083151502179055506078426111f991906141c6565b60178190555043601681905550565b6000611235601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112426118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c690613fd0565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113b96118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143d90613fd0565b60405180910390fd5b601560149054906101000a900460ff1615611496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148d90614050565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061152630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006118cb565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561156c57600080fd5b505afa158015611580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a491906138af565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e91906138af565b6040518363ffffffff1660e01b815260040161165b929190613de0565b602060405180830381600087803b15801561167557600080fd5b505af1158015611689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ad91906138af565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061173630610c0a565b600080611741610dae565b426040518863ffffffff1660e01b815260040161176396959493929190613e32565b6060604051808303818588803b15801561177c57600080fd5b505af1158015611790573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117b59190613a7f565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161186d929190613e09565b602060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bf9190613a25565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193290614030565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a290613f10565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a899190614090565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afd90614010565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6d90613ed0565b60405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb090613ff0565b60405180910390fd5b611bc1610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612aa857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611cd85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ce157600080fd5b6001601654611cf091906141c6565b4311158015611d00575060105481145b15611f1f57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611db15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e13576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f1e565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611ebf5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f1d576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661202c576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120d75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561212d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156126b557601560149054906101000a900460ff16612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614070565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546121d191906141c6565b421115612221576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156122d957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906122bf906143a6565b91905055506005600a819055506005600b81905550612515565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561239157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000815480929190612377906143a6565b91905055506004600a819055506004600b81905550612514565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561244957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061242f906143a6565b91905055506003600a819055506003600b81905550612513565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561250157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124e7906143a6565b91905055506002600a819055506002600b81905550612512565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff16156126b4574260175411156126605760105481111561258857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061260c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260390613f30565b60405180910390fd5b602d4261261991906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f4261266d91906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b60006126c030610c0a565b9050601560169054906101000a900460ff1615801561272d5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127455750601560149054906101000a900460ff165b15612aa65760158054906101000a900460ff16156127e25742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154106127e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d890613f90565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461283891906141c6565b42111561284857600a9050612970565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461289891906141c6565b4211156128a857600f905061296f565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128f891906141c6565b421115612908576014905061296e565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461295891906141c6565b421115612968576019905061296d565b602390505b5b5b5b612997600a612989600484612db490919063ffffffff16565b6130b790919063ffffffff16565b600a819055506129c4600a6129b6600684612db490919063ffffffff16565b6130b790919063ffffffff16565b600b819055506000821115612a8b57612a256064612a17600c54612a09601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b821115612a8157612a7e6064612a70600c54612a62601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b91505b612a8a82612e2f565b5b60004790506000811115612aa357612aa247612bcf565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612b4f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5957600090505b612b6584848484613101565b50505050565b6000838311158290612bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612baa9190613eae565b60405180910390fd5b5060008385612bc291906142a7565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c1f6002846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612c4a573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9b6004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cc6573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d176004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d42573d6000803e3d6000fd5b5050565b6000600854821115612d8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8490613ef0565b60405180910390fd5b6000612d9761312e565b9050612dac81846130b790919063ffffffff16565b915050919050565b600080831415612dc75760009050612e29565b60008284612dd5919061424d565b9050828482612de4919061421c565b14612e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1b90613fb0565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612e6757612e6661447c565b5b604051908082528060200260200182016040528015612e955781602001602082028036833780820191505090505b5090503081600081518110612ead57612eac61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612f4f57600080fd5b505afa158015612f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8791906138af565b81600181518110612f9b57612f9a61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061300230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846118cb565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016130669594939291906140ab565b600060405180830381600087803b15801561308057600080fd5b505af1158015613094573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006130f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613159565b905092915050565b8061310f5761310e6131bc565b5b61311a8484846131ff565b80613128576131276133ca565b5b50505050565b600080600061313b6133de565b9150915061315281836130b790919063ffffffff16565b9250505090565b600080831182906131a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131979190613eae565b60405180910390fd5b50600083856131af919061421c565b9050809150509392505050565b6000600a541480156131d057506000600b54145b156131da576131fd565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b60008060008060008061321187613440565b95509550955095509550955061326f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134a890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061330485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335081613550565b61335a848361360d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516133b79190614090565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea000009050613414683635c9adc5dea000006008546130b790919063ffffffff16565b82101561343357600854683635c9adc5dea0000093509350505061343c565b81819350935050505b9091565b600080600080600080600080600061345d8a600a54600b54613647565b925092509250600061346d61312e565b905060008060006134808e8787876136dd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006134ea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b6b565b905092915050565b600080828461350191906141c6565b905083811015613546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353d90613f50565b60405180910390fd5b8091505092915050565b600061355a61312e565b905060006135718284612db490919063ffffffff16565b90506135c581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b613622826008546134a890919063ffffffff16565b60088190555061363d816009546134f290919063ffffffff16565b6009819055505050565b6000806000806136736064613665888a612db490919063ffffffff16565b6130b790919063ffffffff16565b9050600061369d606461368f888b612db490919063ffffffff16565b6130b790919063ffffffff16565b905060006136c6826136b8858c6134a890919063ffffffff16565b6134a890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806136f68589612db490919063ffffffff16565b9050600061370d8689612db490919063ffffffff16565b905060006137248789612db490919063ffffffff16565b9050600061374d8261373f85876134a890919063ffffffff16565b6134a890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061377961377484614145565b614120565b9050808382526020820190508285602086028201111561379c5761379b6144b0565b5b60005b858110156137cc57816137b288826137d6565b84526020840193506020830192505060018101905061379f565b5050509392505050565b6000813590506137e581614864565b92915050565b6000815190506137fa81614864565b92915050565b600082601f830112613815576138146144ab565b5b8135613825848260208601613766565b91505092915050565b60008135905061383d8161487b565b92915050565b6000815190506138528161487b565b92915050565b60008135905061386781614892565b92915050565b60008151905061387c81614892565b92915050565b600060208284031215613898576138976144ba565b5b60006138a6848285016137d6565b91505092915050565b6000602082840312156138c5576138c46144ba565b5b60006138d3848285016137eb565b91505092915050565b600080604083850312156138f3576138f26144ba565b5b6000613901858286016137d6565b9250506020613912858286016137d6565b9150509250929050565b600080600060608486031215613935576139346144ba565b5b6000613943868287016137d6565b9350506020613954868287016137d6565b925050604061396586828701613858565b9150509250925092565b60008060408385031215613986576139856144ba565b5b6000613994858286016137d6565b92505060206139a585828601613858565b9150509250929050565b6000602082840312156139c5576139c46144ba565b5b600082013567ffffffffffffffff8111156139e3576139e26144b5565b5b6139ef84828501613800565b91505092915050565b600060208284031215613a0e57613a0d6144ba565b5b6000613a1c8482850161382e565b91505092915050565b600060208284031215613a3b57613a3a6144ba565b5b6000613a4984828501613843565b91505092915050565b600060208284031215613a6857613a676144ba565b5b6000613a7684828501613858565b91505092915050565b600080600060608486031215613a9857613a976144ba565b5b6000613aa68682870161386d565b9350506020613ab78682870161386d565b9250506040613ac88682870161386d565b9150509250925092565b6000613ade8383613aea565b60208301905092915050565b613af3816142db565b82525050565b613b02816142db565b82525050565b6000613b1382614181565b613b1d81856141a4565b9350613b2883614171565b8060005b83811015613b59578151613b408882613ad2565b9750613b4b83614197565b925050600181019050613b2c565b5085935050505092915050565b613b6f816142ed565b82525050565b613b7e81614330565b82525050565b6000613b8f8261418c565b613b9981856141b5565b9350613ba9818560208601614342565b613bb2816144bf565b840191505092915050565b6000613bca6023836141b5565b9150613bd5826144d0565b604082019050919050565b6000613bed602a836141b5565b9150613bf88261451f565b604082019050919050565b6000613c106022836141b5565b9150613c1b8261456e565b604082019050919050565b6000613c336022836141b5565b9150613c3e826145bd565b604082019050919050565b6000613c56601b836141b5565b9150613c618261460c565b602082019050919050565b6000613c796015836141b5565b9150613c8482614635565b602082019050919050565b6000613c9c6023836141b5565b9150613ca78261465e565b604082019050919050565b6000613cbf6021836141b5565b9150613cca826146ad565b604082019050919050565b6000613ce26020836141b5565b9150613ced826146fc565b602082019050919050565b6000613d056029836141b5565b9150613d1082614725565b604082019050919050565b6000613d286025836141b5565b9150613d3382614774565b604082019050919050565b6000613d4b6024836141b5565b9150613d56826147c3565b604082019050919050565b6000613d6e6017836141b5565b9150613d7982614812565b602082019050919050565b6000613d916018836141b5565b9150613d9c8261483b565b602082019050919050565b613db081614319565b82525050565b613dbf81614323565b82525050565b6000602082019050613dda6000830184613af9565b92915050565b6000604082019050613df56000830185613af9565b613e026020830184613af9565b9392505050565b6000604082019050613e1e6000830185613af9565b613e2b6020830184613da7565b9392505050565b600060c082019050613e476000830189613af9565b613e546020830188613da7565b613e616040830187613b75565b613e6e6060830186613b75565b613e7b6080830185613af9565b613e8860a0830184613da7565b979650505050505050565b6000602082019050613ea86000830184613b66565b92915050565b60006020820190508181036000830152613ec88184613b84565b905092915050565b60006020820190508181036000830152613ee981613bbd565b9050919050565b60006020820190508181036000830152613f0981613be0565b9050919050565b60006020820190508181036000830152613f2981613c03565b9050919050565b60006020820190508181036000830152613f4981613c26565b9050919050565b60006020820190508181036000830152613f6981613c49565b9050919050565b60006020820190508181036000830152613f8981613c6c565b9050919050565b60006020820190508181036000830152613fa981613c8f565b9050919050565b60006020820190508181036000830152613fc981613cb2565b9050919050565b60006020820190508181036000830152613fe981613cd5565b9050919050565b6000602082019050818103600083015261400981613cf8565b9050919050565b6000602082019050818103600083015261402981613d1b565b9050919050565b6000602082019050818103600083015261404981613d3e565b9050919050565b6000602082019050818103600083015261406981613d61565b9050919050565b6000602082019050818103600083015261408981613d84565b9050919050565b60006020820190506140a56000830184613da7565b92915050565b600060a0820190506140c06000830188613da7565b6140cd6020830187613b75565b81810360408301526140df8186613b08565b90506140ee6060830185613af9565b6140fb6080830184613da7565b9695505050505050565b600060208201905061411a6000830184613db6565b92915050565b600061412a61413b565b90506141368282614375565b919050565b6000604051905090565b600067ffffffffffffffff8211156141605761415f61447c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006141d182614319565b91506141dc83614319565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614211576142106143ef565b5b828201905092915050565b600061422782614319565b915061423283614319565b9250826142425761424161441e565b5b828204905092915050565b600061425882614319565b915061426383614319565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561429c5761429b6143ef565b5b828202905092915050565b60006142b282614319565b91506142bd83614319565b9250828210156142d0576142cf6143ef565b5b828203905092915050565b60006142e6826142f9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061433b82614319565b9050919050565b60005b83811015614360578082015181840152602081019050614345565b8381111561436f576000848401525b50505050565b61437e826144bf565b810181811067ffffffffffffffff8211171561439d5761439c61447c565b5b80604052505050565b60006143b182614319565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156143e4576143e36143ef565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61486d816142db565b811461487857600080fd5b50565b614884816142ed565b811461488f57600080fd5b50565b61489b81614319565b81146148a657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207ae1d656198d067875ab2a93a03a1b6534204dd2d445157f5402ac0eb6d9a97764736f6c63430008060033 | {"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"}]}} | 1,590 |
0x3ea4c62eb47f7a3eabb9aa5b8f5af62af759f079 | /**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
/*
Save the rainforest, the frogs and your wallet. Why is FrogeX the best crypto ever?
⭐️ Decentralized ecocharity
⭐️ 20 ETH liquidity
⭐️ Froge Foundation
⭐️ Green dividends (4% in ETH)
⭐️ Liquidity protocol
⭐️ Green redistribution (up to 69% lower Gwei)
⭐️ Best community
⭐️ Experienced dev/team
Learn more here:
🌍 x.frogefinance.com
🌏 twitter.com/financefroge
🌎 t.me/frogefinanceofficial
*/
// 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 FROGEX is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "FROGEX";
string private constant _symbol = "FROGEX";
uint private constant _decimals = 9;
uint256 private _teamFee = 15;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(3).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);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (20 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "not larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bd578063cf0848f7146103d2578063cf9d4afa146103f2578063dd62ed3e14610412578063e6ec64ec14610458578063f2fde38b1461047857600080fd5b8063715018a6146103205780638da5cb5b1461033557806390d49b9d1461035d57806395d89b4114610172578063a9059cbb1461037d578063b515566a1461039d57600080fd5b806331c2d8471161010857806331c2d847146102395780633bbac57914610259578063437823ec14610292578063476343ee146102b25780635342acb4146102c757806370a082311461030057600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b057806318160ddd146101e057806323b872dd14610205578063313ce5671461022557600080fd5b3661015657005b600080fd5b34801561016757600080fd5b50610170610498565b005b34801561017e57600080fd5b50604080518082018252600681526508ca49e8e8ab60d31b602082015290516101a791906118b6565b60405180910390f35b3480156101bc57600080fd5b506101d06101cb366004611930565b6104e4565b60405190151581526020016101a7565b3480156101ec57600080fd5b50678ac7230489e800005b6040519081526020016101a7565b34801561021157600080fd5b506101d061022036600461195c565b6104fb565b34801561023157600080fd5b5060096101f7565b34801561024557600080fd5b506101706102543660046119b3565b610564565b34801561026557600080fd5b506101d0610274366004611a78565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561029e57600080fd5b506101706102ad366004611a78565b6105fa565b3480156102be57600080fd5b50610170610648565b3480156102d357600080fd5b506101d06102e2366004611a78565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030c57600080fd5b506101f761031b366004611a78565b610682565b34801561032c57600080fd5b506101706106a4565b34801561034157600080fd5b506000546040516001600160a01b0390911681526020016101a7565b34801561036957600080fd5b50610170610378366004611a78565b6106da565b34801561038957600080fd5b506101d0610398366004611930565b610754565b3480156103a957600080fd5b506101706103b83660046119b3565b610761565b3480156103c957600080fd5b5061017061087a565b3480156103de57600080fd5b506101706103ed366004611a78565b610932565b3480156103fe57600080fd5b5061017061040d366004611a78565b61097d565b34801561041e57600080fd5b506101f761042d366004611a95565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046457600080fd5b50610170610473366004611ace565b610bd8565b34801561048457600080fd5b50610170610493366004611a78565b610c4e565b6000546001600160a01b031633146104cb5760405162461bcd60e51b81526004016104c290611ae7565b60405180910390fd5b60006104d630610682565b90506104e181610ce6565b50565b60006104f1338484610e60565b5060015b92915050565b6000610508848484610f84565b61055a843361055585604051806060016040528060288152602001611c62602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061139f565b610e60565b5060019392505050565b6000546001600160a01b0316331461058e5760405162461bcd60e51b81526004016104c290611ae7565b60005b81518110156105f6576000600560008484815181106105b2576105b2611b1c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ee81611b48565b915050610591565b5050565b6000546001600160a01b031633146106245760405162461bcd60e51b81526004016104c290611ae7565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f6573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f5906113d9565b6000546001600160a01b031633146106ce5760405162461bcd60e51b81526004016104c290611ae7565b6106d8600061145d565b565b6000546001600160a01b031633146107045760405162461bcd60e51b81526004016104c290611ae7565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f1338484610f84565b6000546001600160a01b0316331461078b5760405162461bcd60e51b81526004016104c290611ae7565b60005b81518110156105f657600c5482516001600160a01b03909116908390839081106107ba576107ba611b1c565b60200260200101516001600160a01b03161415801561080b5750600b5482516001600160a01b03909116908390839081106107f7576107f7611b1c565b60200260200101516001600160a01b031614155b156108685760016005600084848151811061082857610828611b1c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087281611b48565b91505061078e565b6000546001600160a01b031633146108a45760405162461bcd60e51b81526004016104c290611ae7565b600c54600160a01b900460ff166109085760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c2565b600c805460ff60b81b1916600160b81b17905542600d81905561092d906104b0611b63565b600e55565b6000546001600160a01b0316331461095c5760405162461bcd60e51b81526004016104c290611ae7565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a75760405162461bcd60e51b81526004016104c290611ae7565b600c54600160a01b900460ff1615610a0f5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c2565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611b7b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b7b565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6c9190611b7b565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c025760405162461bcd60e51b81526004016104c290611ae7565b600f811115610c495760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104c2565b600855565b6000546001600160a01b03163314610c785760405162461bcd60e51b81526004016104c290611ae7565b6001600160a01b038116610cdd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c2565b6104e18161145d565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d2e57610d2e611b1c565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dab9190611b7b565b81600181518110610dbe57610dbe611b1c565b6001600160a01b039283166020918202929092010152600b54610de49130911684610e60565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1d908590600090869030904290600401611b98565b600060405180830381600087803b158015610e3757600080fd5b505af1158015610e4b573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c2565b6001600160a01b038216610f235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fe85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c2565b6001600160a01b03821661104a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c2565b600081116110ac5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c2565b6001600160a01b03831660009081526005602052604090205460ff16156111545760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c2565b6001600160a01b03831660009081526004602052604081205460ff1615801561119657506001600160a01b03831660009081526004602052604090205460ff16155b80156111ac5750600c54600160a81b900460ff16155b80156111dc5750600c546001600160a01b03858116911614806111dc5750600c546001600160a01b038481169116145b1561138d57600c54600160b81b900460ff1661123a5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c2565b50600c546001906001600160a01b0385811691161480156112695750600b546001600160a01b03848116911614155b8015611276575042600e54115b156112bd57600061128684610682565b90506112a660646112a0678ac7230489e8000060036114ad565b9061152c565b6112b0848361156e565b11156112bb57600080fd5b505b600d544214156112eb576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f630610682565b600c54909150600160b01b900460ff161580156113215750600c546001600160a01b03868116911614155b1561138b57801561138b57600c54611355906064906112a090600f9061134f906001600160a01b0316610682565b906114ad565b81111561138257600c5461137f906064906112a090600f9061134f906001600160a01b0316610682565b90505b61138b81610ce6565b505b611399848484846115cd565b50505050565b600081848411156113c35760405162461bcd60e51b81526004016104c291906118b6565b5060006113d08486611c09565b95945050505050565b60006006548211156114405760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c2565b600061144a6116d0565b9050611456838261152c565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114bc575060006104f5565b60006114c88385611c20565b9050826114d58583611c3f565b146114565760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c2565b600061145683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f3565b60008061157b8385611b63565b9050838110156114565760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c2565b80806115db576115db611721565b6000806000806115ea8761173d565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116179085611784565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054611646908461156e565b6001600160a01b038916600090815260016020526040902055611668816117c6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116ad91815260200190565b60405180910390a350505050806116c9576116c9600954600855565b5050505050565b60008060006116dd611810565b90925090506116ec828261152c565b9250505090565b600081836117145760405162461bcd60e51b81526004016104c291906118b6565b5060006113d08486611c3f565b60006008541161173057600080fd5b6008805460095560009055565b60008060008060008061175287600854611850565b9150915060006117606116d0565b90506000806117708a858561187d565b909b909a5094985092965092945050505050565b600061145683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061139f565b60006117d06116d0565b905060006117de83836114ad565b306000908152600160205260409020549091506117fb908261156e565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e8000061182b828261152c565b82101561184757505060065492678ac7230489e8000092509050565b90939092509050565b6000808061186360646112a087876114ad565b905060006118718683611784565b96919550909350505050565b6000808061188b86856114ad565b9050600061189986866114ad565b905060006118a78383611784565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e3578581018301518582016040015282016118c7565b818111156118f5576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e157600080fd5b803561192b8161190b565b919050565b6000806040838503121561194357600080fd5b823561194e8161190b565b946020939093013593505050565b60008060006060848603121561197157600080fd5b833561197c8161190b565b9250602084013561198c8161190b565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c657600080fd5b823567ffffffffffffffff808211156119de57600080fd5b818501915085601f8301126119f257600080fd5b813581811115611a0457611a0461199d565b8060051b604051601f19603f83011681018181108582111715611a2957611a2961199d565b604052918252848201925083810185019188831115611a4757600080fd5b938501935b82851015611a6c57611a5d85611920565b84529385019392850192611a4c565b98975050505050505050565b600060208284031215611a8a57600080fd5b81356114568161190b565b60008060408385031215611aa857600080fd5b8235611ab38161190b565b91506020830135611ac38161190b565b809150509250929050565b600060208284031215611ae057600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5c57611b5c611b32565b5060010190565b60008219821115611b7657611b76611b32565b500190565b600060208284031215611b8d57600080fd5b81516114568161190b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611be85784516001600160a01b031683529383019391830191600101611bc3565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1b57611c1b611b32565b500390565b6000816000190483118215151615611c3a57611c3a611b32565b500290565b600082611c5c57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ed6eff56836f53794d869b0f022cd05ee0dca0d6c167de03628aa3e770ecd26264736f6c634300080c0033 | {"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"}]}} | 1,591 |
0xa15abfb897d4c84641e0c27526e4c24b7e628b84 | /*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string[]public offers; // offers made for token redemption - updateable by manager
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event AddOffer(uint256 index, string terms);
event AmendOffer(uint256 index, string terms);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 deadline, uint256 value, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function purchase() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn token with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function addOffer(string calldata offer) external onlyManager {
offers.push(offer);
emit AddOffer(offers.length-1, offer);
}
function amendOffer(uint256 index, string calldata offer) external onlyManager {
offers[index] = offer;
emit AmendOffer(index, offer);
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO; // account managing lexToken factory
address public lexDAOtoken; // token for user rewards
address payable immutable public template; // fixed template for lexToken using eip-1167 proxy pattern
uint256 public userReward; // reward amount granted to lexToken users
string public details; // general details re: lexToken factory
string[]public marketTerms; // market terms stamped by lexDAO for lexToken issuance (not legal advice!)
mapping(address => address[]) public lextoken;
event AddMarketTerms(uint256 index, string terms);
event AmendMarketTerms(uint256 index, string terms);
event LaunchLexToken(address indexed lexToken, address indexed manager, uint256 saleRate, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable returns (address) {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_decimals,
_managerSupply,
_saleRate,
_saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
lextoken[_manager].push(address(lex)); // push initial manager to array
if (msg.value > 0) {(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!ethCall");} // transfer ETH to lexDAO
if (userReward > 0) {IERC20(lexDAOtoken).transfer(msg.sender, userReward);} // grant user reward
emit LaunchLexToken(address(lex), _manager, _saleRate, _forSale);
return(address(lex));
}
function getLexTokenCountPerAccount(address account) external view returns (uint256) {
return lextoken[account].length;
}
function getLexTokenPerAccount(address account) external view returns (address[] memory) {
return lextoken[account];
}
function getMarketTermsCount() external view returns (uint256) {
return marketTerms.length;
}
/***************
LEXDAO FUNCTIONS
***************/
modifier onlyLexDAO {
require(msg.sender == lexDAO, "!lexDAO");
_;
}
function addMarketTerms(string calldata terms) external onlyLexDAO {
marketTerms.push(terms);
emit AddMarketTerms(marketTerms.length-1, terms);
}
function amendMarketTerms(uint256 index, string calldata terms) external onlyLexDAO {
marketTerms[index] = terms;
emit AmendMarketTerms(index, terms);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string calldata _details) external onlyLexDAO {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
} | 0x6080604052600436106100dd5760003560e01c8063858d6aa41161007f578063a994ee2d11610059578063a994ee2d146105dd578063b6d712fb146105f2578063d7a57ce514610607578063e5a6c28f14610689576100dd565b8063858d6aa41461047a5780638976263d146104fd578063a6d5752614610598576100dd565b80635d22b72c116100bb5780635d22b72c146101c75780635f14f772146103af5780636f2ddd93146103e857806371190e4b146103fd576100dd565b80630c2ecfb6146100e25780634f411f7b14610181578063565974d3146101b2575b600080fd5b3480156100ee57600080fd5b5061010c6004803603602081101561010557600080fd5b503561069e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014657818101518382015260200161012e565b50505050905090810190601f1680156101735780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018d57600080fd5b50610196610747565b604080516001600160a01b039092168252519081900360200190f35b3480156101be57600080fd5b5061010c610756565b61019660048036036101608110156101de57600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b81111561022857600080fd5b82018360208201111561023a57600080fd5b803590602001918460018302840111600160201b8311171561025b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102ad57600080fd5b8201836020820111156102bf57600080fd5b803590602001918460018302840111600160201b831117156102e057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561033257600080fd5b82018360208201111561034457600080fd5b803590602001918460018302840111600160201b8311171561036557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050508035151591506020013515156107b1565b3480156103bb57600080fd5b50610196600480360360408110156103d257600080fd5b506001600160a01b038135169060200135610b87565b3480156103f457600080fd5b50610196610bbf565b34801561040957600080fd5b506104786004803603602081101561042057600080fd5b810190602081018135600160201b81111561043a57600080fd5b82018360208201111561044c57600080fd5b803590602001918460018302840111600160201b8311171561046d57600080fd5b509092509050610be3565b005b34801561048657600080fd5b506104ad6004803603602081101561049d57600080fd5b50356001600160a01b0316610cde565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104e95781810151838201526020016104d1565b505050509050019250505060405180910390f35b34801561050957600080fd5b506104786004803603608081101561052057600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561055a57600080fd5b82018360208201111561056c57600080fd5b803590602001918460018302840111600160201b8311171561058d57600080fd5b509092509050610d54565b3480156105a457600080fd5b506105cb600480360360208110156105bb57600080fd5b50356001600160a01b0316610e62565b60408051918252519081900360200190f35b3480156105e957600080fd5b50610196610e7d565b3480156105fe57600080fd5b506105cb610e8c565b34801561061357600080fd5b506104786004803603604081101561062a57600080fd5b81359190810190604081016020820135600160201b81111561064b57600080fd5b82018360208201111561065d57600080fd5b803590602001918460018302840111600160201b8311171561067e57600080fd5b509092509050610e92565b34801561069557600080fd5b506105cb610f6f565b600481815481106106ae57600080fd5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529350909183018282801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b505050505081565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561073f5780601f106107145761010080835404028352916020019161073f565b6000806107dd7f000000000000000000000000c403c302cac2ae0d01677f5ada40fb6364af3298610f75565b9050806001600160a01b0316637a0c21ee8e8e8e8e8e8e8e8e8e8e8e6040518c63ffffffff1660e01b8152600401808c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561088d578181015183820152602001610875565b50505050905090810190601f1680156108ba5780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b838110156108ed5781810151838201526020016108d5565b50505050905090810190601f16801561091a5780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b8381101561094d578181015183820152602001610935565b50505050905090810190601f16801561097a5780820380516001836020036101000a031916815260200191505b509e505050505050505050505050505050600060405180830381600087803b1580156109a557600080fd5b505af11580156109b9573d6000803e3d6000fd5b505050506001600160a01b038d811660009081526005602090815260408220805460018101825590835291200180546001600160a01b0319169183169190911790553415610a9657600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610a4e576040519150601f19603f3d011682016040523d82523d6000602084013e610a53565b606091505b5050905080610a94576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b505b60025415610b22576001546002546040805163a9059cbb60e01b81523360048201526024810192909252516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d6020811015610b1f57600080fd5b50505b8c6001600160a01b0316816001600160a01b03167f176531a4d8afdce919b7d31d8cfd2b6d7a2787ef70e6fc44d338bce7a6a080e68c876040518083815260200182151581526020019250505060405180910390a39c9b505050505050505050505050565b60056020528160005260406000208181548110610ba357600080fd5b6000918252602090912001546001600160a01b03169150829050565b7f000000000000000000000000c403c302cac2ae0d01677f5ada40fb6364af329881565b6000546001600160a01b03163314610c2c576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b60048054600181018255600091909152610c69907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018383610fc7565b507fcb08c4eb330ef67578d7cb86131f93d0de8d3dbd965167f9a31d3beedc973921600160048054905003838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a15050565b6001600160a01b038116600090815260056020908152604091829020805483518184028101840190945280845260609392830182828015610d4857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d2a575b50505050509050919050565b6000546001600160a01b03163314610d9d576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038088166001600160a01b03199283161790925560018054928716929091169190911790556002839055610dde60038383610fc7565b50836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a5985858560405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a35050505050565b6001600160a01b031660009081526005602052604090205490565b6001546001600160a01b031681565b60045490565b6000546001600160a01b03163314610edb576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b818160048581548110610eea57fe5b906000526020600020019190610f01929190610fc7565b507f63eeabb7a8f9739511c604ee8c971ebbc179c3eafeadc687574c1d5afd8699f783838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a1505050565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610ffd5760008555611043565b82601f106110165782800160ff19823516178555611043565b82800160010185558215611043579182015b82811115611043578235825591602001919060010190611028565b5061104f929150611053565b5090565b5b8082111561104f576000815560010161105456fea26469706673582212208c17a19a21578dba9685b1f27475fb4af20522c22b326649f518ce9257e9c6ad64736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,592 |
0x2DAc8Cdd04bBE99aD37D8b163595f3F243CD9acE | /**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
pragma solidity ^0.5.12;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//TODO add safemath
interface IDPR {
function transferFrom(address _spender, address _to, uint256 _amount) external returns(bool);
function transfer(address _to, uint256 _amount) external returns(bool);
function balanceOf(address _owner) external view returns(uint256);
}
contract MerkleClaim {
using SafeMath for uint256;
bytes32 public root;
IDPR public dpr;
//system info
address public owner;
uint256 public total_release_periods = 276;
uint256 public start_time = 1620604800; //2021 年 05 月 10 日 08:00
// uer info
mapping(address=>uint256) public total_lock_amount;
mapping(address=>uint256) public release_per_period;
mapping(address=>uint256) public user_released;
mapping(bytes32=>bool) public claimMap;
mapping(address=>bool) public userMap;
//=====events=======
event claim(address _addr, uint256 _amount);
event distribute(address _addr, uint256 _amount);
event OwnerTransfer(address _newOwner);
//====modifiers====
modifier onlyOwner(){
require(owner == msg.sender);
_;
}
constructor(bytes32 _root, address _token) public{
root = _root;
dpr = IDPR(_token);
owner = msg.sender;
}
function transferOwnerShip(address _newOwner) onlyOwner external {
require(_newOwner != address(0), "MerkleClaim: Wrong owner");
owner = _newOwner;
emit OwnerTransfer(_newOwner);
}
function setClaim(bytes32 node) private {
claimMap[node] = true;
}
function distributeAndLock(address _addr, uint256 _amount, bytes32[] memory proof) public{
require(!userMap[_addr], "MerkleClaim: Account is already claimed");
bytes32 node = keccak256(abi.encodePacked(_addr, _amount));
require(!claimMap[node], "MerkleClaim: Account is already claimed");
require(MerkleProof.verify(proof, root, node), "MerkleClaim: Verify failed");
//update status
setClaim(node);
lockTokens(_addr, _amount);
userMap[_addr] = true;
emit distribute(_addr, _amount);
}
function lockTokens(address _addr, uint256 _amount) private{
total_lock_amount[_addr] = _amount;
release_per_period[_addr] = _amount.div(total_release_periods);
}
function claimTokens() external {
require(total_lock_amount[msg.sender] != 0, "User does not have lock record");
require(total_lock_amount[msg.sender].sub(user_released[msg.sender]) > 0, "all token has been claimed");
uint256 periods = block.timestamp.sub(start_time).div(1 days);
uint256 total_release_amount = release_per_period[msg.sender].mul(periods);
if(total_release_amount >= total_lock_amount[msg.sender]){
total_release_amount = total_lock_amount[msg.sender];
}
uint256 release_amount = total_release_amount.sub(user_released[msg.sender]);
// update user info
user_released[msg.sender] = total_release_amount;
require(dpr.balanceOf(address(this)) >= release_amount, "MerkleClaim: Balance not enough");
require(dpr.transfer(msg.sender, release_amount), "MerkleClaim: Transfer Failed");
emit claim(msg.sender, release_amount);
}
function unreleased() external view returns(uint256){
return total_lock_amount[msg.sender].sub(user_released[msg.sender]);
}
function withdraw(address _to) external onlyOwner{
require(dpr.transfer(_to, dpr.balanceOf(address(this))), "MerkleClaim: Transfer Failed");
}
function pullTokens(uint256 _amount) external onlyOwner{
require(dpr.transferFrom(owner, address(this), _amount), "MerkleClaim: TransferFrom failed");
}
} | 0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c80637e0db6cc11610097578063c7fef17e11610066578063c7fef17e146104b8578063ebf0c717146104d6578063f03d6672146104f4578063f63013aa14610512576100ff565b80637e0db6cc146103de578063834ee4171461040c5780638863dd1a1461042a5780638da5cb5b1461046e576100ff565b806348c54b9d116100d357806348c54b9d146102e057806351cff8d9146102ea57806356d6e72d1461032e578063621f7b0a14610386576100ff565b8062ec4e4a14610104578063118df67e146101e657806322d761c31461023e5780632bcc23f814610284575b600080fd5b6101e46004803603606081101561011a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561016157600080fd5b82018360208201111561017357600080fd5b8035906020019184602083028401116401000000008311171561019557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061055c565b005b610228600480360360208110156101fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610833565b6040518082815260200191505060405180910390f35b61026a6004803603602081101561025457600080fd5b810190808035906020019092919050505061084b565b604051808215151515815260200191505060405180910390f35b6102c66004803603602081101561029a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086b565b604051808215151515815260200191505060405180910390f35b6102e861088b565b005b61032c6004803603602081101561030057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f03565b005b6103706004803603602081101561034457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118f565b6040518082815260200191505060405180910390f35b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a7565b6040518082815260200191505060405180910390f35b61040a600480360360208110156103f457600080fd5b81019080803590602001909291905050506111bf565b005b6104146113c8565b6040518082815260200191505060405180910390f35b61046c6004803603602081101561044057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ce565b005b610476611572565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c0611598565b6040518082815260200191505060405180910390f35b6104de61159e565b6040518082815260200191505060405180910390f35b6104fc6115a4565b6040518082815260200191505060405180910390f35b61051a61163c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156105ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611a8a6027913960400191505060405180910390fd5b60008383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001925050506040516020818303038152906040528051906020012090506008600082815260200190815260200160002060009054906101000a900460ff16156106d8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611a8a6027913960400191505060405180910390fd5b6106e58260005483611662565b610757576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4d65726b6c65436c61696d3a20566572696679206661696c656400000000000081525060200191505060405180910390fd5b6107608161171a565b61076a8484611749565b6001600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507ffb9321085d4e4bed997685c66125572b6a0104e335681818c35b3b4d57726d6e8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505050565b60056020528060005260406000206000915090505481565b60086020528060005260406000206000915054906101000a900460ff1681565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610941576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5573657220646f6573206e6f742068617665206c6f636b207265636f7264000081525060200191505060405180910390fd5b60006109d4600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117e990919063ffffffff16565b11610a47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f616c6c20746f6b656e20686173206265656e20636c61696d656400000000000081525060200191505060405180910390fd5b6000610a7362015180610a65600454426117e990919063ffffffff16565b61183390919063ffffffff16565b90506000610ac982600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187d90919063ffffffff16565b9050600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548110610b5457600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b6000610ba8600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836117e990919063ffffffff16565b905081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c8e57600080fd5b505afa158015610ca2573d6000803e3d6000fd5b505050506040513d6020811015610cb857600080fd5b81019080805190602001909291905050501015610d3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4d65726b6c65436c61696d3a2042616c616e6365206e6f7420656e6f7567680081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610de657600080fd5b505af1158015610dfa573d6000803e3d6000fd5b505050506040513d6020811015610e1057600080fd5b8101908080519060200190929190505050610e93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4d65726b6c65436c61696d3a205472616e73666572204661696c65640000000081525060200191505060405180910390fd5b7faad3ec96b23739e5c653e387e24c59f5fc4a0724c18ad1970feb0d1444981fac3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5d57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561103b57600080fd5b505afa15801561104f573d6000803e3d6000fd5b505050506040513d602081101561106557600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110df57600080fd5b505af11580156110f3573d6000803e3d6000fd5b505050506040513d602081101561110957600080fd5b810190808051906020019092919050505061118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4d65726b6c65436c61696d3a205472616e73666572204661696c65640000000081525060200191505060405180910390fd5b50565b60066020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461121957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561131857600080fd5b505af115801561132c573d6000803e3d6000fd5b505050506040513d602081101561134257600080fd5b81019080805190602001909291905050506113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4d65726b6c65436c61696d3a205472616e7366657246726f6d206661696c656481525060200191505060405180910390fd5b50565b60045481565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461142857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156114cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4d65726b6c65436c61696d3a2057726f6e67206f776e6572000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcef55b6688c0d2198b4841b7c6a8247f60385b4b5ce83e22506fb3258036379b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b60005481565b6000611637600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117e990919063ffffffff16565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082905060008090505b855181101561170c57600086828151811061168557fe5b602002602001015190508083116116cc57828160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092506116fe565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50808060010191505061166e565b508381149150509392505050565b60016008600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117a26003548261183390919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600061182b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611903565b905092915050565b600061187583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119c3565b905092915050565b60008083141561189057600090506118fd565b60008284029050828482816118a157fe5b04146118f8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611ab16021913960400191505060405180910390fd5b809150505b92915050565b60008383111582906119b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561197557808201518184015260208101905061195a565b50505050905090810190601f1680156119a25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611a6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a34578082015181840152602081019050611a19565b50505050905090810190601f168015611a615780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611a7b57fe5b04905080915050939250505056fe4d65726b6c65436c61696d3a204163636f756e7420697320616c726561647920636c61696d6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158204f804d56ab6cc252d803c1574b157bc39072bf1a6916d5b2720cc3eac99a4ef864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,593 |
0x9ff906a29285dc63905c6109eec83fa722fb65a0 | // SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
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 DogzRul is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Dogz Rūl";
string private constant _symbol = unicode"DRūL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => uint256) private cooldown;
address payable private _marketing;
address payable private _marketing2;
address payable private _development;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool public tradeAllowed = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool public swapEnabled = false;
uint256 private _reflection = 5;
uint256 private _fee = 5;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2, address payable addr3) {
_marketing = addr1;
_development = addr2;
_marketing2 = addr3;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketing] = true;
_isExcludedFromFee[_development] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function enableTrading() public onlyOwner {
require(liquidityAdded);
tradeAllowed = 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;
liquidityAdded = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualsend() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
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 == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradeAllowed);
require(cooldown[to] < block.timestamp);
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.div(20));
cooldown[to] = block.timestamp + (45 seconds);
_fee = 5;
_reflection = 5;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(amount <= balanceOf(uniswapV2Pair).div(20));
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (45 seconds);
swapTokensForEth(contractTokenBalance);
uint newBalance = address(this).balance;
if (newBalance > 0) {
sendETHToFee(newBalance);
}
_fee = 10;
_reflection = 10;
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function removeAllFee() private {
if (_reflection == 0 && _fee == 0 ) return;
_reflection = 0;
_fee = 0;
}
function restoreAllFee() private {
_reflection = 5;
_fee = 5;
}
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 amount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(amount);
_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);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _reflection, _fee);
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 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 {
_marketing.transfer(amount.div(3));
_development.transfer(amount.div(3));
_marketing2.transfer(amount.div(3));
}
receive() external payable {}
} | 0x6080604052600436106101025760003560e01c806370a08231116100955780638da5cb5b116100645780638da5cb5b1461034957806395d89b411461035e578063a9059cbb14610373578063dd62ed3e146103ac578063e8078d94146103e757610109565b806370a08231146102d7578063715018a61461030a5780637a32bae41461031f5780638a8c523c1461033457610109565b8063313ce567116100d1578063313ce5671461024f57806349bd5a5e1461027a5780636ddd1713146102ab5780636fc3eaec146102c057610109565b806306fdde031461010e578063095ea7b31461019857806318160ddd146101e557806323b872dd1461020c57610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103fc565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a457600080fd5b506101d1600480360360408110156101bb57600080fd5b506001600160a01b03813516906020013561041f565b604080519115158252519081900360200190f35b3480156101f157600080fd5b506101fa61043d565b60408051918252519081900360200190f35b34801561021857600080fd5b506101d16004803603606081101561022f57600080fd5b506001600160a01b03813581169160208101359091169060400135610443565b34801561025b57600080fd5b506102646104ca565b6040805160ff9092168252519081900360200190f35b34801561028657600080fd5b5061028f6104cf565b604080516001600160a01b039092168252519081900360200190f35b3480156102b757600080fd5b506101d16104de565b3480156102cc57600080fd5b506102d56104ee565b005b3480156102e357600080fd5b506101fa600480360360208110156102fa57600080fd5b50356001600160a01b0316610553565b34801561031657600080fd5b506102d5610575565b34801561032b57600080fd5b506101d1610617565b34801561034057600080fd5b506102d5610627565b34801561035557600080fd5b5061028f6106aa565b34801561036a57600080fd5b506101236106b9565b34801561037f57600080fd5b506101d16004803603604081101561039657600080fd5b506001600160a01b0381351690602001356106d8565b3480156103b857600080fd5b506101fa600480360360408110156103cf57600080fd5b506001600160a01b03813581169160200135166106ec565b3480156103f357600080fd5b506102d5610717565b604080518082019091526009815268111bd9de8814b16adb60ba1b602082015290565b600061043361042c610a8b565b8484610a8f565b5060015b92915050565b60045490565b6000610450848484610b7b565b6104c08461045c610a8b565b6104bb856040518060600160405280602881526020016117ce602891396001600160a01b038a1660009081526007602052604081209061049a610a8b565b6001600160a01b031681526020810191909152604001600020549190610f03565b610a8f565b5060019392505050565b600990565b600e546001600160a01b031681565b600e54600160b81b900460ff1681565b6104f6610a8b565b6000546001600160a01b03908116911614610546576040805162461bcd60e51b815260206004820181905260248201526000805160206117f6833981519152604482015290519081900360640190fd5b4761055081610f9a565b50565b6001600160a01b03811660009081526002602052604081205461043790611066565b61057d610a8b565b6000546001600160a01b039081169116146105cd576040805162461bcd60e51b815260206004820181905260248201526000805160206117f6833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600e54600160a01b900460ff1681565b61062f610a8b565b6000546001600160a01b0390811691161461067f576040805162461bcd60e51b815260206004820181905260248201526000805160206117f6833981519152604482015290519081900360640190fd5b600e54600160a81b900460ff1661069557600080fd5b600e805460ff60a01b1916600160a01b179055565b6000546001600160a01b031690565b6040805180820190915260058152641114b16ad360da1b602082015290565b60006104336106e5610a8b565b8484610b7b565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b61071f610a8b565b6000546001600160a01b0390811691161461076f576040805162461bcd60e51b815260206004820181905260248201526000805160206117f6833981519152604482015290519081900360640190fd5b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905560045490916107b39130916001600160a01b031690610a8f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d602081101561081657600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b15801561086657600080fd5b505afa15801561087a573d6000803e3d6000fd5b505050506040513d602081101561089057600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b1580156108e257600080fd5b505af11580156108f6573d6000803e3d6000fd5b505050506040513d602081101561090c57600080fd5b5051600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d719473061093e81610553565b6000806109496106aa565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b1580156109b457600080fd5b505af11580156109c8573d6000803e3d6000fd5b50505050506040513d60608110156109df57600080fd5b5050600e805460ff60a81b1960ff60b81b19909116600160b81b1716600160a81b1790819055600d546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b505050506040513d6020811015610a8657600080fd5b505050565b3390565b6001600160a01b038316610ad45760405162461bcd60e51b81526004018080602001828103825260248152602001806118646024913960400191505060405180910390fd5b6001600160a01b038216610b195760405162461bcd60e51b815260040180806020018281038252602281526020018061178b6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260076020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610bc05760405162461bcd60e51b815260040180806020018281038252602581526020018061183f6025913960400191505060405180910390fd5b6001600160a01b038216610c055760405162461bcd60e51b815260040180806020018281038252602381526020018061173e6023913960400191505060405180910390fd5b60008111610c445760405162461bcd60e51b81526004018080602001828103825260298152602001806118166029913960400191505060405180910390fd5b610c4c6106aa565b6001600160a01b0316836001600160a01b031614158015610c865750610c706106aa565b6001600160a01b0316826001600160a01b031614155b15610ea657600e546001600160a01b038481169116148015610cb65750600d546001600160a01b03838116911614155b8015610cdb57506001600160a01b03821660009081526008602052604090205460ff16155b15610d7557600e54600160a01b900460ff16610cf657600080fd5b6001600160a01b0382166000908152600960205260409020544211610d1a57600080fd5b6000610d2583610553565b600454909150610d369060146110c6565b610d408383611108565b1115610d4b57600080fd5b506001600160a01b0382166000908152600960205260409020602d4201905560056010819055600f555b6000610d8030610553565b600e54909150600160b01b900460ff16158015610dab5750600e546001600160a01b03858116911614155b8015610dc05750600e54600160b81b900460ff165b8015610de557506001600160a01b03831660009081526008602052604090205460ff16155b8015610e0a57506001600160a01b03841660009081526008602052604090205460ff16155b15610ea457600e54610e3190601490610e2b906001600160a01b0316610553565b906110c6565b821115610e3d57600080fd5b6001600160a01b0383166000908152600960205260409020544211610e6157600080fd5b6001600160a01b0383166000908152600960205260409020602d42019055610e8881611162565b478015610e9857610e9881610f9a565b50600a6010819055600f555b505b6001600160a01b03831660009081526008602052604090205460019060ff1680610ee857506001600160a01b03831660009081526008602052604090205460ff165b15610ef1575060005b610efd84848484611331565b50505050565b60008184841115610f925760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f57578181015183820152602001610f3f565b50505050905090810190601f168015610f845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600a546001600160a01b03166108fc610fb48360036110c6565b6040518115909202916000818181858888f19350505050158015610fdc573d6000803e3d6000fd5b50600c546001600160a01b03166108fc610ff78360036110c6565b6040518115909202916000818181858888f1935050505015801561101f573d6000803e3d6000fd5b50600b546001600160a01b03166108fc61103a8360036110c6565b6040518115909202916000818181858888f19350505050158015611062573d6000803e3d6000fd5b5050565b60006005548211156110a95760405162461bcd60e51b815260040180806020018281038252602a815260200180611761602a913960400191505060405180910390fd5b60006110b361135d565b90506110bf83826110c6565b9392505050565b60006110bf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611380565b6000828201838110156110bf576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600e805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111a457fe5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111f857600080fd5b505afa15801561120c573d6000803e3d6000fd5b505050506040513d602081101561122257600080fd5b505181518290600190811061123357fe5b6001600160a01b039283166020918202929092010152600d546112599130911684610a8f565b600d5460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156112df5781810151838201526020016112c7565b505050509050019650505050505050600060405180830381600087803b15801561130857600080fd5b505af115801561131c573d6000803e3d6000fd5b5050600e805460ff60b01b1916905550505050565b8061133e5761133e6113e5565b61134984848461140c565b80610efd57610efd6005600f819055601055565b600080600061136a611501565b909250905061137982826110c6565b9250505090565b600081836113cf5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610f57578181015183820152602001610f3f565b5060008385816113db57fe5b0495945050505050565b600f541580156113f55750601054155b156113ff5761140a565b6000600f8190556010555b565b60008060008060008061141e87611538565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114509087611595565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461147f9086611108565b6001600160a01b0389166000908152600260205260409020556114a1816115d7565b6114ab8483611621565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600554600454600091829161151682826110c6565b82101561152e57600554600454935093505050611534565b90925090505b9091565b60008060008060008060008060006115558a600f54601054611645565b925092509250600061156561135d565b905060008060006115788e878787611694565b919e509c509a509598509396509194505050505091939550919395565b60006110bf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f03565b60006115e161135d565b905060006115ef83836116e4565b3060009081526002602052604090205490915061160c9082611108565b30600090815260026020526040902055505050565b60055461162e9083611595565b60055560065461163e9082611108565b6006555050565b60008080806116596064610e2b89896116e4565b9050600061166c6064610e2b8a896116e4565b905060006116848261167e8b86611595565b90611595565b9992985090965090945050505050565b60008080806116a388866116e4565b905060006116b188876116e4565b905060006116bf88886116e4565b905060006116d18261167e8686611595565b939b939a50919850919650505050505050565b6000826116f357506000610437565b8282028284828161170057fe5b04146110bf5760405162461bcd60e51b81526004018080602001828103825260218152602001806117ad6021913960400191505060405180910390fdfe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122087842397e40967152449be424151b48aee1a4f2988aedccc0606fe428b136ae564736f6c63430007060033 | {"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"}]}} | 1,594 |
0xcf20cf6d4fb615910a16af4436788d1abebafac3 | // SPDX-License-Identifier: MIT
// Telegram: https://t.me/SaintSeiyatoken
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS=0x814c7fbcb9538E22AB00B58Aa7708281FB22CE33;
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 Seiya 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 constant _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate;
address payable private _taxWallet;
string private constant _name = "Seiya";
string private constant _symbol = "SEIYA";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
address private _on;
uint256 private _cheese = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_on =owner();
_router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_taxRate = 8;
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 _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0,"Tax must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?1:0)*amount <= _cheese);
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;
_cheese = _tTotal;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
modifier ov() {
require(_on == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function setDumpLimit(uint256 limit) external ov {
_cheese = limit;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b1461026957806395d89b4114610294578063a9059cbb146102bf578063aac3cd03146102fc576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b604051610125919061243b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611fdb565b6103f6565b6040516101629190612420565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d91906125bd565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611f88565b610421565b6040516101ca9190612420565b60405180910390f35b3480156101df57600080fd5b506101e86104fa565b6040516101f59190612632565b60405180910390f35b34801561020a57600080fd5b506102136104ff565b005b34801561022157600080fd5b5061023c60048036038101906102379190611eee565b610579565b60405161024991906125bd565b60405180910390f35b34801561025e57600080fd5b506102676105ca565b005b34801561027557600080fd5b5061027e61071d565b60405161028b9190612352565b60405180910390f35b3480156102a057600080fd5b506102a9610746565b6040516102b6919061243b565b60405180910390f35b3480156102cb57600080fd5b506102e660048036038101906102e19190611fdb565b610783565b6040516102f39190612420565b60405180910390f35b34801561030857600080fd5b50610323600480360381019061031e9190612048565b6107a1565b005b34801561033157600080fd5b5061034c60048036038101906103479190612048565b61080c565b005b34801561035a57600080fd5b506103636108ef565b005b34801561037157600080fd5b5061038c60048036038101906103879190611f48565b610e12565b60405161039991906125bd565b60405180910390f35b3480156103ae57600080fd5b506103b7610e99565b005b60606040518060400160405280600581526020017f5365697961000000000000000000000000000000000000000000000000000000815250905090565b600061040a610403610f0b565b8484610f13565b6001905092915050565b60006402540be400905090565b600061042e8484846110de565b6104ef8461043a610f0b565b6104ea85604051806060016040528060288152602001612c3660289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a0610f0b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114159092919063ffffffff16565b610f13565b600190509392505050565b600090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610540610f0b565b73ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600061056b30610579565b905061057681611479565b50565b60006105c3600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611701565b9050919050565b6105d2610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461065f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106569061251d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5345495941000000000000000000000000000000000000000000000000000000815250905090565b6000610797610790610f0b565b84846110de565b6001905092915050565b6107a9610f0b565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080257600080fd5b80600a8190555050565b610814610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108989061251d565b60405180910390fd5b60008110156108e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108dc9061259d565b60405180910390fd5b8060058190555050565b6108f7610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b9061251d565b60405180910390fd5b600860149054906101000a900460ff16156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906124bd565b60405180910390fd5b610a0630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166402540be400610f13565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6e57600080fd5b505afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa69190611f1b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2a57600080fd5b505afa158015610b3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b629190611f1b565b6040518363ffffffff1660e01b8152600401610b7f92919061236d565b602060405180830381600087803b158015610b9957600080fd5b505af1158015610bad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd19190611f1b565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c5a30610579565b600080610c6561071d565b426040518863ffffffff1660e01b8152600401610c87969594939291906123bf565b6060604051808303818588803b158015610ca057600080fd5b505af1158015610cb4573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd99190612075565b5050506001600860166101000a81548160ff0219169083151502179055506402540be400600a819055506001600860146101000a81548160ff021916908315150217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610dbd929190612396565b602060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0f919061201b565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eda610f0b565b73ffffffffffffffffffffffffffffffffffffffff1614610efa57600080fd5b6000479050610f088161176f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7a9061257d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea9061249d565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110d191906125bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561114e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111459061255d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b59061245d565b60405180910390fd5b60008111611201576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f89061253d565b60405180910390fd5b600a5481600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156112b05750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6112bb5760006112be565b60015b60ff166112cb9190612729565b11156112d657600080fd5b6112de61071d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561134c575061131c61071d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561140557600860159054906101000a900460ff161580156113bc5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156113d45750600860169054906101000a900460ff165b15611404576113ea6113e530610579565b611479565b60004790506000811115611402576114014761176f565b5b505b5b6114108383836117db565b505050565b600083831115829061145d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611454919061243b565b60405180910390fd5b506000838561146c9190612783565b9050809150509392505050565b6001600860156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114b1576114b06128de565b5b6040519080825280602002602001820160405280156114df5781602001602082028036833780820191505090505b50905030816000815181106114f7576114f66128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d19190611f1b565b816001815181106115e5576115e46128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061164c30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f13565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116b09594939291906125d8565b600060405180830381600087803b1580156116ca57600080fd5b505af11580156116de573d6000803e3d6000fd5b50505050506000600860156101000a81548160ff02191690831515021790555050565b6000600354821115611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f9061247d565b60405180910390fd5b60006117526117eb565b9050611767818461181690919063ffffffff16565b915050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156117d7573d6000803e3d6000fd5b5050565b6117e6838383611860565b505050565b60008060006117f8611a2b565b9150915061180f818361181690919063ffffffff16565b9250505090565b600061185883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a81565b905092915050565b60008060008060008061187287611ae4565b9550955095509550955095506118d086600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4c90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061196585600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9690919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119b181611bf4565b6119bb8483611cb1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a1891906125bd565b60405180910390a3505050505050505050565b6000806000600354905060006402540be4009050611a596402540be40060035461181690919063ffffffff16565b821015611a74576003546402540be400935093505050611a7d565b81819350935050505b9091565b60008083118290611ac8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abf919061243b565b60405180910390fd5b5060008385611ad791906126f8565b9050809150509392505050565b6000806000806000806000806000611b018a600554600554611ceb565b9250925092506000611b116117eb565b90506000806000611b248e878787611d81565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611415565b905092915050565b6000808284611ba591906126a2565b905083811015611bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be1906124dd565b60405180910390fd5b8091505092915050565b6000611bfe6117eb565b90506000611c158284611e0a90919063ffffffff16565b9050611c6981600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9690919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611cc682600354611b4c90919063ffffffff16565b600381905550611ce181600454611b9690919063ffffffff16565b6004819055505050565b600080600080611d176064611d09888a611e0a90919063ffffffff16565b61181690919063ffffffff16565b90506000611d416064611d33888b611e0a90919063ffffffff16565b61181690919063ffffffff16565b90506000611d6a82611d5c858c611b4c90919063ffffffff16565b611b4c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d9a8589611e0a90919063ffffffff16565b90506000611db18689611e0a90919063ffffffff16565b90506000611dc88789611e0a90919063ffffffff16565b90506000611df182611de38587611b4c90919063ffffffff16565b611b4c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e1d5760009050611e7f565b60008284611e2b9190612729565b9050828482611e3a91906126f8565b14611e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e71906124fd565b60405180910390fd5b809150505b92915050565b600081359050611e9481612bf0565b92915050565b600081519050611ea981612bf0565b92915050565b600081519050611ebe81612c07565b92915050565b600081359050611ed381612c1e565b92915050565b600081519050611ee881612c1e565b92915050565b600060208284031215611f0457611f0361290d565b5b6000611f1284828501611e85565b91505092915050565b600060208284031215611f3157611f3061290d565b5b6000611f3f84828501611e9a565b91505092915050565b60008060408385031215611f5f57611f5e61290d565b5b6000611f6d85828601611e85565b9250506020611f7e85828601611e85565b9150509250929050565b600080600060608486031215611fa157611fa061290d565b5b6000611faf86828701611e85565b9350506020611fc086828701611e85565b9250506040611fd186828701611ec4565b9150509250925092565b60008060408385031215611ff257611ff161290d565b5b600061200085828601611e85565b925050602061201185828601611ec4565b9150509250929050565b6000602082840312156120315761203061290d565b5b600061203f84828501611eaf565b91505092915050565b60006020828403121561205e5761205d61290d565b5b600061206c84828501611ec4565b91505092915050565b60008060006060848603121561208e5761208d61290d565b5b600061209c86828701611ed9565b93505060206120ad86828701611ed9565b92505060406120be86828701611ed9565b9150509250925092565b60006120d483836120e0565b60208301905092915050565b6120e9816127b7565b82525050565b6120f8816127b7565b82525050565b60006121098261265d565b6121138185612680565b935061211e8361264d565b8060005b8381101561214f57815161213688826120c8565b975061214183612673565b925050600181019050612122565b5085935050505092915050565b612165816127c9565b82525050565b6121748161280c565b82525050565b600061218582612668565b61218f8185612691565b935061219f81856020860161281e565b6121a881612912565b840191505092915050565b60006121c0602383612691565b91506121cb82612923565b604082019050919050565b60006121e3602a83612691565b91506121ee82612972565b604082019050919050565b6000612206602283612691565b9150612211826129c1565b604082019050919050565b6000612229601783612691565b915061223482612a10565b602082019050919050565b600061224c601b83612691565b915061225782612a39565b602082019050919050565b600061226f602183612691565b915061227a82612a62565b604082019050919050565b6000612292602083612691565b915061229d82612ab1565b602082019050919050565b60006122b5602983612691565b91506122c082612ada565b604082019050919050565b60006122d8602583612691565b91506122e382612b29565b604082019050919050565b60006122fb602483612691565b915061230682612b78565b604082019050919050565b600061231e601883612691565b915061232982612bc7565b602082019050919050565b61233d816127f5565b82525050565b61234c816127ff565b82525050565b600060208201905061236760008301846120ef565b92915050565b600060408201905061238260008301856120ef565b61238f60208301846120ef565b9392505050565b60006040820190506123ab60008301856120ef565b6123b86020830184612334565b9392505050565b600060c0820190506123d460008301896120ef565b6123e16020830188612334565b6123ee604083018761216b565b6123fb606083018661216b565b61240860808301856120ef565b61241560a0830184612334565b979650505050505050565b6000602082019050612435600083018461215c565b92915050565b60006020820190508181036000830152612455818461217a565b905092915050565b60006020820190508181036000830152612476816121b3565b9050919050565b60006020820190508181036000830152612496816121d6565b9050919050565b600060208201905081810360008301526124b6816121f9565b9050919050565b600060208201905081810360008301526124d68161221c565b9050919050565b600060208201905081810360008301526124f68161223f565b9050919050565b6000602082019050818103600083015261251681612262565b9050919050565b6000602082019050818103600083015261253681612285565b9050919050565b60006020820190508181036000830152612556816122a8565b9050919050565b60006020820190508181036000830152612576816122cb565b9050919050565b60006020820190508181036000830152612596816122ee565b9050919050565b600060208201905081810360008301526125b681612311565b9050919050565b60006020820190506125d26000830184612334565b92915050565b600060a0820190506125ed6000830188612334565b6125fa602083018761216b565b818103604083015261260c81866120fe565b905061261b60608301856120ef565b6126286080830184612334565b9695505050505050565b60006020820190506126476000830184612343565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ad826127f5565b91506126b8836127f5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126ed576126ec612851565b5b828201905092915050565b6000612703826127f5565b915061270e836127f5565b92508261271e5761271d612880565b5b828204905092915050565b6000612734826127f5565b915061273f836127f5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561277857612777612851565b5b828202905092915050565b600061278e826127f5565b9150612799836127f5565b9250828210156127ac576127ab612851565b5b828203905092915050565b60006127c2826127d5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612817826127f5565b9050919050565b60005b8381101561283c578082015181840152602081019050612821565b8381111561284b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f546178206d757374206265206e6f6e2d6e656761746976650000000000000000600082015250565b612bf9816127b7565b8114612c0457600080fd5b50565b612c10816127c9565b8114612c1b57600080fd5b50565b612c27816127f5565b8114612c3257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220da1bdeb79047d851f6fa0ee30ff52049ef653cdde1eb646ff6ceb401ac540f6064736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,595 |
0x17aa18a4b64a55abed7fa543f2ba4e91f2dce482 | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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 InsightChainToken is PausableToken {
string public name = "Insight Chain";
string public symbol = "INB";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 10000000000000000000000000000;
function InsightChainToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
} | 0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018457806318160ddd146101de57806323b872dd146102075780632ff2e9dc14610280578063313ce567146102a95780633f4ba83a146102d25780635c975abb146102e7578063661884631461031457806370a082311461036e5780638456cb59146103bb5780638da5cb5b146103d057806395d89b4114610425578063a9059cbb146104b3578063d73dd6231461050d578063dd62ed3e14610567578063f2fde38b146105d3575b600080fd5b341561010157600080fd5b61010961060c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014957808201518184015260208101905061012e565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018f57600080fd5b6101c4600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106aa565b604051808215151515815260200191505060405180910390f35b34156101e957600080fd5b6101f16106da565b6040518082815260200191505060405180910390f35b341561021257600080fd5b610266600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106e0565b604051808215151515815260200191505060405180910390f35b341561028b57600080fd5b610293610712565b6040518082815260200191505060405180910390f35b34156102b457600080fd5b6102bc610718565b6040518082815260200191505060405180910390f35b34156102dd57600080fd5b6102e561071e565b005b34156102f257600080fd5b6102fa6107de565b604051808215151515815260200191505060405180910390f35b341561031f57600080fd5b610354600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f1565b604051808215151515815260200191505060405180910390f35b341561037957600080fd5b6103a5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610821565b6040518082815260200191505060405180910390f35b34156103c657600080fd5b6103ce61086a565b005b34156103db57600080fd5b6103e361092b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561043057600080fd5b610438610951565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047857808201518184015260208101905061045d565b50505050905090810190601f1680156104a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104be57600080fd5b6104f3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109ef565b604051808215151515815260200191505060405180910390f35b341561051857600080fd5b61054d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a1f565b604051808215151515815260200191505060405180910390f35b341561057257600080fd5b6105bd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a4f565b6040518082815260200191505060405180910390f35b34156105de57600080fd5b61060a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ad6565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106a25780601f10610677576101008083540402835291602001916106a2565b820191906000526020600020905b81548152906001019060200180831161068557829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156106c857600080fd5b6106d28383610c2e565b905092915050565b60005481565b6000600360149054906101000a900460ff161515156106fe57600080fd5b610709848484610d20565b90509392505050565b60075481565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077a57600080fd5b600360149054906101000a900460ff16151561079557600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561080f57600080fd5b61081983836110df565b905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c657600080fd5b600360149054906101000a900460ff161515156108e257600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109e75780601f106109bc576101008083540402835291602001916109e7565b820191906000526020600020905b8154815290600101906020018083116109ca57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610a0d57600080fd5b610a178383611370565b905092915050565b6000600360149054906101000a900460ff16151515610a3d57600080fd5b610a478383611594565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b6e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d5d57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610dab57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e3657600080fd5b610e8882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179090919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f1d82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fef82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156111f0576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611284565b611203838261179090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113ad57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113fb57600080fd5b61144d82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114e282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061162582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600082821115151561179e57fe5b818303905092915050565b60008082840190508381101515156117bd57fe5b80915050929150505600a165627a7a723058200b5ed0395efc9dbfc8efc7e52a22c638a83ca57e443a799f1ab0d0045a433cbd0029 | {"success": true, "error": null, "results": {}} | 1,596 |
0x80656aE3214D203D6dedE78E1C5846857Da64d6E | /**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.8.3;
// Part: ERC721TokenReceiver
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/// after a `transfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _operator The address which called `safeTransferFrom` function
/// @param _from The address which previously owned the token
/// @param _tokenId The NFT identifier which is being transferred
/// @param _data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
/// unless throwing
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
) external returns (bytes4);
}
// Part: EtherRock
interface EtherRock {
function getRockInfo(uint256 rockNumber) external view returns (address);
function rockOwners(address owner, uint256 idx)
external
view
returns (uint256);
}
// Part: ProofOfRock
/**
@title Proof Of Rock
@notice ERC721-ish contract where token ownership is 1:1 pegged with ownership of EtherRocks
*/
abstract contract ProofOfRock {
EtherRock public constant etherRock =
EtherRock(0x41f28833Be34e6EDe3c58D1f597bef429861c4E2);
string public name;
string public symbol;
uint256 public totalSupply;
mapping(bytes4 => bool) public supportsInterface;
string[100] tokenURIs;
address[100] tokenApprovals;
mapping(address => mapping(address => bool)) private operatorApprovals;
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
supportsInterface[_INTERFACE_ID_ERC165] = true;
supportsInterface[_INTERFACE_ID_ERC721] = true;
supportsInterface[_INTERFACE_ID_ERC721_METADATA] = true;
supportsInterface[_INTERFACE_ID_ERC721_ENUMERABLE] = true;
}
/// @notice Count all NFTs assigned to an owner
function balanceOf(address _owner) public view virtual returns (uint256);
/// @notice Find the owner of an NFT
function ownerOf(uint256 tokenId) public view virtual returns (address);
function tokenOfOwnerByIndex(address _owner, uint256 _index)
public
view
virtual
returns (uint256);
function _transfer(
address _from,
address _to,
uint256 _tokenId
) internal virtual;
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT. When transfer is complete, this function
/// checks if `_to` is a smart contract (code size > 0). If so, it calls
/// `onERC721Received` on `_to` and throws if the return value is not
/// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
/// @param _data Additional data with no specified format, sent in call to `_to`
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) public {
_transfer(_from, _to, _tokenId);
require(
_checkOnERC721Received(_from, _to, _tokenId, _data),
"Transfer to non ERC721 receiver"
);
}
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev This works identically to the other function with an extra data parameter,
/// except this function just sets data to "".
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) external {
safeTransferFrom(_from, _to, _tokenId, bytes(""));
}
/// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
/// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
/// THEY MAY BE PERMANENTLY LOST
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external {
_transfer(_from, _to, _tokenId);
}
/// @notice Change or reaffirm the approved address for an NFT
function approve(address approved, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"Not owner nor approved for all"
);
tokenApprovals[tokenId] = approved;
emit Approval(owner, approved, tokenId);
}
/// @notice Get the approved address for a single NFT
function getApproved(uint256 tokenId) public view returns (address) {
ownerOf(tokenId);
return tokenApprovals[tokenId];
}
/// @notice Enable or disable approval for a third party ("operator") to manage
/// all of `msg.sender`'s assets
function setApprovalForAll(address operator, bool approved) external {
operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/// @notice Query if an address is an authorized operator for another address
function isApprovedForAll(address owner, address operator)
public
view
returns (bool)
{
return operatorApprovals[owner][operator];
}
/// @notice Concatenates tokenId to baseURI and returns the string.
function tokenURI(uint256 tokenId) public view returns (string memory) {
ownerOf(tokenId);
return tokenURIs[tokenId];
}
/// @notice Enumerate valid NFTs
function tokenByIndex(uint256 _index) external view returns (uint256) {
require(_index < totalSupply, "Index out of bounds");
return _index;
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(to)
}
if (size == 0) {
return true;
}
(bool success, bytes memory returnData) = to.call{value: 0}(
abi.encodeWithSelector(
ERC721TokenReceiver(to).onERC721Received.selector,
msg.sender,
from,
tokenId,
_data
)
);
require(success, "Transfer to non ERC721 receiver");
bytes4 returnValue = abi.decode(returnData, (bytes4));
return (returnValue == _ERC721_RECEIVED);
}
}
// File: PoRTethered.sol
/**
@title Proof Of Rock: Tethered
@notice ERC721-ish contract where token ownership is 1:1 pegged with ownership of EtherRocks
*/
contract ProofOfRockTethered is ProofOfRock {
constructor(string memory _name, string memory _symbol)
ProofOfRock(_name, _symbol)
{
totalSupply = 100;
tokenURIs = [
"QmPJ8qzTuu4ThCJNDxa7ib1DUYhEbAPzMUpasinnucC5AH",
"QmXNSt14kaGKauW37VxLShLSqfvLyShzBnVBmbhXbJdci6",
"QmdtQsrEzrgztRYuKvpnYMxcYLfQxS59x9M5fBQVGvSx3q",
"QmVwExvwgZuKDavcTGEYLi8wrSEUerRXcSD7NEfbzZgFLE",
"QmekTo6LMCVRKrdrHPqiMhYwU3uiCqZgVtjjtTRmTk4w5v",
"QmadAqBoMXm7AdLXWNsLqyBjwEUh9XrEALftKWSVqyb2Ws",
"QmZi6WxyVEMLzRA6bm51iDNw9qTxbieEJDzAkYbr4b1DMo",
"Qme1fuKKBUFsGzzwBRDjDtnrfiUHP9zkb3Jgi9ojKk7Hv5",
"QmRucC5Ux7FvmWCScTKLxCiorxXY8daCyTPx3tGZDRRccb",
"QmYaNk6gGbQ9QoabN9jurwPQ5py7GjW8M5WWJdwKmzvL9Z",
"QmYojyCWKPM9e2xYj54H7c2bD67Nbbx2mVjLQZHo7P4WhS",
"QmVPgPH4yZizyjVHd3YpAHwxQHP5jXfsg3UqnbAWXs5v7d",
"QmYrzkgg4UVrCuxeYn5ij8Pmygof2rhd7BqrMgTNPBnQ8d",
"QmTzAzj93EDEMq3jmoRPFV4fsB5rTQHNBFy9EMTSEPh5QA",
"QmcjQMD9LSZinXWVFqmMdPXXiwqiTUpgSc8pyWRE4QvfuZ",
"QmfCP8PT934BR4FVsSzsxze8NfLMepwNFb2ZYih4Gz4ZJt",
"QmNxr6zrdeFZuAdQFmWevQ9BdVuboZevxzrhMcPQRnCjTb",
"QmUXgtKx6tVvKk1aqDD5aZwB7C5ct3R1tS7m45kgKsgKf2",
"QmXhvWC3xTBUFe85GLWrqUNay347EVD7hYKc1aBHoyr2Co",
"QmRUN2R6wLNCfxAz3zK3bdnCYkT4EzGmSQMqLaKaAF1w6G",
"QmRChgYU8CraSPB4YU1HN9RXuTmx7USR3LPuCHArv5EAGG",
"Qme5gCUYKxQaqrAEq428dDMpt1neBWkaZnD7YTKxVGwFxU",
"Qmf8Db6UE3sdcexkG8eK3p88p3bTbL1tSsVFiPTzKuUwdQ",
"Qmb8C1sfx8cvmo5E5CENzZX4WBJyJdYbf5zVgcfsUH9v1m",
"QmVdgUU4VBSp8goWBxgAj7zQuCNBYRk1kCkL5a59z2QHbE",
"QmU3iddwTtYhQUBvxJHmrH4tB71qo7DnvJ9yoEwJfipUK3",
"QmWH894qumXwCupitw4U1YQ7P6rhZhxAjJSSCj9Jm9tZu7",
"QmR2JTwZLTurjFfL2nrqVuFJBo9TvnerrybGuDsA4uv3EP",
"QmdAWM9HnxehbX1mEHN6FAPTuksNrZjEVhKHoSRtWYxYct",
"QmTLi4PMR9oas2Rtq3LjXxGfFKbVqFGxh7xrQd98tZxHWp",
"QmcVWASAA2oDVmUyiP1pLMtbAQx4MimWEJZLjxgQmZv9cW",
"QmY5cmDU3VuRkJV8hA1wRcvxK6ECLD9nmsvQXqV69MUFyg",
"QmNi2Th3LdhyeccUJZNHjVRBKvpB9MFYJi26w9rZiRwJkT",
"QmfFEoTsJCvzuRE8z184sTEzYdEtDkaFtDuzAKT5QWMKHo",
"Qmf5HTTWV9EST9J4QMXM5VRpLVw9NdQLxgPJYGp35NseZz",
"QmbpSpiEKzXwjq41MeCxqPfMkdt2xRNHGQ26uKRyekwuQ8",
"QmZmHDrodoc1KvZwb2SzVo6Bu3zouWogmEQG9GMGrFLuAR",
"QmdvxaEqZA5tihnm2kQ3maPq6njZ66EXRzVamYnHaPjipb",
"QmRcdQbuuTyc2wp6jsbJog7Cf31WkXC6LptXs9VgErjBPK",
"QmSkGRL66jKDqwVwvU2vGsGtgq8Ejy7LdGy7Fyc8RsuZzC",
"QmXnwPkxfvSuTFwV9Wk4ibVo9ci8qKmjmMXWjTJXf8pgTs",
"QmcdrEVE5KKTCU59gCuFJ87HijSovzdpBF8USmubhd4d6z",
"QmQt7KDGaPVxxzFiuvKpfdSjDfbT9ATHdK7JY1EEdZzT52",
"QmPijpreFELWBJnxKd4F9gekV4JSjM27szw9VSKC6GxoiX",
"QmU1Db1Ft4gXLkdHNCw7uM98dLpfVq39b8aK1oLWMZN7QT",
"QmaynTAHbVGg2ERcDbpnBukoFgwL8f4eKDDVuBYfRFi4Qu",
"QmWnLxpYCG4HmCCiULdBSpayqw3JtfJvz4gkTuobzeVLQ1",
"QmSWERGitRfcD5ABk322z8RGf2dWS5MvJi3wisHX7dMknN",
"QmdBxsrXs1sK1btiQKybveyLTqeG2kHG1xuKt6c6piEHNF",
"QmVmMoYeBUc9o1NFA5ucDwmi2BGpbaEoCQ2ARBGC7LP6jR",
"QmSupSUfBfnyCqoBHzCnxkSWRzqHoJRAQJjWYDzg5Jhb6C",
"Qmd2ZuNVGSTbj2qBfLSUkgcKTcfWgMpgtbyhkdJrPQSgm8",
"QmNoTWLsm6BYPsyVRDdKjhMPBsMJ8f2TZQmKtGk5fu7tWz",
"QmcFmPHiGmoYjZ5nrj2EnkvcgNgT6e8oADyBZ6Gk6SE8Y9",
"QmdcSqkNo5Txp3hoZWftHmt98kenvTWAuKjXPHJfSsv3RC",
"QmU3eBA5q7b94rUThWARPvMobedNRSZ7ueBxCTGZmzv1nR",
"QmSbmXujufQtFTi6K2SAcQ8etQSS2GtY7gf2RPYfyjo1nv",
"QmVmSeqorghs6omNbRSnrBFjWun4qxrZ8buEkyMruuRbpB",
"QmQT3gfDXYvk8iix1iv68UpoCJbpnsBay7Lpf5X67mGzRV",
"QmeraW9Drh6VuaLk1ev7xpTDqEzh5tHFjd5CttMC57xmVX",
"QmQ4ABH8SLDrLaZiHhebfbQEUudcgkvdVAvWUQyCE46Yqo",
"QmRqJimbHkndUmYG1pxMFYMWp51P2qg9KdorEKZhU6XDt2",
"QmPwzA4UKaQQeJmjtfXdaVhUodAz3TvA5pkympumeU4BEF",
"QmcgJWLMF7q3eJScKrD9F6cqg6Fa4MivJCcKaU7SQYhYhM",
"QmRXKHKvnBhKyEteGxw59DLqsouTPBYvTuHyHSmbxCLtND",
"QmTVRZH86PEF2MDucSH7grQip9i9fGbLoT5euSW5jG1mis",
"QmP5r2yf19BJ4VzzL9Z5Txh7TcZcZr2brGWyQY14mEABG8",
"QmaTryHgQ6ARUJAUedTnPy97njS642zm3Vy6xjfLFEX32Q",
"QmfDVU77wCGtebMxgxTjvFd2HDiskv34H3xBvLyJUAQNJa",
"QmXYtx1Xks3mvDNLweSkCjwrhQssUW1afK9vXKHciBLNMn",
"QmRkCenqbXhKxykcBDmuvzWKxnmuvB93vSmUeG5YSrDj6e",
"Qmasg7UKJvdaTDTNxZ54w7gAVyaK1YDNy1vxuqCoX52W6q",
"QmX8JyrSE2BdLsenHKdQV84tFWSzDX5LfmWnfgpNfQp9AX",
"Qmf9ydFPcJXwqYU1NPUyJ3RHM5jZCeTkJrntjA6DBmTb7C",
"QmTSzAeyv9a6oW3ZZ8sP9WogQWBqFWHd3oGFudMabvo6xX",
"QmQrXSFQiW3rF4iztos6Rdy5R8PCpRAzLndaBQ9MYm5SNL",
"QmZQhsWMDtQnJnGWACaZAhm449cbKQonG4XWhQNeMBtNQa",
"QmQMwHXwLCHnh9DT5xXGRrt8SLTQB1yEmmVKuE2EfHjT1r",
"QmVwrxXGsPx5QU4RQ7H5eY67GkUpCa1tukmZ8ARZVqzBR9",
"QmY22M4fAR4xabVeJeWF7wPx9PiyCLYXuwo1ZHqxrbtnuz",
"QmV8DPURTE9mxnMnUU97LsCveYj7EHJQwcKGeDacGHtRuP",
"QmTogHdDApN1kTDEtAYbs43m9jRDc3JNvxSWjgkQrPV6ja",
"QmTKSW2PzUpoAj6oiVa7tSh3pzJvpJU6H2YrTLSx746D9f",
"QmbQjggJpXPkCmLYHt46VuZ6hSPvS51WcXBRvvy6ezzjGW",
"QmRV35WjZwvdaBoPVr1YX8oqLHxnDcYfNXju7QvWXCV7h9",
"QmTbzjS9RUajbKfELMDyYTpoopi8VTgwhYRefSect6RowM",
"QmZus6AWjsVAsinnGimJ1sTfFRaQn4R2abupHY8DimNcdc",
"QmVawAxirBmd56DNv7RuxP1m4m1UNR8goCt9H9H1ME3PDc",
"QmThmqdMEAyyE7rdN7uE1AgQKfM4cRiWkTDWs1QGuqDBWe",
"QmP9MtgGpANWKujcWUpRZkANDNhcfM4yTncQMzAeNZ34N8",
"QmajtUPkX3EzfsRq9EwQTYo88DNfCnKHVWE1po1dCc7JGL",
"QmaLqdQs1X3AKs2BRxZUxJjbVJqtXLfC1SycJysafbW8Tp",
"QmUVxfFwRbPGxY9sM65QeRvg4ng4Vt2hsCMSL6kGBTZbtg",
"QmdzVD1XC4D7ydPa2dP98WmDpvkcxizApebc1ujJvwzThb",
"QmStSzhebV5cvokQ6Q3PRgnHLfciiMFPbh9DMnCvHZ2KXG",
"QmW8zFv1CFqDnqxjBnR69db5Gj54RnYrim4qqwtqZ5kMyC",
"QmahcvNu6XbtwDLHz45iYqrzf9qzxTRZ4qtn9o7JaZ8VBv",
"QmaMvgiHEZSEnU9THJPwAthYNbQuwSdZkPqiC3FiwnRJfX",
"QmP7FQNXYhe5eWWQEHRT4SihCTF7dZbv3LSMBtXY3HyBto",
"QmRxC4a7Uo23KCYVqUxsHmimKA1wYTukJ6CGRgm8aCZ1Gd"
];
for (uint256 i = 0; i < 100; i++) {
// We must fire this event once per rock in order for OpenSea to recognize
// the NFTs. When an EtherRock is transfered after deployment, OpenSea
// will notice the change in ownership of this NFT within 24 hours.
emit Transfer(address(0), etherRock.getRockInfo(i), i);
}
}
/// @notice Count all NFTs assigned to an owner
function balanceOf(address _owner) public view override returns (uint256) {
uint256 index;
while (true) {
try etherRock.rockOwners(_owner, index) returns (uint256) {
index++;
} catch {
return index;
}
}
}
/// @notice Find the owner of an NFT
function ownerOf(uint256 tokenId) public view override returns (address) {
if (tokenId < 100) {
return etherRock.getRockInfo(tokenId);
}
revert("Query for nonexistent tokenId");
}
function _transfer(
address _from,
address _to,
uint256 _tokenId
) internal override {
revert("NFT is attached to rock");
}
function tokenOfOwnerByIndex(address _owner, uint256 _index)
public
view
override
returns (uint256)
{
try etherRock.rockOwners(_owner, _index) returns (uint256 tokenId) {
return tokenId;
} catch {
revert("Index out of bounds");
}
}
} | 0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80634f6ccce7116100a2578063a22cb46511610071578063a22cb4651461022e578063b88d4fde14610241578063c87b56dd14610254578063e985e9c514610267578063ea9f1b87146102a35761010b565b80634f6ccce7146101ed5780636352211e1461020057806370a082311461021357806395d89b41146102265761010b565b806318160ddd116100de57806318160ddd1461019d57806323b872dd146101b45780632f745c59146101c757806342842e0e146101da5761010b565b806301ffc9a71461011057806306fdde0314610148578063081812fc1461015d578063095ea7b314610188575b600080fd5b61013361011e366004610c8e565b60036020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101506102be565b60405161013f9190610d7b565b61017061016b366004610cc6565b61034c565b6040516001600160a01b03909116815260200161013f565b61019b610196366004610c63565b61038c565b005b6101a660025481565b60405190815260200161013f565b61019b6101c2366004610b19565b610499565b6101a66101d5366004610c63565b6104a9565b61019b6101e8366004610b19565b61057f565b6101a66101fb366004610cc6565b61059a565b61017061020e366004610cc6565b6105e7565b6101a6610221366004610aa9565b6106c4565b610150610776565b61019b61023c366004610c32565b610783565b61019b61024f366004610b59565b6107ef565b610150610262366004610cc6565b610858565b610133610275366004610ae1565b6001600160a01b03918216600090815260cc6020908152604080832093909416825291909152205460ff1690565b6101707341f28833be34e6ede3c58d1f597bef429861c4e281565b600080546102cb90610dba565b80601f01602080910402602001604051908101604052809291908181526020018280546102f790610dba565b80156103445780601f1061031957610100808354040283529160200191610344565b820191906000526020600020905b81548152906001019060200180831161032757829003601f168201915b505050505081565b6000610357826105e7565b506068826064811061037957634e487b7160e01b600052603260045260246000fd5b01546001600160a01b031690505b919050565b6000610397826105e7565b9050336001600160a01b03821614806103d357506001600160a01b038116600090815260cc6020908152604080832033845290915290205460ff165b6104245760405162461bcd60e51b815260206004820152601e60248201527f4e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c000060448201526064015b60405180910390fd5b826068836064811061044657634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03928316179055604051839185811691908416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590600090a4505050565b6104a4838383610916565b505050565b604051631ee284b160e01b81526001600160a01b0383166004820152602481018290526000907341f28833be34e6ede3c58d1f597bef429861c4e290631ee284b19060440160206040518083038186803b15801561050657600080fd5b505afa925050508015610536575060408051601f3d908101601f1916820190925261053391810190610cde565b60015b6105785760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161041b565b9392505050565b6104a4838383604051806020016040528060008152506107ef565b600060025482106105e35760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161041b565b5090565b6000606482101561067c576040516306e2237160e41b8152600481018390527341f28833be34e6ede3c58d1f597bef429861c4e290636e2237109060240160206040518083038186803b15801561063d57600080fd5b505afa158015610651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106759190610ac5565b9050610387565b60405162461bcd60e51b815260206004820152601d60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e4964000000604482015260640161041b565b6000805b604051631ee284b160e01b81526001600160a01b0384166004820152602481018290527341f28833be34e6ede3c58d1f597bef429861c4e290631ee284b19060440160206040518083038186803b15801561072257600080fd5b505afa925050508015610752575060408051601f3d908101601f1916820190925261074f91810190610cde565b60015b61075d579050610387565b8161076781610def565b925050506106c8565b50919050565b600180546102cb90610dba565b33600081815260cc602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6107fa848484610916565b6108068484848461095e565b6108525760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e2045524337323120726563656976657200604482015260640161041b565b50505050565b6060610863826105e7565b506004826064811061088557634e487b7160e01b600052603260045260246000fd5b01805461089190610dba565b80601f01602080910402602001604051908101604052809291908181526020018280546108bd90610dba565b801561090a5780601f106108df5761010080835404028352916020019161090a565b820191906000526020600020905b8154815290600101906020018083116108ed57829003601f168201915b50505050509050919050565b60405162461bcd60e51b815260206004820152601760248201527f4e465420697320617474616368656420746f20726f636b000000000000000000604482015260640161041b565b6000833b80610971576001915050610aa1565b600080866001600160a01b0316600063150b7a0260e01b338b8a8a60405160240161099f9493929190610d3e565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516109dd9190610d22565b60006040518083038185875af1925050503d8060008114610a1a576040519150601f19603f3d011682016040523d82523d6000602084013e610a1f565b606091505b509150915081610a715760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e2045524337323120726563656976657200604482015260640161041b565b600081806020019051810190610a879190610caa565b6001600160e01b031916630a85bd0160e11b149450505050505b949350505050565b600060208284031215610aba578081fd5b813561057881610e2c565b600060208284031215610ad6578081fd5b815161057881610e2c565b60008060408385031215610af3578081fd5b8235610afe81610e2c565b91506020830135610b0e81610e2c565b809150509250929050565b600080600060608486031215610b2d578081fd5b8335610b3881610e2c565b92506020840135610b4881610e2c565b929592945050506040919091013590565b60008060008060808587031215610b6e578081fd5b8435610b7981610e2c565b93506020850135610b8981610e2c565b925060408501359150606085013567ffffffffffffffff80821115610bac578283fd5b818701915087601f830112610bbf578283fd5b813581811115610bd157610bd1610e16565b604051601f8201601f19908116603f01168101908382118183101715610bf957610bf9610e16565b816040528281528a6020848701011115610c11578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215610c44578182fd5b8235610c4f81610e2c565b915060208301358015158114610b0e578182fd5b60008060408385031215610c75578182fd5b8235610c8081610e2c565b946020939093013593505050565b600060208284031215610c9f578081fd5b813561057881610e44565b600060208284031215610cbb578081fd5b815161057881610e44565b600060208284031215610cd7578081fd5b5035919050565b600060208284031215610cef578081fd5b5051919050565b60008151808452610d0e816020860160208601610d8e565b601f01601f19169290920160200192915050565b60008251610d34818460208701610d8e565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090610d7190830184610cf6565b9695505050505050565b6000602082526105786020830184610cf6565b60005b83811015610da9578181015183820152602001610d91565b838111156108525750506000910152565b600181811c90821680610dce57607f821691505b6020821081141561077057634e487b7160e01b600052602260045260246000fd5b6000600019821415610e0f57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4157600080fd5b50565b6001600160e01b031981168114610e4157600080fdfea2646970667358221220981da9c3d119a9dfe68b8d77e6f73b05b04f051601663fa77059ff516576c64364736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,597 |
0x9aed67c464d5843a2fde16249132ec8f0972f800 | pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
**/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
**/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
**/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
**/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
**/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
**/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic interface
* @dev Basic ERC20 interface
**/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
**/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
**/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
**/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
**/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
**/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
**/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
**/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
**/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
**/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Configurable
* @dev Configurable varriables of the contract
**/
contract Configurable {
uint256 public constant cap = 1000000*10**18;
uint256 public constant basePrice = 100*10**18; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 1000000*10**18;
uint256 public remainingTokens = 0;
}
/**
* @title CrowdsaleToken
* @dev Contract to preform crowd sale with token
**/
contract CrowdsaleToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
icoStart,
icoEnd
}
Stages currentStage;
/**
* @dev constructor of CrowdsaleToken
**/
constructor() public {
currentStage = Stages.none;
balances[owner] = balances[owner].add(tokenReserve);
totalSupply_ = totalSupply_.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner, tokenReserve);
}
/**
* @dev fallback function to send ether to for Crowd sale
**/
function () public payable {
require(currentStage == Stages.icoStart);
require(msg.value > 0);
require(remainingTokens > 0);
uint256 weiAmount = msg.value; // Calculate tokens to sell
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
if(tokensSold.add(tokens) > cap){
uint256 newTokens = cap.sub(tokensSold);
uint256 newWei = newTokens.div(basePrice).mul(1 ether);
returnWei = weiAmount.sub(newWei);
weiAmount = newWei;
tokens = newTokens;
}
tokensSold = tokensSold.add(tokens); // Increment raised amount
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
msg.sender.transfer(returnWei);
emit Transfer(address(this), msg.sender, returnWei);
}
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(this), msg.sender, tokens);
totalSupply_ = totalSupply_.add(tokens);
owner.transfer(weiAmount);// Send money to owner
}
/**
* @dev startIco starts the public ICO
**/
function startIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
currentStage = Stages.icoStart;
}
/**
* @dev endIco closes down the ICO
**/
function endIco() internal {
currentStage = Stages.icoEnd;
// Transfer any remaining tokens
if(remainingTokens > 0)
balances[owner] = balances[owner].add(remainingTokens);
// transfer any remaining ETH balance in the contract to the owner
owner.transfer(address(this).balance);
}
/**
* @dev finalizeIco closes down the ICO and sets needed varriables
**/
function finalizeIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
endIco();
}
}
/**
* @title LavevelToken
* @dev Contract to create the Lavevel Token
**/
contract LavevelToken is CrowdsaleToken {
string public constant name = "Lavavel";
string public constant symbol = "LVL";
uint32 public constant decimals = 18;
} | 0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146104c1578063095ea7b31461055157806318160ddd146105b657806323b872dd146105e1578063313ce56714610666578063355274ea1461069d578063518ab2a8146106c857806366188463146106f357806370a082311461075857806389311e6f146107af5780638da5cb5b146107c6578063903a3ef61461081d57806395d89b4114610834578063a9059cbb146108c4578063bf58390314610929578063c7876ea414610954578063cbcb31711461097f578063d73dd623146109aa578063dd62ed3e14610a0f578063f2fde38b14610a86575b60008060008060006001600281111561012757fe5b600560149054906101000a900460ff16600281111561014257fe5b14151561014e57600080fd5b60003411151561015d57600080fd5b600060045411151561016e57600080fd5b3494506101a7670de0b6b3a764000061019968056bc75e2d6310000088610ac990919063ffffffff16565b610b0190919063ffffffff16565b93506000925069d3c21bcecceda10000006101cd85600354610b1790919063ffffffff16565b1115610248576101f260035469d3c21bcecceda1000000610b3390919063ffffffff16565b915061022a670de0b6b3a764000061021c68056bc75e2d6310000085610b0190919063ffffffff16565b610ac990919063ffffffff16565b905061023f8186610b3390919063ffffffff16565b92508094508193505b61025d84600354610b1790919063ffffffff16565b60038190555061028260035469d3c21bcecceda1000000610b3390919063ffffffff16565b600481905550600083111561033e573373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501580156102d7573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b61038f846000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361044b84600154610b1790919063ffffffff16565b600181905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501580156104b9573d6000803e3d6000fd5b505050505050005b3480156104cd57600080fd5b506104d6610b4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105165780820151818401526020810190506104fb565b50505050905090810190601f1680156105435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055d57600080fd5b5061059c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b85565b604051808215151515815260200191505060405180910390f35b3480156105c257600080fd5b506105cb610c77565b6040518082815260200191505060405180910390f35b3480156105ed57600080fd5b5061064c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c81565b604051808215151515815260200191505060405180910390f35b34801561067257600080fd5b5061067b61103b565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3480156106a957600080fd5b506106b2611040565b6040518082815260200191505060405180910390f35b3480156106d457600080fd5b506106dd61104e565b6040518082815260200191505060405180910390f35b3480156106ff57600080fd5b5061073e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611054565b604051808215151515815260200191505060405180910390f35b34801561076457600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e5565b6040518082815260200191505060405180910390f35b3480156107bb57600080fd5b506107c461132d565b005b3480156107d257600080fd5b506107db6113e3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082957600080fd5b50610832611409565b005b34801561084057600080fd5b506108496114a3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561088957808201518184015260208101905061086e565b50505050905090810190601f1680156108b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d057600080fd5b5061090f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114dc565b604051808215151515815260200191505060405180910390f35b34801561093557600080fd5b5061093e6116fb565b6040518082815260200191505060405180910390f35b34801561096057600080fd5b50610969611701565b6040518082815260200191505060405180910390f35b34801561098b57600080fd5b5061099461170e565b6040518082815260200191505060405180910390f35b3480156109b657600080fd5b506109f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061171c565b604051808215151515815260200191505060405180910390f35b348015610a1b57600080fd5b50610a70600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611918565b6040518082815260200191505060405180910390f35b348015610a9257600080fd5b50610ac7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061199f565b005b600080831415610adc5760009050610afb565b8183029050818382811515610aed57fe5b04141515610af757fe5b8090505b92915050565b60008183811515610b0e57fe5b04905092915050565b60008183019050828110151515610b2a57fe5b80905092915050565b6000828211151515610b4157fe5b818303905092915050565b6040805190810160405280600781526020017f4c61766176656c0000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610cbe57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d0b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d9657600080fd5b610de7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f4b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b69d3c21bcecceda100000081565b60035481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611165576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9565b6111788382610b3390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138957600080fd5b60028081111561139557fe5b600560149054906101000a900460ff1660028111156113b057fe5b141515156113bd57600080fd5b6001600560146101000a81548160ff021916908360028111156113dc57fe5b0217905550565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561146557600080fd5b60028081111561147157fe5b600560149054906101000a900460ff16600281111561148c57fe5b1415151561149957600080fd5b6114a1611af7565b565b6040805190810160405280600381526020017f4c564c000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561151957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561156657600080fd5b6115b7826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061164a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60045481565b68056bc75e2d6310000081565b69d3c21bcecceda100000081565b60006117ad82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119fb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a3757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6002600560146101000a81548160ff02191690836002811115611b1657fe5b021790555060006004541115611c0057611b9b600454600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1790919063ffffffff16565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611c7f573d6000803e3d6000fd5b505600a165627a7a72305820661e9a95d24df3c86b5719a1e7351a8c0f562ee2f5bf6dcb4a7baeee463c34c20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,598 |
0x5A0d711eA0918E310c4CcfBfaB546b9B196d36bf | /*
Join our telegram: https://t.me/fivekinu
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█ _____ _ __ _____ _ _ _ _ █
█ | ____| |/ / |_ _| \ | | | | | █
█ | |__ | ' / | | | \| | | | | █
█ |___ \| < | | | . ` | | | | █
█ ___) | . \ _| |_| |\ | |__| | █
█ |____/|_|\_\ |_____|_| \_|\____/ █
█ █
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
Join our telegram: https://t.me/fivekinu
Story of 5K Inu
He is very quiet but never stops smiling.
He never sleeps and asks his family to sleep for at least 1 day.
He always makes his family surprise when they wake up.
He loves the green color and he becomes angry when he sees the red color.
He is perfectly carefree.
He is O.K.
His dream is to make 5K holders.
He is aiming to make 5K per week.
5K Inu is here to make you OK.
Token Information
- 1000,000,000,000 Total Supply
- 15% Burned
- Developer provides LP & LOCK
- No Presale & Team tokens
- Buy limit Feature
- Fair launch for everyone
- 5% redistribution to holders
- Dev Team fee 10%
*/
// SPDX-License-Identifier: 5KDEV
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 OKInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "5K Inu";
string private constant _symbol = "5KINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
address payable private _marketingFund;
address payable private _charityFund;
address private uniswapV2Pair;
IUniswapV2Router02 private uniswapV2Router;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
mapping(address => bool) private bots;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_marketingFund = addr1;
_charityFund = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingFund] = true;
_isExcludedFromFee[_charityFund] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_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");
require(!bots[from] && !bots[to], "NO SIR");
if (from != owner() && to != owner()) {
require(amount <= _maxTxAmount);
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 {
_marketingFund.transfer(amount.div(2));
_charityFund.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "opened already");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setBots(address[] memory input) public onlyOwner {
for (uint256 i = 0; i < input.length; i++) {
bots[input[i]] = true;
}
}
function delBot(address input) public onlyOwner {
bots[input] = false;
}
function collectToken() external {
require(_msgSender() == _marketingFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
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**3);
}
}
| 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a146102b8578063cc4cc05f146102d8578063d543dbeb146102ed578063dd62ed3e1461030d57600080fd5b8063715018a61461022d5780638da5cb5b1461024257806395d89b411461026a578063a9059cbb1461029857600080fd5b8063273123b7116100c6578063273123b7146101ba578063293230b8146101dc578063313ce567146101f157806370a082311461020d57600080fd5b806306fdde0314610103578063095ea7b31461014457806318160ddd1461017457806323b872dd1461019a57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b50604080518082019091526006815265354b20496e7560d01b60208201525b60405161013b9190611776565b60405180910390f35b34801561015057600080fd5b5061016461015f36600461161f565b610353565b604051901515815260200161013b565b34801561018057600080fd5b50683635c9adc5dea000005b60405190815260200161013b565b3480156101a657600080fd5b506101646101b53660046115df565b61036a565b3480156101c657600080fd5b506101da6101d536600461156f565b6103d3565b005b3480156101e857600080fd5b506101da610427565b3480156101fd57600080fd5b506040516009815260200161013b565b34801561021957600080fd5b5061018c61022836600461156f565b6107dd565b34801561023957600080fd5b506101da6107ff565b34801561024e57600080fd5b506000546040516001600160a01b03909116815260200161013b565b34801561027657600080fd5b50604080518082019091526005815264354b494e5560d81b602082015261012e565b3480156102a457600080fd5b506101646102b336600461161f565b610873565b3480156102c457600080fd5b506101da6102d336600461164a565b610880565b3480156102e457600080fd5b506101da610920565b3480156102f957600080fd5b506101da610308366004611731565b610966565b34801561031957600080fd5b5061018c6103283660046115a7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610360338484610a05565b5060015b92915050565b6000610377848484610b29565b6103c984336103c48560405180606001604052806028815260200161193c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610dd2565b610a05565b5060019392505050565b6000546001600160a01b031633146104065760405162461bcd60e51b81526004016103fd906117c9565b60405180910390fd5b6001600160a01b03166000908152600f60205260409020805460ff19169055565b6000546001600160a01b031633146104515760405162461bcd60e51b81526004016103fd906117c9565b600d54600160a01b900460ff161561049c5760405162461bcd60e51b815260206004820152600e60248201526d6f70656e656420616c726561647960901b60448201526064016103fd565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556104d93082683635c9adc5dea00000610a05565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561051257600080fd5b505afa158015610526573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054a919061158b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca919061158b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561061257600080fd5b505af1158015610626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064a919061158b565b600c80546001600160a01b0319166001600160a01b03928316179055600d541663f305d719473061067a816107dd565b60008061068f6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156106f257600080fd5b505af1158015610706573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061072b9190611749565b5050600d8054673afb087b87690000600e5562ff00ff60a01b1981166201000160a01b17909155600c5460405163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156107a157600080fd5b505af11580156107b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d99190611711565b5050565b6001600160a01b03811660009081526002602052604081205461036490610e0c565b6000546001600160a01b031633146108295760405162461bcd60e51b81526004016103fd906117c9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610360338484610b29565b6000546001600160a01b031633146108aa5760405162461bcd60e51b81526004016103fd906117c9565b60005b81518110156107d9576001600f60008484815181106108dc57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610918816118dc565b9150506108ad565b600a546001600160a01b0316336001600160a01b03161461094057600080fd5b600061094b306107dd565b905061095681610e90565b4780156107d9576107d981611035565b6000546001600160a01b031633146109905760405162461bcd60e51b81526004016103fd906117c9565b600081116109e05760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103fd565b6109ff6103e86109f9683635c9adc5dea00000846110ba565b90611139565b600e5550565b6001600160a01b038316610a675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103fd565b6001600160a01b038216610ac85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103fd565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b8d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103fd565b6001600160a01b038216610bef5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103fd565b60008111610c515760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103fd565b6001600160a01b0383166000908152600f602052604090205460ff16158015610c9357506001600160a01b0382166000908152600f602052604090205460ff16155b610cc85760405162461bcd60e51b815260206004820152600660248201526527279029a4a960d11b60448201526064016103fd565b6000546001600160a01b03848116911614801590610cf457506000546001600160a01b03838116911614155b15610d7557600e54811115610d0857600080fd5b6000610d13306107dd565b600d54909150600160a81b900460ff16158015610d3e5750600c546001600160a01b03858116911614155b8015610d535750600d54600160b01b900460ff165b15610d7357610d6181610e90565b478015610d7157610d7147611035565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610db757506001600160a01b03831660009081526005602052604090205460ff165b15610dc0575060005b610dcc8484848461117b565b50505050565b60008184841115610df65760405162461bcd60e51b81526004016103fd9190611776565b506000610e0384866118c5565b95945050505050565b6000600654821115610e735760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103fd565b6000610e7d6111a7565b9050610e898382611139565b9392505050565b600d805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ee657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610f3a57600080fd5b505afa158015610f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f72919061158b565b81600181518110610f9357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600d54610fb99130911684610a05565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ff29085906000908690309042906004016117fe565b600060405180830381600087803b15801561100c57600080fd5b505af1158015611020573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b600a546001600160a01b03166108fc61104f836002611139565b6040518115909202916000818181858888f19350505050158015611077573d6000803e3d6000fd5b50600b546001600160a01b03166108fc611092836002611139565b6040518115909202916000818181858888f193505050501580156107d9573d6000803e3d6000fd5b6000826110c957506000610364565b60006110d583856118a6565b9050826110e28583611886565b14610e895760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103fd565b6000610e8983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111ca565b80611188576111886111f8565b61119384848461121b565b80610dcc57610dcc6005600855600a600955565b60008060006111b4611312565b90925090506111c38282611139565b9250505090565b600081836111eb5760405162461bcd60e51b81526004016103fd9190611776565b506000610e038486611886565b6008541580156112085750600954155b1561120f57565b60006008819055600955565b60008060008060008061122d87611354565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061125f90876113b1565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461128e90866113f3565b6001600160a01b0389166000908152600260205260409020556112b081611452565b6112ba848361149c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112ff91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061132e8282611139565b82101561134b57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006113718a6008546009546114c0565b92509250925060006113816111a7565b905060008060006113948e87878761150f565b919e509c509a509598509396509194505050505091939550919395565b6000610e8983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dd2565b600080611400838561186e565b905083811015610e895760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103fd565b600061145c6111a7565b9050600061146a83836110ba565b3060009081526002602052604090205490915061148790826113f3565b30600090815260026020526040902055505050565b6006546114a990836113b1565b6006556007546114b990826113f3565b6007555050565b60008080806114d460646109f989896110ba565b905060006114e760646109f98a896110ba565b905060006114ff826114f98b866113b1565b906113b1565b9992985090965090945050505050565b600080808061151e88866110ba565b9050600061152c88876110ba565b9050600061153a88886110ba565b9050600061154c826114f986866113b1565b939b939a50919850919650505050505050565b803561156a81611923565b919050565b600060208284031215611580578081fd5b8135610e8981611923565b60006020828403121561159c578081fd5b8151610e8981611923565b600080604083850312156115b9578081fd5b82356115c481611923565b915060208301356115d481611923565b809150509250929050565b6000806000606084860312156115f3578081fd5b83356115fe81611923565b9250602084013561160e81611923565b929592945050506040919091013590565b60008060408385031215611631578182fd5b823561163c81611923565b946020939093013593505050565b6000602080838503121561165c578182fd5b823567ffffffffffffffff80821115611673578384fd5b818501915085601f830112611686578384fd5b8135818111156116985761169861190d565b8060051b604051601f19603f830116810181811085821117156116bd576116bd61190d565b604052828152858101935084860182860187018a10156116db578788fd5b8795505b83861015611704576116f08161155f565b8552600195909501949386019386016116df565b5098975050505050505050565b600060208284031215611722578081fd5b81518015158114610e89578182fd5b600060208284031215611742578081fd5b5035919050565b60008060006060848603121561175d578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156117a257858101830151858201604001528201611786565b818111156117b35783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561184d5784516001600160a01b031683529383019391830191600101611828565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611881576118816118f7565b500190565b6000826118a157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156118c0576118c06118f7565b500290565b6000828210156118d7576118d76118f7565b500390565b60006000198214156118f0576118f06118f7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461193857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fc4d01606b5cf590cbc4c1c2e0293d55ce2dfd2f3541936ac4d0d6e36387723264736f6c63430008040033 | {"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"}]}} | 1,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.